开发者

Opengl ES - drawing a plane of multiple vertices

开发者 https://www.devze.com 2022-12-20 20:10 出处:网络
Using Opengl ES for Android we’re facing a problem when drawing a squ开发者_Go百科are with a texture. They look fine from a distance, but when getting close to the model the texture screws up. We bel

Using Opengl ES for Android we’re facing a problem when drawing a squ开发者_Go百科are with a texture. They look fine from a distance, but when getting close to the model the texture screws up. We believe this is caused by the fact that the model only consists of four vertices:

float[] coords = {

-1, 1, 0.0f,

1, 1, 0.0f,

-1, -1, 0.0f,

1, -1, 0.0f,

};

That is why we want to expand the model so it consists of 10x10 polygons, so the question is: In which order do we have to draw the vertices to create a plane similar to this:

http://cocktailgenerator.net/cis4/plan.png

Using GL_TRIANGLE_STRIP we are able to draw a rectangle of polygons like (1x10) and it works well, but how do we expand it to 10x10?


Here is how I solved it using OpenGL ES 1.0:

https://blog.jayway.com/2010/02/15/opengl-es-tutorial-for-android-part-v/


If you’re creating the rows from left to right you simply start a new row by adding an invisible degenerate strip: You add the last point of the row twice, inserting zero-area triangles. These triangles will be invisible when rendering faces. By using this technique you can create discontinuities in the strip and, for instance, start a new row in a big plane.

Regarding the original problem: Are you sure that you can get rid of you rendering problems by subdividing your mesh? It does not really sound like the right way to go.

0

精彩评论

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