PDA

View Full Version : GL_POINT_SPRITE + texture atlas



rexguo
01-12-2008, 02:53 AM
Hi!

Is it possible to combine the use of point sprites
with the texture atlas technique? Basically, I need
to be able to specify the UV coords for each sprite
(each call to glVertex()) rendered. It looks impossible
from the specs at:
http://oss.sgi.com/projects/ogl-sample/registry/ARB/point_sprite.txt
but I was hoping someone might know a trick or two.
Thanks!

.rex

oc2k1
01-12-2008, 07:06 AM
It is possible with a fragment shader.

A GLSL example:


uniform sampler2D Colormap;
uniform vec2 scale;
uniform vec2 offset;

void main(void){
vec2 coords = gl_PointCoord * scale + offset;
gl_FragColor = texture2D(Colormap,cords);
}

rexguo
01-16-2008, 01:53 AM
Thanks oc2k1!

I was hoping to be able to do it without
using shaders, but a partial solution is
better than no solution. Thanks again! :-)

.rex