Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I am creating a game using Box2D and OpenGL ES 1.1.

I am taking the b2PolygonShape vertices and converting them into an OpenGL ES 1.1 GL_LINE_LOOP. The debugging view looks great, but now I want to apply textures to the inside of the line loop.

Is this possible? I used line loop instead of triangles because I am not sure how to handle complex polygons using triangles.

share|improve this question
add comment

1 Answer 1

up vote 5 down vote accepted

No.

Only rendered primitives get rasterized and shaded, and when you render using GL_LINE_LOOP your primitives are just the lines themselves, not the area enclosed by the lines.

If you want to rasterize and shade the area within the line, you have to render using a solid primitive like GL_TRIANGLES. If you have complex polygons you will first need to break them down into triangles using some kind of triangulation technique (you can also search this site for other questions about polygon triangulation if you get stuck).

share|improve this answer
1  
shouldn't (a convex) line loop be trivially convertible to triangle fan? –  Jimmy Jul 11 '13 at 19:05
1  
If its convex, yes. –  Josh Petrie Jul 11 '13 at 19:22
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.