Jump to content

  • Log In with Google      Sign In   
  • Create Account


GlPolygonOffset whats the deal here? is it good or bad?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
5 replies to this topic

#1 thames   Members   -  Reputation: 122

Like
0Likes
Like

Posted 26 July 2005 - 10:10 PM

I am trying to draw lots of filled polygons with primitives ontop. I understand the opengl glpolygonoffset only works on filled polygons, but is this the only way to stop them from interferring?? surely there is a better way? Please help!!! Tom

Sponsor:

#2 pauljan   Members   -  Reputation: 137

Like
0Likes
Like

Posted 26 July 2005 - 10:25 PM

The "better way" would be not to draw multiple polygons in the same location, any good reason why you can't simply avoid it?

The alternative to glPolygonOffset would be to do the decal math by hand.

#3 Aeluned   Members   -  Reputation: 196

Like
0Likes
Like

Posted 27 July 2005 - 02:47 AM

Could you explain what you're trying to do in a little more detail?

The polygons need not be filled to use PolygonOffset.
you can use any of the following enums:

GL_POLYGON_OFFSET_FILL
GL_POLYGON_OFFSET_LINE
GL_POLYGON_OFFSET_POINT

#4 Eric Lengyel   Crossbones+   -  Reputation: 2156

Like
0Likes
Like

Posted 27 July 2005 - 09:28 AM

Hi --

There are some performance reasons not to use glPolygonOffset. Since the polygon slope is factored into the actual distance that fragments are moved forward or backward in the z-buffer, fragments inside very steeply sloped (with respect to the camera) polygons can end up having a z value anywhere in the entire depth range. For this reason, hardware hierarchical z-culling algorithms have to be disabled or severely limited for regions in which polygons are rendered with glPolygonOffset turned on.

An alternative is to modify your projection matrix to perform a z-offset. You can read about this technique in Game Programming Gems 1, Section 4.1, or in Mathematics for 3D Game Programming and Computer Graphics, Section 9.1. Source code can be found here:

http://www.terathon.com/books/code/Listing9.1.txt


#5 thames   Members   -  Reputation: 122

Like
0Likes
Like

Posted 27 July 2005 - 10:50 PM

thank you very much, i actually own this book and will have a look next time i am at home.

Much appreciated

Tom

#6 iforce2d   Members   -  Reputation: 218

Like
0Likes
Like

Posted 28 July 2005 - 01:04 AM

Quote:
An alternative is to modify your projection matrix to perform a z-offset.
What a neat idea. Thanks for the link too.






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS