OpenGL Point Sprites – 2 things to know…

by

Been playing around with OpenGL ES and most recently with Point Sprites (e.g., glDrawArrays( GL_POINTS, …) ). Today I got textures rendering onto the points (whose size > 1.0, obviously) but ran into two show-stoppers:

First, I do not see that it is possible to use a Texture Atlas with portions of a texture mapped onto Point Sprites in OpenGL ES 1.1.  You can only map the entire Texture onto the point.  Based on my reading, I can see that with a custom shader you should be able to do this in OpenGL ES 2.0, but haven’t tried that yet.

Looking around to see if I was doing something wrong I came across this from the spec and I think that’s what this is saying:

When point sprite is enabled and the GL_COORD_REPLACE_ARB state for a given texture unit is GL_TRUE, the texture coordinate set for that texture unit is (s,t,0,1) where the point sprite-overridden s and t are described in the amended Section 3.3 below. The important point is that r and q are forced to 0 and 1, respectively.

(emphasis mine).

This from:  http://www.opengl.org/registry/specs/ARB/point_sprite.txt

Certainly if someone knows how to map a portion of a Texture onto a Point in openGL ES 1.1, I’d like to hear about it.

Otherwise, hopefully this’ll save someone some time.

Second, note that if you are using them for a game and you want the object they represent to be partially off-screen, you are in trouble;  Point Sprites are clipped when the point is offscreen, and the point is in the center of the point sprite.  Thus, when your object gets just slightly over half off the screen, “POOF!”, it’s completely gone.

About these ads

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


Follow

Get every new post delivered to your Inbox.

Join 1,231 other followers

%d bloggers like this: