Creating floating point textures Problem ...

Started by
3 comments, last by WilyCoder 17 years, 4 months ago
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..
Advertisement
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.
Sincerely,Arto RuotsalainenDawn Bringer 3D - Tips & Tricks
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??
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.
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.

This topic is closed to new replies.

Advertisement