View Full Version : Binding texture to one vertex
04-06-2009, 09:41 AM
As in topic - is there any possibility to do that? Maybe use GL_TEXTURE_1D ??
And how to make texture to be seen front always (when we move).
You need to explain in more detail what you want to achieve. The question is very confusing.
04-06-2009, 09:53 AM
I want to display texture, and stick it to only one vertex.
e.g. i have texture of cloude, and i want to bind it to vertex (2.0f, 10.0f, 0.0f).
04-06-2009, 04:50 PM
I want to display texture, and stick it to only one vertex. ... e.g. i have texture of cloude, and i want to bind it to vertex (2.0f, 10.0f, 0.0f).
Hmm. I think you might have a misconception of how you render a texture on the screen.
I think you're envisioning taking a picture (a texture) with a predefined size and poking it onto a bulletin board (the screen) with a single point, whereas the normal GPU model is you send outline of the picture (a quad) to the bulletin board and tell the bulletin board to fill it with the picture. The nice thing about that is you can not only reposition the picture, but resize it as well when you render it.
So for your cloud, let's say you wanted it 2 units X 2 units centered on (2.0f, 10.0f, 0.0f), you'd send down quad vertex positions of: (1,9),(1,11),(3,11),(3,9), texture coordinates (0,0),(1,0),(1,1),(1,0), and slap your cloud texture on it.
This is the normal GL_QUADS route to rendering.
Note that there are other ways to do this (point sprites, drawpixels, etc.) -- I'm just describing the most common way. This is the kind of thing discussed well in the OpenGL Red Book (http://www.opengl.org/documentation/red_book/).
04-07-2009, 11:12 AM
Thanks for your help :) I know opengl for sometime and I know how to texture - but I've heard that you can stick your texture to one vertex. Is it possible ?
04-08-2009, 03:40 PM
I know how to texture - but I've heard that you can stick your texture to one vertex. Is it possible ?
Well, I'm not sure I understand you, but if you mean render a quad texture by sending only a single position down the pipe, check out ARB_point_sprite (http://www.opengl.org/registry/specs/ARB/point_sprite.txt). Don't be surprised when your texture pops off when you move it half-way off screen though. It's a point.
Another approach is glDrawPixels. Call glRasterPos to set the draw position.
04-12-2009, 05:32 AM
You're my man :D I've used sprites and they are working just the way i wanted :)
Topic is ready to be closed.
Powered by vBulletin® Version 4.2.2 Copyright © 2014 vBulletin Solutions, Inc. All rights reserved.