PDA

View Full Version : Point Sprite TexCoords



halo
11-14-2004, 08:32 AM
Point sprites are good because you don't have to calculate the vertex coords relative to the camera angle. Now only do you save time by not calculating the vertex coords, but you can make copies of the same emitter, and place them in different spots.

How do I specify texture coords for point sprites? I want to have the texture spread across the sprite, like...well, you know, like a normal particle.

I know I can use quads or whatever, but that means updating the entire buffer to face the camera every frame, and you can't render extra copies of the emitter without updating it.

It would be nice if I could rotate the texture per sprite, but if that is impossible, I can live with just having fast particles.

Because it is a point, it can't have anything but a solid color.

Is there any way to make quads automatically face the camera, but still stay in their same world position? The really slow part is updating the coordinates of the quads.

halo
11-14-2004, 09:39 AM
Here is the best explantion I have found:
http://www.opengl.org/discussion_boards/cgi_directory/ultimatebb.cgi?ubb=get_topic;f=3;t=005724

But is this going to break on all non-NVidia cards?

halo
11-14-2004, 11:22 AM
Dang, my GEForce 4 will only render a point sprite that is 64x64.

It seems kind of weird that we have to manually set the vertex coordinates of a quad to do particles? Isn't that kind of innefficient?

Chuck0
11-15-2004, 12:10 AM
if you need bigger sprites you can use quads without updating them when the camera moves by using a vertex program and some additional vertex data... for example you can pass the same vertex position to all four points of the quads and then something like (-1,-1) (1,-1) (1,1) (-1,1) as another vertex attribute. then simply add this attribute to the eye space vertex position in the vertex program. then do the final perspective transformation.

zeckensack
11-15-2004, 05:41 AM
Originally posted by halo:
Here is the best explantion I have found:
http://www.opengl.org/discussion_boards/cgi_directory/ultimatebb.cgi?ubb=get_topic;f=3;t=005724

But is this going to break on all non-NVidia cards?No. That thread is fairly old. In the meantime, a cross vendor point sprite extension (http://oss.sgi.com/projects/ogl-sample/registry/ARB/point_sprite.txt) has been created, and it's supported on ATI cards, too (http://www.delphi3d.net/hardware/extsupport.php?extension=GL_ARB_point_sprite) .
Note that Intel, Matrox and XGI are missing from the list. S3 is in though.

Sunray
11-15-2004, 08:49 AM
It seems that ATI have fixed all their problems with Point Sprites in Catalyst 4.11. :)

idr
11-15-2004, 08:22 PM
Since ARB_point_sprite is part of 2.0, everybody is going to get on board with it pretty quick. :)

halo
11-16-2004, 11:24 AM
But my GEForce 4 MX won't draw sprites bigger than 64x64. And if I remember right, it is the most common card in some survey I saw somewhere.

idr
11-16-2004, 11:40 AM
So does ARB_POINT_SPRITE actually draw sprites bigger than 64x64? This is probably what I was reading about on the front page of this site.I believe the maximum size is a querable parameter. The issues section (which is often a great resource) for ARB_point_sprite (http://oss.sgi.com/projects/ogl-sample/registry/ARB/point_sprite.txt) says:


How do point sizes for point sprites work?

RESOLVED: This specification treats point sprite sizes like antialiased point sizes, but with more leniency. Implementations may choose to not clamp the point size to the antialiased point size range. The set of point sprite sizes available must be a superset of the antialiased point sizes. However, whereas antialiased point sizes are all evenly spaced by the point size granularity, point sprites can have an arbitrary set of sizes. This lets implementations use, e.g., floating-point sizes.Based on that, I would say that you need to query GL_SMOOTH_POINT_SIZE_RANGE to know what the valid size range is.

halo
11-16-2004, 12:02 PM
Yeah, it's glGetIntegerv(GL_POINT_SIZE_RANGE,params*)

Mine is 63. So I guess have one sprite system for quads, and another for good gfx cards.