# Storing non 0.0-1.0 values in a texture.

This topic is 3023 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hey Ive spent a few hours looking and cant find any information on this, probably because it cant be done and Im foolish for thinking that it may be possible, however before giving up I thought it good to ask here so that a) I may find an answer and b) if someone else looks in the future they too can find the answer here. I have a shader in GLSL. If creates some noise using BFM. Originally I tried to split this noise (which represents a height) into 3 or 4 floats in the range 0.0 to 1.0, and store them in the RGBA of the texture, however I would like to know if its possible to setup a texture in some way so that it allows full floats to be stored in each of its RGBA values i.e. in the RGB of a texture I can store a complete vertex position. (1234.56, 78.90123, 45.67866) The best direction I could find in some google research was to use GL_RGBA_FLOAT32_ATI as below, however this does not seem to work for me. I will keep trying and post back here if I find a solution, however any tips, advice (on if possible or not) would be greatly appreciated.
glGenTextures(1, &m_uiTexture);
glBindTexture(GL_TEXTURE_2D, m_uiTexture);
/*glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, GL_TRUE);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, m_uiWidth, m_uiHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);*/

glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA_FLOAT32_ATI, m_uiWidth, m_uiHeight, 0, GL_RGBA, GL_FLOAT, 0);

glBindTexture(GL_TEXTURE_2D, 0);


Thanks alot. Ciaran

##### Share on other sites
I made GL_RGBA32F_ARB work, but that was with a GL_TEXTURE_RECTANGLE_NV target on a NVidia 280 card....

##### Share on other sites
You can apply a transform instead, and just use standard textures (e.g., [-100.0,100.0] -> [0.0,1.0] in the texture and back again). I've used this technique to store cloth and particle vertices in standard textures. Of course, you may need more precision for your coordinates (I did), and you'll need higher bit depth textures anyway.

1. 1
2. 2
frob
15
3. 3
4. 4
Rutin
12
5. 5

• 12
• 12
• 58
• 14
• 15
• ### Forum Statistics

• Total Topics
632115
• Total Posts
3004194

×