Jump to content
  • Advertisement
Sign in to follow this  
Dragon_Strike

float textures and FBOs

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

im workin with geoclipmaps and i need to render a float texture, modify it with a shader and than render it back to a texture ive implemented FBOs and it work fine with regular tetxures (RGBA8)... the GL_RGB_FLOAT32_ATI format doesnt seem to work with renderbuffers... how do i do this?

Share this post


Link to post
Share on other sites
Advertisement
i only need one color channel....

EDIT:: im using a geforce 7800

i need a fromat that is one channel and works with both FBOs and VTFs

this is what ive got

FBO

void CMESH::InitFBO()
{


glActiveTexture(GL_TEXTURE5);

// Setup our FBO
glGenFramebuffersEXT(1, &fbo);
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fbo);

// Create the render buffer for depth
glGenRenderbuffersEXT(1, &depthBuffer);
glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, depthBuffer);
glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT, m_iSize+1, m_iSize+1);

// Now setup a texture to render to
glGenTextures(1, &img);
glBindTexture(GL_TEXTURE_2D, img);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB16F_ARB, m_iSize+1, m_iSize+1, 0, GL_RGB, GL_FLOAT, NULL);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);


// And attach it to the FBO so we can render to it
glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, img, 0);

// Attach the depth render buffer to the FBO as it's depth attachment
glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, depthBuffer);

glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); // Unbind the FBO for now

GLenum status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT);
}




VTF texture

void CMESH::ALPHA_BindFPTexture(float* Data, int size)
{
unsigned int iTempID;
glGenTextures(1, &iTempID);
glBindTexture(GL_TEXTURE_2D, iTempID);
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_LUMINANCE_FLOAT32_ATI, size, size, 0, GL_LUMINANCE, GL_FLOAT, Data );
}




[Edited by - Dragon_Strike on January 29, 2007 4:09:37 AM]

Share this post


Link to post
Share on other sites
well after second thought i think a 4 channel format would do also.. as long as it works for both FBO and VTF

EDIT::

GL_RGBA32F works for VTF but not FBO
GL_RGBA16F works for FBO but not VTF

[Edited by - Dragon_Strike on January 29, 2007 12:48:16 PM]

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!