I want to draw a rectangle using OPENGL in Android… Just a simple rectangle you know, with coordinates like : X, Y, Width, Height…
So I thought there was something like gl.glDrawRect… But nothing…
Then I thought about gl.glDrawElement(GL10.DRAW_RECT,...) but nothing here too…
Seems like, if I want to draw a rectangle using opengles/opengl
I have to make 2 triangles oposite
…
Is that so, or does anyone have some tips for me ?
Yep, no native quads in ES.
You have to use two triangles separately (
GL_TRIANGLES), in a strip (GL_TRIANGLE_STRIP), or in a fan (GL_TRIANGLE_FAN).OES_draw_texturemay be useful if your implementation supports it and you’re willing to put up with screen-aligned rectangles.