PDA

View Full Version : can a texture map be applied to one vertex



TJ22
01-19-2005, 06:38 AM
I am trying to find out if I can apply a texture map to one single vertex. ie instead of a white dot while using gl_points, I would have a small image. Thanks in advance.

Aeluned
01-19-2005, 08:31 AM
You can enable texturing and draw a point if you want to.
you won't get a small image however - all you'll get is the texture sample at that point, which will be a single color.

map the texture to a quad and scale the quad down to control the size of the displayed image.

TJ22
01-19-2005, 09:10 AM
The reason I thought mapping a single vertex would work well for me is because the gl_point is a pixel count in size so as I zoom into the location the image remains the same size with respect to the screen not the world and that is the functionality I am looking for, so when you are zoomed far out you can still locate the position.

Aeluned
01-19-2005, 09:51 AM
I see...

Well, a texture is applied to a surface via interpolation between texture coordinates at vertices. Given 1 vertex (i.e. a point) OpenGL has nothing to interpolate between and you end up with only that sample.

You can either draw the quad the desired size and not apply the zoom transformations to it (this may lead to undesireable coverage due to depth tests).

the 'Point Sprite' extension may be able to help you out, but I'm not sure...you can read up on those.

TJ22
01-19-2005, 10:41 AM
WOW. Thanks. Point Sprites are quite useful, served my purpose to a T. Thanks again.