This article explains some unexpected results and artefacts you can get when rendering stuff, and how to avoid them.
One thing that always should be tried (before trying anything else) is checking for errors with glGetError.
If you use OpenGL in a way that is not covered by the specification, there is no guarantee for any specific result. This can usually be avoided by checking for errors. Note that some implementations are less restrictive than the specification about what is accepted (notably NVIDIA implementations). Things might seem to work fine on some implementations, but they might not work on others.
There might be a bug in the OpenGL implementation. This is however rare. Often people think they have discovered a bug when they in fact haven't. Make sure you follow the specification if you are going to send a bug report to the vendor.
It is (very) unlikely that two OpenGL implementations would have the same bug. If you get the same (unwanted) result on different implementations, it is probably not a bug.
Nothing is rendered at all
This means your window is filled by a single colour (often black). This can have several causes, not limited to those listed:
- Your context isn't initialized correctly
- You call glClear() immediately before swapping buffers
- You don't swap buffers at all
- Every fragment fails depth testing, perhaps since the depth buffer isn't set up correctly.
Colours appear wrong
This can be the result of passing the wrong format parameter to glTexImage*, often passing GL_RGBA instead of GL_BGRA. For more information, see Image Format and Pixel Transfer.
On Microsoft Windows, there is a setting for how many colours the monitor can display. Make sure this is set to display 32-bit colours.