Skip to main content
GameDev.net gamedev.net
🔒 Locked

OpenGL primitives "price", Points and lines at distance.

Started by Doktor_Jeep Dec 23, 2006 at 12:23 AM 3 replies 600+ views
Original Post
Doktor_Jeep
Doktor_Jeep
Lately I am experimenting with heightmapped landscapes using the vertex buffers and the draw array functions. I have several questions about processing overhead. First, which is more expensive in cycles and time: GL_TRIANGLES or GL_QUADS? I have noted that GL_QUADS is easier to deal with in texture wrap and culling. Sadly, the CCW poly issue makes using GL_TRIANGLES a little more complicated, yet the GL_QUADS are not a problem as it seems OpenGL handles them well enough. I have seen written that a quad is really just two triangles anyway, just easier to put a texture to in the code. Does OpenGL take that GL_QUADS directive and simply draw two triangles? And my next question is this: I have noted that GL_LINES AND GL_POINTS appears to look no different at great distances than the quad and triangle options. Evidently at such distance perhaps a whole polygon is just a point anyway. What I am wanting to know is, that at large distances when a point or line will do, and there is still a call for triangles or quads in effect, does OpenGL already see this as the case and just draw that dot or lines? Or does one have to, to save processing time, determine these distances manually and actually make the lines or points calls? That is, when all there is is a point to draw, is OpenGL still trying to draw an entire polygon? I find myself wishing that OpenGL was around back in the days I was interpolating, wrapping, and vector dotting. In those days, getting a texture poly to the screen involved going uphill in 3 feet of snow both ways.
jouley
jouley
Quote:
Original post by Doktor_Jeep
I have noted that GL_LINES AND GL_POINTS appears to look no different at great distances than the quad and triangle options. Evidently at such distance perhaps a whole polygon is just a point anyway.

What I am wanting to know is, that at large distances when a point or line will do, and there is still a call for triangles or quads in effect, does OpenGL already see this as the case and just draw that dot or lines? Or does one have to, to save processing time, determine these distances manually and actually make the lines or points calls? That is, when all there is is a point to draw, is OpenGL still trying to draw an entire polygon?


(I'll leave the other questions those who have definitive answers to them, but as for this one...) GL will still render every polygon, unless you manually tell it not to do so at great distances. A common technique is to give the object different LODs, or Levels of Detail (Level of Details? I don't like it.). Basically, you draw the object differently depending on how close or far it is. A dragon may need 30,000 polygons up close, but can effectively be a 30 polygon sphere from far away. A simple way to do this is to pass some sort of camera description to the function that draws a particular object. Then, using this description, find the distance between the camera and the object, and decide at what Level of Detail you'd like to draw it. There will, naturally, be several stages between full-fledged dragon and sphere, it's up to you to define them (a 1,000 polygon dragon, perhaps) and decide which to draw. I'd advise against simply using points or lines, though, as modern graphics cards have been designed to render polygons as quickly as possible, a few squares will be less of a hit than a few thousand points or lines.

Hope this answers at least that question!
-jouley
AndyEsser
AndyEsser
I'm not an expert but I believe that the only thing that your graphics card knows how to draw is points, lines and triangles. Therefore if you use any primitive of higher magnitude (ie. quad, polygon) then the OpenGL driver simply converts it into triangles anyway.
rotalever
rotalever
Hmm, why do you want to render Quads? Triangle-strips will do it!

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.