Skip to main content
gamedev.net
🔒 Locked

texture coordinates question

Started by DerTherion 2 replies 750+ views
Original Post
DerTherion
DerTherion
hello i am looking for something special with texture coordinates in opengl i look for an function/way to apply instead of an static/variable uv texture coordinate that my object get the uv coordinate of the screen position ok,it sounds strange... example: if the vertex is in the middle of the screen it should get gl.glTexCoord2d(0.0f,0.0f); and topleft for example gl.glTexCoord2d(-1.0f,-1.0f); i want an 3d object with 2d screen texture coordinates. is there any chance?
haegarr
haegarr
There are several ways:

(1) You can define an object in view space instead of in world space. This way is good if the object should follow the camera, e.g. a background or GUI elements.

(2) You can go with the immediate mode, compute the vertex position on the CPU and adapt the texture co-ordinate on the fly. Hence the object can be moved in the world (and hence over the screen) and it looks like the object is moving under the texture.

(3) You can use a vertex shader. It works similar to (2) but much more efficient.

(4) ...

So it would be better if you can explain in more detail what goal you want to reach.


BTW: Notice please that the full range of (u,v) is [0,1]x[0,1], so that your example with (-1,-1) will perform wrapping or clamping. Not sure whether that is what you actually want.
DerTherion
DerTherion
hello haegarr

thanks for your answer

the project i am working on is avoiding shaders at
all price.


the object that will get this special uv
is moving inside a normal landscape...
the camera , depth check and all is the same.

only this object will get this 'other' uv coordinates

let me explain in other way

you have a fullscreen picture as background image (texture)
but this static backgroundpicture is only
show where this special object is
(the rest of the landscape is normal without this effect)



Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.