Jump to content
  • Advertisement
Sign in to follow this  
coorn

OpenGL glFlush, tristrip

This topic is 4517 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have worked some time with OpenGL now but there are a few questions that I can't find any answers to. 1. What exactly does glFlush do? (more precise then the red book plz) 2. If the GPU is the bottleneck where does the CPU wait for the GPU ? Does this happen when the command buffer to the GPU gets full and in that case at glDrawElements ? 3. I use glDrawElement(GL_TRIANGLES, numIndexes, GL_UNSIGNED_INT, indexes) is it faster if I arrange the indexes so that they form a strip even if I still use GL_TRIANGLES? Or do I have to use GL_TRIANGLE_STRIP to get the speed improvement?

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by coorn
1. What exactly does glFlush do? (more precise then the red book plz)
It asks the driver to send all buffered commands to the GPU. In theory, you might use it if you know you won't be sending any commands for a while and want to let the driver know so that it can begin processing any queued commands. In practice, the driver will detect this anyway, so glFlush() (and usually even glFinish()) is a typically a no-op (literally).
Quote:
Original post by coorn
2. If the GPU is the bottleneck where does the CPU wait for the GPU ? Does this happen when the command buffer to the GPU gets full and in that case at glDrawElements?
Usually the CPU will only wait for the GPU when it has to - specificly, when it depends on a series of commands having completed, such as swapping buffers or reading from the framebuffer. I would think that, on PCs at least, filling up the command buffer would only be an issue in pathological situations.
Quote:
Original post by coorn
3. I use glDrawElement(GL_TRIANGLES, numIndexes, GL_UNSIGNED_INT, indexes) is it faster if I arrange the indexes so that they form a strip even if I still use GL_TRIANGLES? Or do I have to use GL_TRIANGLE_STRIP to get the speed improvement?
If you already had the indices arranged to form a strip, why wouldn't you just use a strip? But the answer to your question is really "it depends". Ideally, you want to organize your vertex data so that it accessed roughly sequentially, which will improve caching and thus performance. Arranging your indices to form a strip may help with that.

Share this post


Link to post
Share on other sites

Thanks for some very nice answers!

I do have a follow question :)

Q: Is there a good website, book or open source code that explains all the stuff that happen from the OpenGL commands I use in my program to the hardware gets it? It would be interesting to know.

Share this post


Link to post
Share on other sites
I don't know of any one place to get this information. I know it from being involved with commercial 3D hardware, first at Qualcomm and now at ATI. Whitepapers and presentations from NVIDIA and ATI occasionally mention these kinds of things.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!