PDA

View Full Version : Point sprites not responsive to projection changes



Jengu
04-27-2006, 07:59 PM
In my app the user can adjust the size of the viewport by dragging a box smaller or larger. This in turn calls glOrtho2D with smaller or larger values. I recently decided to try rendering with point sprites, and found that the size of the point sprite didn't scale with the width/height I passed to glOrtho2D, unlike every other piece of geometry I've ever thrown at OpenGL.

I expected that if I set the glPointSize to be 100, then the point would behave just like a textured quad that's 100 wide, but that doesn't seem to be the case. Is there anyway I can make the points behave this way?

04-27-2006, 09:30 PM
Point sprite size is governed by a user configurable quadratic falloff equation but is hindered by a relatively small maximum size (glGet* with GL_POINT_SIZE_MAX), not to mention viewport edge clipping issues. In short, it's not likely to behave the way you apparently want it to.

Consider the use of billboards as an alternative?

Hth

Relic
04-28-2006, 03:30 AM
Originally posted by <quaice>:
but is hindered by a relatively small maximum size (glGet* with GL_POINT_SIZE_MAX), not to mention viewport edge clipping issues. In short, it's not likely to behave the way you apparently want it to.Not true!

The limits in GL_POINT_SIZE_RANGE or GL_SMOOTH_POINT_SIZE_RANGE for that matter are only used for the standard GL point rendering, not for point sprites.

glGet with GL_POINT_SIZE_MAX merely returns the state you set via glPointParameterf(). It might be that the initial state has been set to the fixed function maximum point range.

Just set the maximum you want via the function glPointParameterf(GL_POINT_SIZE_MAX, (float)yourSize) an try how big the point sprites (glEnable(GL_POINT_SPRITE)!) can be rendered on your implementation.
Different hardware might impose different limits though.

andras
04-28-2006, 11:22 AM
Well, in practice it seems to be the same though.At least on my GF6600, the max size is 64 pixels for point sprites, and I can't crank it up any higher, no matter what I set GL_POINT_SIZE_MAX to...

Relic
05-02-2006, 01:15 AM
Using the point parameter attenuation formula or glPointSize? glPointSize will not work for this.

05-02-2006, 01:32 AM
I think the point is that on some hardware (NVIDIA's, for example) the max size attainable for a point sprite is 64 or thereabouts, hence the points-sprite is not a generic drop-in replacement for billboards, which of course can be of arbitrary size on any hardware and don't suffer from the point clipping strategy.

I'm not even sure that's what the original poster had in mind. In fact, I'm not quite sure what the original poster is asking, to be perfectly honest ;)

Relic
05-02-2006, 08:55 AM
Originally posted by <slim>:
I think the point is that on some hardware (NVIDIA's, for example) the max size attainable for a point sprite is 64 or thereabouts,
And my point is to prove that this is not the case. ;)

Just add this code to an application which renders points and you'll see that point sprites go well beyond the standard point size range on NVIDIA hardware. Do not issue glPointSize() in that case.



I'm not even sure that's what the original poster had in mind. In fact, I'm not quite sure what the original poster is asking, to be perfectly honest ;) The original question is how to get the screen space point size to become viewport size dependent and the answer is to either use point sprites and set the GL_POINT_SIZE_MIN and _MAX values depending on your viewport size, or to overcome the ugly clipping behaviour with billboard quads.