Geometry outlines


#1

Okay, so i have half of the sphere. How can i draw only edges? like this one https://s-media-cache-ak0.pinimg.com/originals/34/60/46/346046df7b06ffd69d3c2f5217c0d5c7.gif


#2

Maybe a cartoon shader will work.


#3

You can use an edge shader: https://www.shadertoy.com/view/4s2XRd


#4

What i ended up using is some opengl settings to make outlines. This is not perfect solution by any means (not perfect line). and yeah, glsl shader would be better solution.

glPushAttrib(GL_ALL_ATTRIB_BITS);

glDisable(GL_LIGHTING);
glClearStencil(0);
glClear(GL_STENCIL_BUFFER_BIT);
glEnable(GL_STENCIL_TEST);

glStencilFunc(GL_ALWAYS, 1, 0xFFFF);
glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
glColor3f(fillColorGL.r, fillColorGL.b, fillColorGL.g);
drawModel(sphereMesh);//fill
	
glStencilFunc(GL_NOTEQUAL, 1, 0xFFFF);
glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);
glLineWidth(lineWidth);
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
glColor3f(mainColorGL.r, mainColorGL.g, mainColorGL.b);
drawModel(sphereMesh);//outline

glEnable(GL_LIGHTING);
glDisable(GL_STENCIL_TEST);

glPopAttrib();