Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have to confirm that a primitive (say triangle) is rendered properly in opengl.

I can use the glGetError() after a opengl draw calls(glDrawElement/glDrawArrays)

Is it enough to confirm ? Is there any other ways to confirm?

Please let me know.

  • Arun AC
share|improve this question
What do you mean "properly"? Are there specific types of rendering errors you're trying to detect? – Nathan Reed Sep 5 '13 at 4:06
You could look at the screen =) But seriously, like Nathan is asking: what do you need to verify? Just no GL errors, specific output compared to previous runs, what do you need to see or not see? – Patrick Hughes Sep 5 '13 at 4:38
-If you see it. – bobobobo Sep 5 '13 at 15:48

The answer depends a lot on what you mean by "properly", but overall, you pretty much can't.

Some architectures postpone actual rendering as much as possible, so if some odd error occurs at a very late stage, there's no way to signal an error. However, these cases are very, very rare, and you'll likely get an error while setting up rendering - be sure to check your shader compilation logs, etc.

A lot of things can go wrong, so it's generally a good idea to pepper your code with glerror checks. Alternatively (or additionally) you may want to hit your program with gDEBugger, or whatever AMD is calling it these days.

Now, if by "properly" you mean from a driver/hardware developer point of view, you can always just flush, read back the framebuffer and do a compare with a "golden image"..

share|improve this answer

Well if you absolutely need NASA space mission perfection, the only way to really be sure it rendered correctly is to do it yourself in software and compare it to the OpenGL output...

That aside, if you can rely on an estimate of the number of pixels then you could investigate using Occlusion Queries to make a guess as to whether or not it rendered properly.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.