Android OpenGL ES point sprite texture image was up-down inverted

181 Views Asked by At

I draw texture images using glDrawArrays(GL_POINTS, 0, PARTICLE_NUMBER) in android, then rend it to screen.

In some phones the image was up-down inverted. Seems that there is no command GL_POINT_SPRITE_COORD_ORIGIN in OpenGL ES.

Is there any other way I can fix it?

2

There are 2 best solutions below

0
codetiger On

For OpenGL ES 2.0, you can use gl_PointCoord in the fragment shaders to get the texture coordinates.

https://www.khronos.org/opengles/sdk/docs/man31/html/gl_PointCoord.xhtml

0
solidpixel On

Is there any other way I can fix it?

Render it as triangles.