Hi Gerrit,
yes, indeed, this is what I need.
Oliver
Gerrit Voss schrieb:
Hi,
On Tue, 2005-10-11 at 13:45 +0200, Oliver Kutter wrote:
Hi Gerrit,
that would have been to beautifully, if that would had worked completely
at once.
Yes, it works, but not really. At the beginning, I put my particle
positions (as float texture) initially to the shader and want to compute
their new positions. For this texture I have the following properties.
Target: GL_TEXTURE_2D, InternalFormat: GL_RGBA32F_ARB. In the shader, I
access the sampler2D texture by the texture2D command.
I use your glReadBuffer to get some kind of output for the current
positions stored in that texture, initially they are like this:
45.078125 3.000000 50.000000 0.000000
45.234375 3.000000 50.000000 0.000000
45.390625 3.000000 50.000000 0.000000
45.546875 3.000000 50.000000 0.000000
45.703125 3.000000 50.000000 0.000000
45.859375 3.000000 50.000000 0.000000
46.015625 3.000000 50.000000 0.000000
46.171875 3.000000 50.000000 0.000000
46.328125 3.000000 50.000000 0.000000
46.484375 3.000000 50.000000 0.000000
This output is correct!
Then I write the positions back to the texture. In the next Rendering
pass, I want to load the output texture (GL_TEXTURE_RECTANGLE_NV,
GL_FLOAT_RGBA32_NV) as input texture and that does not work, because the
properties are not correct.
Thus, I changed the properties of my first input texture to the
properties of the output texture. In the shader, I changed sampler2D to
sampler2DRect and the texture2D command to texture2DRect.
But now my particle positions are initially all the same (all like the
first position of the correct output above), like this:
45.078125 3.000000 50.000000 0.000000
45.078125 3.000000 50.000000 0.000000
45.078125 3.000000 50.000000 0.000000
45.078125 3.000000 50.000000 0.000000
45.078125 3.000000 50.000000 0.000000
45.078125 3.000000 50.000000 0.000000
45.078125 3.000000 50.000000 0.000000
45.078125 3.000000 50.000000 0.000000
45.078125 3.000000 50.000000 0.000000
45.078125 3.000000 50.000000 0.000000
Do you have an idea, why? Do I have to do something with the texture
coordinates?
most likely, normal texture coordinates (minus wrapping) are between 0
and 1, for GL_TEXTURE_RECTANGLE_NV this changes to 0 - texture width and
0 - texture height. So if you switched to texture2DRect and were still
using old 0 - 1 texture coordinates you should get the result you see.
The easiest test would be to modify the fragment program from
texture2DRect(sampler, vec2(x, y)); // x,y {0 - 1}
to
texture2DRect(sampler, vec2(x * textureWidth, y * textureHeight));
if this gives you the expected results the problems are indeed the
different texture coordinates.
regards,
gerrit
-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Opensg-users mailing list
Opensg-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensg-users
-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Opensg-users mailing list
Opensg-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensg-users