When you have issues, the first thing you need to do is call [icode]glGetError[/icode], because if OpenGL is having a hissyfit because you’re new to GL, you would never know without retrieving the error. Typically when you’re not seeing anything, it’s either because you’re not actually rendering anything, you’re not rendering anything onscreen (i.e your viewing frustrum is looking in the wrong direction), or OpenGL is having issues.
If you are having GL errors, you must definitely familiarize yourself with the core API reference. Making a post to StackOverflow saying “Opengl is returning error 1281” is pretty pointless because just about every OpenGL call you make can throw all of the errors for different reasons.
When GL throws an error follow these steps:
- Identify which OpenGL call is throwing the error.
- Go to the core API reference page for the call. At the bottom of each page, it defines the various reasons why an error may be thrown.
- Fix your issue. If you are still having problems doing this, you may now post to StackOverflow or JGO or wherever you typically seek help.
When identifying which GL call is throwing the error, you can really do nothing but call [icode]glGetError[/icode] after each GL call. Please note that you need to identify which is the earliest GL call that is throwing the error, because [icode]glGetError[/icode] only holds the most recent error thrown, and if an error is thrown by one call, a later call may throw another error because of the first error, especially if there is a problem in setting a state (OpenGL is a very state based system).
Generally, GL throws one of three errors:
[icode]GL_INVALID_ENUM[/icode] [b](Error 0x500 / Error 1280)[/b]
[icode]GL_INVALID_VALUE[/icode] [b](Error 0x501 / Error 1281)[/b]
[icode]GL_INVALID_OPERATION[/icode] [b](Error 0x502 / Error 1282)[/b]