dabeav

02-18-2011, 12:53 PM

I am attempting to create a outlining (cartoonish) effect around my meshes in OpenGL ES 1.1. Normally in OpenGL I would just render in wireframe mode with a line width of 3 or 5 in front face culling mode. Then I would render the polgons with back face culling and tadda, the depth buffer magic gives me the outline effect I want.

However OpenGL es doesnt support wireframe modes, and rendering with GL_LINES will not allow the black magic of cull face / depth buffer to work.

What I am doing now should work for what I want, but I am missing something, and cant figure out what... I have a series of triangles, each with a face normal. I simply rotate the normal by glGetFloatv(GL_MODELVIEW_MATRIX, modelView), and take the angle between the rotated vector and the origin view vector (0,0,-1). If the angle is 90 or greater than the triangle should be facing away from the camera. I then render that poly in line mode with a line width value of 3 or 5. For the most part it is working, except I am seeing the wrong line polys at certain angles.

Basically my question is, should the above method work correctly in order to transform a normal into eye space, and then check the angle between that normal and the view vector. Or, do I need to do some sort of transformation with the projection matrix as well?

Thanks in advance!

However OpenGL es doesnt support wireframe modes, and rendering with GL_LINES will not allow the black magic of cull face / depth buffer to work.

What I am doing now should work for what I want, but I am missing something, and cant figure out what... I have a series of triangles, each with a face normal. I simply rotate the normal by glGetFloatv(GL_MODELVIEW_MATRIX, modelView), and take the angle between the rotated vector and the origin view vector (0,0,-1). If the angle is 90 or greater than the triangle should be facing away from the camera. I then render that poly in line mode with a line width value of 3 or 5. For the most part it is working, except I am seeing the wrong line polys at certain angles.

Basically my question is, should the above method work correctly in order to transform a normal into eye space, and then check the angle between that normal and the view vector. Or, do I need to do some sort of transformation with the projection matrix as well?

Thanks in advance!