Question

I have an .OBJ loader that load an object and renders it. I can render it as wireframe or solid, like this:

Solid

enter image description here

Wireframe

enter image description here

So now i would like to render both modes at the same time like - Wireframe render over the Solid render (both with different colors). Is that possible?

Can anyone help please? Thank you.

Was it helpful?

Solution

I figured it out! Here's the code if anyone has the same doubt i had :-)

// draw the filled polygons
   glPolygonMode( GL.GL_FRONT_AND_BACK, GL.GL_FILL );
   glEnable( GL.GL_POLYGON_OFFSET_FILL );
   glPolygonOffset( 1, 1 );
   glColor3f( 0.0f, 0.0f, 0.0f );
   renderData();
   gl.glDisable( GL.GL_POLYGON_OFFSET_FILL );

   // draw the wireframe
   glPolygonMode( GL.GL_FRONT_AND_BACK, GL.GL_LINE );
   glColor4fv( colour );
   renderData();
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top