Tuesday, January 25, 2011

OpenGL 3.0 and above deprecated func. and their replacement

Hi,
Here i am writing a quick reference list for deprecated functionality in OpenGL3.3 and its replacements. I will update this list regularly.




Deprecated functionalityReplacement in OpenGL3.3
Fixed function pipelineShaders
glRotate*/glTranslate*/glScale*
/glMatrixMode/glLoadMatrix/glMultMatrix etc.
Use either a custom matrix library or public libraries like glm.
glTexEnvfCombine textures in anyway using fragment shaders.
gluBuild2DMipmaps Use either GL_GENERATE_MIPMAP texture parameter or the glGenerateMipmap function. Set the max mipmap level and the base mipmap level using
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 0);glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 4);
glEnable(GL_POINT_SMOOTH)Use custom shader
glEnable(GL_TEXTURE_2D)No need. Ue glActiveTexture(GL_TEXTUREn) and bind the texture to the nth texture unit.
glVertex*/glColor*/glNormal*/glTexCoord*Use vbo and vao to maintain the vbo states. Drawing is done using glDraw[Arrays,Elements, RangeElements, InterleavedElements etc.] functions.
glPolygonMode(GL_FRONT, GL_LINE);glPolygonMode(GL_BACK, GL_LINE); In OpenGL 3.0 and above core profile, only the combined front and back face enumerant is valid, single enumerant GL_FRONT or GL_BACK raises INVALID_OPERATION. So the only valid call is glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);

[to be contd.]

3 comments:

  1. Yes for v 3.0 and above core profile. For texture mapping though you need to use glTexStorage functions rather than glTexImage.

    For v 4 and above, if you find anything missing, please add in the comments.

    ReplyDelete
  2. Thanks for the update on glTexStorage. Was still using glTexImage in GL ES 2.0.

    ReplyDelete