Jump to content
  • Advertisement
Sign in to follow this  
Desa

OpenGL glPolygonOffset

This topic is 4676 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

Does anyone know where I can find more information behind the math in OpenGL's glPolygonOffset routine? I have a 3D engine I use for mobile devices and I want to reproduce this function in my own code. Thanks. Here's the info about glPolygonOffset: http://www.opengl.org/resources/faq/technical/polygonoffset.htm#0020
Quote:
Polygon offset allows the application to specify a depth offset with two parameters, factor and units. factor scales the maximum Z slope, with respect to X or Y of the polygon, and units scales the minimum resolvable depth buffer value. The results are summed to produce the depth offset. This offset is applied in screen space, typically with positive Z pointing into the screen.

Share this post


Link to post
Share on other sites
Advertisement
Thanks! That's exactly what I was looking for.

I'm having some trouble with the equation (3.9). Do you know what the w subscript refers to when it talks about a point on the triangle (x,y,z) in the equation? It sounds like from the document that it's just a value from an arbitrary point, but the partial derivative of a number is always 0, so I'm not sure how to evaluate the equation.

Share this post


Link to post
Share on other sites
The w subscript just means that the x, y, and z coordinates are the window-space coordinates of a point inside the triangle. That is, they're the coordinates you get after the viewport transformation is applied to normalized device coordinates.

Share this post


Link to post
Share on other sites
Thanks Eric. That helped a lot. How do you find the point inside the triangle? Also, does the del symbol in the equation (3.9) mean partial derivative or does it mean something else?

Share this post


Link to post
Share on other sites
Yes, those are partial derivatives. Since the triangle is planar, these derivatives are the same everywhere in the triangle, so you could just use ratios of differences between values at different vertices of the triangle for the derivatives.

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!