Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Open Gl ES clipping and Back Face Culling

I need some performance in my project back, so I thought of implementing clipping and later on Backface culling.

So I am looking in my vertex shader if the Vertex is facing me, if it is true, I render it and if not, not. But how do I say no render in the vertex shader oO

Same with the clipping how do I say paint only this section in the vertex shader, or do I get something wrong here, I am quit new with Open Gl and my project is for IPhone, it is OpenGl ES 2.0.

like image 943
DomiDiDongo Avatar asked Nov 25 '25 17:11

DomiDiDongo


1 Answers

Vertices don't face front or backward. When 3 or more vertices meet, the plan (triangle) they make face front or back depending on the convention (clock/anticlock).

You have to just enable the culling and do nothing different in your shaders.

Some APIs of interest are: (Should be more or less same in iOS also which is not 100% compliant to OGLES)

glDisable / glEnable with argument GL_CULL_FACE
glCullFace  with argument GL_FRONT, GL_BACK or GL_FRONT_AND_BACK
glFrontFace with argument GL_CW or GL_CCW
like image 84
Mohit Jain Avatar answered Nov 28 '25 06:11

Mohit Jain