Double/single sided drawing

I was wondering how one would draw a sphere in OF with only the front faces.

E.g. I generate a sphere but than I flip the normals inward so only the inside of the sphere is viewable.

I was playing with Face Culling but I don’t seem to be able to make it respect the normal direction.

glEnable(GL_CULL_FACE); // Cull back facing polygons

Any thoughts?



1 Like

that should work but if you want to show only the back faces, the inside, then you need to use glCullFace(GL_FRONT) so t only renders the back faces

there’s some issues with winding order of polygons in some primitives but i think the sphere should behave correclty

Thnx, I got something working but still it puzzles me why it doesn’t respect the normal direction.

    glEnable(GL_CULL_FACE);     // Cull back facing polygons
	glCullFace(GL_ BACK);


Has the normal nothing to do with determining what’s front faced and what not?

Hmmm, trying this same code inside an ofCamera.begin()/end() doesn’t work. I guess that’s not supposed to?

To answer myself; setting VFlip to true resolves this. Apparently coordinates are flipped otherwise since if VFlip is false and I swap GL_FRONT and GL_BACK it works as well.