OpenGL rendering of GL_POINTS on iPhone / iPad devices looks terrible (but in simulator it looks completely normal)

I have created an OpenGL ES game that is displayed with GLKView on iOS. I also added some custom UIButtons that sit on top of the GLKView. In rendering, I draw some stars using render mode GL_POINTS

. It does everything perfectly in the simulator, but it looks terrible on the device.

I was wondering if anyone has any advice as to what I should tweak / look for on a device that might need to be tweaked to get the correct image.

Here are some images of the results:

Simulator

Screenshot of game running on iPhone simulator.

Device

enter image description here

(Please ignore the difference in scaling of custom buttons - the screenshot of the device was taken on an iPad).

+3


source to share


1 answer


It turns out that the problem was not installing gl_PointSize

in the shader for OpenGL ES. The screenshots actually led me to this solution, because the stars (drawn using render mode GL_POINTS

) are so radically flawed on the device as on the simulator.



Presumably for the desktop version of OpenGL, point size is set using the glPointSize

default function (unless GL_VERTEX_PROGRAM_POINT_SIZE

enabled). There is no function in OpenGL ES glPointSize

, so a point size value must always be specified using a built-in variable gl_PointSize

in the vertex shader.

+3


source







All Articles