Code example for FloatBuffer

Methods: glVertexAttribPointerclearpositionput

0
     
	public void draw(float[] mvpMatrix, float[] particleVBO) {
        // create a floating point buffer from the ByteBuffer 
        //vertexBuffer = bb.asFloatBuffer(); 
        // add the coordinates to the FloatBuffer 
        vertexBuffer.clear();
        vertexBuffer.put(particleVBO);
        // set the buffer to read the first coordinate 
        vertexBuffer.position(0);
    	 
    	// Add program to OpenGL environment 
        GLES20.glUseProgram(mProgram);
        MyGLRenderer.checkGlError("glUseProgram"); 
 
        // get handle to vertex shader's vPosition member 
        mPositionHandle = GLES20.glGetAttribLocation(mProgram, "vPosition");
        mInitHandle = GLES20.glGetAttribLocation(mProgram, "inits");
 
         
        // Enable a handle to the triangle vertices 
        GLES20.glEnableVertexAttribArray(mPositionHandle);
        GLES20.glEnableVertexAttribArray(mInitHandle);
         
        // Prepare the triangle coordinate data 
        GLES20.glVertexAttribPointer(mPositionHandle, COORDS_PER_VERTEX,
                                     GLES20.GL_FLOAT, false,
                                     vertexStride, vertexBuffer);
        // GLES20.glVertexAttribPointer(mInitHandle, COORDS_PER_VERTEX, 
        //							 GLES20.GL_FLOAT, false, 
        //							 vertexStride, initBuffer); 
Stop searching for code, let great code find you!  Add Codota to your java IDE