Jump to content

  • Log In with Google      Sign In   
  • Create Account

Wireframe Overlay - glPolygonOffset

  • You cannot reply to this topic
1 reply to this topic

#1 Tommato   Members   -  Reputation: 139


Posted 07 August 2014 - 04:02 AM

Hi All


I need to draw wireframe over solid object. As I've understood from google, glPolygonOffset is a standard solution for this - but I can't get it to work. With first argument negative it has effect - wireframe disappears. But my wireframe still "blinks" with any view change, no matter what values are passed to glPolygonOffset. I've also tried different draw order and wireframe drawn as lines - no luck. What am I doing wrong?






#2 L. Spiro   Crossbones+   -  Reputation: 13292


Posted 07 August 2014 - 04:36 AM

If the wireframe comes from the came vertex data as the model then all you need to do is set the depth mode to GL_EQUAL and draw the wireframe.
Or you can always modify gl_FragDepth, setting it to a value slightly smaller than gl_FragCoord.z, such as gl_FragCoord.z - (1.0f / 16000000.0) (this takes experimentation as well).

Otherwise you need to experiment with ::glPolygonOffset().

L. Spiro
It is amazing how often people try to be unique, and yet they are always trying to make others be like them. - L. Spiro 2011
I spent most of my life learning the courage it takes to go out and get what I want. Now that I have it, I am not sure exactly what it is that I want. - L. Spiro 2013
I went to my local Subway once to find some guy yelling at the staff. When someone finally came to take my order and asked, “May I help you?”, I replied, “Yeah, I’ll have one asshole to go.”
L. Spiro Engine: http://lspiroengine.com
L. Spiro Engine Forums: http://lspiroengine.com/forums