开发者

Any glPolygonMode alternative on iPhone (OpenGL ES)?

I'm new to OpenGL, and I found out that OpenGL ES doesn't support APIs such as glPolygonMode( GL_BACK, GL_FILL);

Any ideas how to imple开发者_如何学JAVAment it?


In OpenGL ES, GL_FILL is the only available polygon mode. If you want to draw points or lines on edges then you need to upload your geometry directly for GL_POINTS, GL_LINES, GL_LINE_LOOP or whatever else is convenient. Of course, that means unpacking the more implicit triangle description modes, line strips and fans, in software for yourself, but the relevant code flows directly from the man pages.

There's no direct way to dictate whether line or point drawing will occur based on a triangle front/back facing test elsewhere. If you're in ES 2.x then you can get close to simulating the same thing by doing the triangle test you want in your geometry shader and setting a suitable flag for your fragment shader, but you'll end up duplicating the hardware test.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜