Texture UV to Screen

hi

my project is growing and growing and nowi work on alternativ waterreflections.

at moment my idea is that:

-> first render into FBO texture (that work perfect:)
->add a quad poly for the water (thats ok)

and now the special part.

is it possible to put a texture to a 3d polygon(triangle/quad…whatever) but
the texture without 3d effect?

example…
a triangle with coordinates and [uv] 0,0,1000 [0,0] / 0,0,0 [0,1] / 1000,0,1000 [1,0]
a normal triangle thing… the texture pixel are getting smaller when far away

my plan…the same polygon…but the pixels of texture are not 3dimensionated ^^, they should look
like a 2d thing on the 3d object

is it possible?

So the way I understand what you’re trying to do, in real world terms would be if you have a window+wall to the outside and you moved it around, what you can see through the window changes based on it’s position and angle but the outside itself is stationary. Right?

If you are limited to the fixed function pipeline you might want to look at setting the texture matrix to be the same as your modelviewprojection matrix, or something like that, I haven’t thought the details all the way through.

Even better is if you can use shaders I believe you can just use the varying vertex position in the fragment shader as it is provided, because if I recall correctly it’s normalized from -1 to 1 for the width and height of the drawable (also known as normalized device coordinates). That way you won’t have to spend the cycles performing the transformations for the texture coordinates.

Though like I said I haven’t thought these all the way through so just take these as suggestions/hints on maybe where to get started, because you’re on your own at this point :).

Regular projective texturing should do the trick. IIRC glTexGen with GL_EYE_LINEAR should do what you want.

thr water is a hard key point.

ok, i dont want it like in gta4 ^^

my idea was a sample i found in using flash 8 with filters

the displacment mapping… very simple use to build great water
(2d bitmap that simulate 3d effect, that could work grat in opengl 3d too…)

in flash in need to include the filter extension…thats all

in opengl i need the shader… but i dont know what i need for that…
pixel or vertex shader…and i am far away of understandig that
and more in converting the flash thing to opengl

i need to find a way to disturb the pixels in the mirror fbo texture
to simulate water waves

and this “disturbed” texture i render on a water plane
(with the manipulated uv thing)

sounds complicated