Sign in to follow this  
weasoung

Creating floating point textures Problem ...

Recommended Posts

weasoung    122
Hi! everybody.. I want to create a floating point texture, I find some example is all use "GL_TEXTURE_RECTANGLE_NV", but my video card is ATI Mobility X1400, so I use "GL_TEXTURE_RECTANGLE_EXT", and I got trouble! --------Original Code-------------------------------- glBindTexture(GL_TEXTURE_2D, TextureObj[0]); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexImage2D(GL_TEXTURE_2D, 0, 4, 512, 512, 0, GL_RGBA, GL_FLOAT, NULL); glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, TextureObj[0], 0); ------------------------------ is working, draw rotation Teapot in Textue. --------Want 32-bit float-point Texture Code--------- glBindTexture(GL_TEXTURE_RECTANGLE_EXT, TextureObj[0]); glTexParameteri(GL_TEXTURE_RECTANGLE_EXT, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_RECTANGLE_EXT, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexImage2D(GL_TEXTURE_RECTANGLE_EXT, 0, GL_RGBA_FLOAT32_ATI, 512, 512, 0, GL_RGBA, GL_FLOAT, NULL); glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_RECTANGLE_EXT, TextureObj[0], 0); ------------------------------not working, no see rotation Teapot in Textue. and I don't know some wrong with me...anyone can Help me, please..

Share this post


Link to post
Share on other sites
Arex    204
Try changing your framebuffer glTexImage states. I'v came a cross with similar problem few times and only thing that helped was to find the right kind of states. If that doesn't help then check what your GPU supports and driver version.

Share this post


Link to post
Share on other sites
weasoung    122
Quote:
Original post by Arex
Try changing your framebuffer glTexImage states. I'v came a cross with similar problem few times and only thing that helped was to find the right kind of states. If that doesn't help then check what your GPU supports and driver version.


OK! thank Arex Help me~^^.
I'm find the problem.
the "GL_TEXTURE_RECTANGLE_EXT" set glTexCoord range is [0...width\height].
width = Texture width / height = Texture height.

and Now, My new question is How To Sure the Texture's RGB is Float-point Value??

Share this post


Link to post
Share on other sites
bzroom    647
I havn't tried floating point textures yet but it looks like the only parameter you need to create it was the GL_RGBA_FLOAT32_ATI. The other parameter GL_TEXTURE_RECTANGLE_NV probably refers to the texture type and that will affect how the coordinates are interpreted. I dont know what your trying to do or how you want the coordinates, but everything I've ever done the coordinates were between 0 and 1.

Hope that helped.

Share this post


Link to post
Share on other sites
WilyCoder    100
This is what I use on my Nvidia card to create a floating point texture:

glTexImage2D(GL_TEXTURE_2D,
0,
GL_RGBA32F_ARB,
Width,
Height,
0,
GL_RGBA,
GL_FLOAT,
Data);

Please note that this is not vendor specific, due to the use of GL_RGBA32F_ARB. It should work if your card supports GL_ARB_texture_float.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this