Common OpenGL Pitfalls

https://www.opengl.org/wiki/Common_Mistakes
Interesting notes:
1: glDrawPixels() command.

2: Slow pixel transfer performance
Pixel Transfer: https://www.opengl.org/wiki/Pixel_Transfer
2.1: glReadPixels
2.2: glTexSubImage

https://www.opengl.org/archives/resources/features/KilgardTechniques/oglpitfall/
4. Overflowing the Projection Matrix Stack
glPushMatrix
glPopMatrix
glGetIntergerv to see max depth of stack supported.
Default/Min requirement: 32 for ModelView Matrix, 2 for everything else.

7. Watch Your Pixel Store Alignment
pixels = (GLubyte*) malloc(3 * 11 * 8); /* Wrong! */
OpenGL's default 4-byte row alignment.

10. The Viewport Does Not Clip or Scissor

12. OpenGL's Lower Left Origin
Will affect reading in textures. Because it will try to
read from the bottom most scan line first.

15. Much OpenGL State Affects All Primitives
This issue is not unique to the per-fragment and rasterization state. The pixel path state is shared by the draw pixels (glDrawPixels), read pixels (glReadPixels), copy pixels (glCopyPixels), and texture download (glTexImage2D) paths. If you are not careful, it is easy to get into situations where a texture download is screwed up because the pixel path was left configured for a pixel read back.

Leave a comment