Log in or register to post comments

Draw a sold rect instead of image.

April 18, 2016 - 8:20pm #1
I would like to draw a solid rect but have not idea. I am using below codes to draw an image. Which part need to be changed? I am working on iOS
 
 
glDepthFunc(GL_ALWAYS);
            
Texture* t = augmentationTexture[0];
GLuint frameTextureID = [t textureID];
                        
glUseProgram(shaderProgramID);
            
glVertexAttribPointer(vertexHandle, 3, GL_FLOAT, GL_FALSE, 0, quadVertices);
glVertexAttribPointer(normalHandle, 3, GL_FLOAT, GL_FALSE, 0, quadNormals);
glVertexAttribPointer(textureCoordHandle, 2, GL_FLOAT, GL_FALSE, 0, quadTexCoords);            
glEnableVertexAttribArray(vertexHandle);
glEnableVertexAttribArray(normalHandle);
glEnableVertexAttribArray(textureCoordHandle);
            
glEnable (GL_BLEND);
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
            
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, frameTextureID);
            
glUniformMatrix4fv(mvpMatrixHandle, 1, GL_FALSE, (GLfloat*)&modelViewProjectionVideo.data[0]);
glUniform1i(texSampler2DHandle, 0);
            
glDrawElements(GL_TRIANGLES, NUM_QUAD_INDEX, GL_UNSIGNED_SHORT, quadIndices);
glDisable(GL_BLEND);
            
glDisableVertexAttribArray(vertexHandle);
glDisableVertexAttribArray(normalHandle);
glDisableVertexAttribArray(textureCoordHandle);
            
glUseProgram(0);
glDepthFunc(GL_LESS);
Log in or register to post comments