0
votes

I have a OpenGL program which utilizes OpenGL 3.2 Core profile on Mac OS X and OpenGL ES 2.0 on iOS.

Part of my application renders point sprites by writing to gl_PointSizein the vertex shader. Unfortunately it appears that gl_PointSize renders at roughly 50x larger in OpenGL 3 than it does in OpenGL ES 2.0. The documentation for each API states that gl_PointSize defines the number of pixels, so I am unsure why this would be the case. Is there perhaps a default OpenGL parameter that modified the output of gl_PointSize? Is there anything else that may be causing the vast difference in size?

Each platform uses exactly the same shader (desktop has ARB_ES2 compatibility). I have also checked that all uniform inputs are identical and both render at the same resolution. Outside of the shader, the only point sprite related call I make is glEnable(GL_VERTEX_PROGRAM_POINT_SIZE);. On each platform independent of one another, I can adjust the point size just fine.

1
50% in each of X and Y?Nicol Bolas
@NicolBolas That is 50x which is a rough estimate to indicate the one is much larger than the other. Since it is a point sprite I would assume that it always renders equal x and y.Justin Meiners
What values are you actually using? One explanation is that you're using sizes that are above the supported limit on iOS.Reto Koradi
@RetoKoradi Outputs are around 10.0 to 30.0. However if I just tweak the values I am able to get the iOS sprites to render large as well. Do you know of where I could read information about the limitations?Justin Meiners
@JustinMeiners: "That is 50x which is a rough estimate to indicate the one is much larger than the other." OK, but knowing more precisely how much larger would be helpful. 50x is pretty much impossible, since that would mean either OpenGL is rendering a 10 px sprite at around 500px, or ES is rendering a 10px sprite at around 0.2px.Nicol Bolas

1 Answers

1
votes

The comments were correct about retina. A combination of scaling multiplies produced unintended results because of the 2x resolution retina screens. This caused the point sprites to be rendered 16x larger on OpenGL 3 than on OpenGL ES 2.0.

When raw values were written in the shader the Point Sprite was in fact 2x larger, which fills 4x the area.

To correct the scaling problems it was helpful to read this from the specification:

Point rasterization produces a fragment for each framebuffer pixel whose center lies inside a square centered at the point’s (xw; yw), with side length equal to the current point size.