OpenGL ES Flashcards
What is the signature of glFoo3fv?
glFoo3fv(… const GLFloat* arg1);
What is the signature of glFoo2ub?
glFoo2ub(… const GLByte arg1, const glByte arg2);
What is glUniform(GLint location, …)?
glUniform modifies the value of a uniform variable or a uniform variable array. The location of the uniform variable to be modified is specified by location, which should be a value returned by glGetUniformLocation. glUniform operates on the program object that was made part of current state by calling glUseProgram.
void glDrawArrays( GLenum mode, GLint first, GLsizei count)
glDrawArrays specifies multiple geometric primitives with very few subroutine calls. Instead of calling a GL procedure to pass each individual vertex, normal, texture coordinate, edge flag, or color, you can prespecify separate arrays of vertices, normals, and colors and use them to construct a sequence of primitives with a single call to glDrawArrays.
What is the practical difference between glDrawElements and glDrawArrays?
glDrawElements takes advantage of vertex indexing and reuse. If vertices are reused, it will be more efficient than glDrawArrays, which sends vertices across main memory.
What is void glVertexAttribPointer(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid * pointer) ?
glVertexAttribPointer, glVertexAttribIPointer and glVertexAttribLPointer specify the location and data format of the array of generic vertex attributes at index index to use when rendering.
What is void glVertexAttribDivisor(GLuint index, GLuint divisor) ?
glVertexAttribDivisor modifies the rate at which generic vertex attributes advance when rendering multiple instances of primitives in a single draw call.
uniform
Uniforms are sent to both vertex shaders and fragment shaders and contain values that stay the same across the entire frame being rendered. A good example of this might be a light’s position.
attribute
Attributes are values that are applied to individual vertices. Attributes are only available to the vertex shader. This could be something like each vertex having a distinct colour. Attributes have a one-to-one relationship with vertices.
varying
Varyings are variables declared in the vertex shader that we want to share with the fragment shader. To do this we make sure we declare a varying variable of the same type and name in both the vertex shader and the fragment shader. A classic use of this would be a vertex’s normal since this can be used in the lighting calculations.
What does the Model matrix do?
It maps from object space to world space.
What does the View matrix do?
It maps from world space to camera space.
What does the Projection matrix do?
It maps camera space to screen space.
What is immediate mode?
Examples include using glBegin, glVertex, glEnd. Or glDrawArrays with a client vertex array instead of a vertex buffer object. This functionality is deprecated and does not offer good performance. Most of these are blocking function calls.
What is retained mode?
In retained mode, you create a vertex buffer object and hand it over to the library. You can no longer manipulate it. This allows your render thread and the GPU to work asynchronously.