Jump to content
  • Advertisement
Sign in to follow this  
MartinB

How do I use glFramebufferTexture2DEXT() ?

This topic is 2446 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

Hello,

I want to do some render-to-texture functionality in my game. When I try to call glFramebufferTexture2DEXT(), I get the following error when I try to compile it:

[ 83%] Building CXX object Plugins/TextureSet/C64SpindizzyTextureSet/CMakeFiles/TextureSet_C64SpindizzyTextureSet.dir/C64SpindizzyTexture.cpp.o
/home/martin/spindizzyremake/Plugins/TextureSet/C64SpindizzyTextureSet/C64SpindizzyTexture.cpp: In member function 'void C64SpindizzyTexture::setRenderTarget()':
/home/martin/spindizzyremake/Plugins/TextureSet/C64SpindizzyTextureSet/C64SpindizzyTexture.cpp:25: error: 'glFramebufferTexture2DEXT' was not declared in this scope
make[2]: *** [Plugins/TextureSet/C64SpindizzyTextureSet/CMakeFiles/TextureSet_C64SpindizzyTextureSet.dir/C64SpindizzyTexture.cpp.o] Error 1
make[1]: *** [Plugins/TextureSet/C64SpindizzyTextureSet/CMakeFiles/TextureSet_C64SpindizzyTextureSet.dir/all] Error 2
make: *** [all] Error 2


My function that calls this function simply looks like this:

void C64SpindizzyTexture::setRenderTarget() {
glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, cTextureID, 0);
}


I've trying include both <GL/gl.h> and <GL/glext.h>, but still get the same error.

Surprisingly, I could not find any formal documentation on the use of this function on Google. Does anyone know how I can proceed to use this function so that I can perform render-to-texture in my game?

With Kind Regards,
MartinB

Share this post


Link to post
Share on other sites
Advertisement
I got the function from glew.h (google it), there its defined in like that:
#define glFramebufferTexture2DEXT GLEW_GET_FUN(__glewFramebufferTexture2DEXT)
Don't forget to call glewInit() once.

Share this post


Link to post
Share on other sites
Thanks. Turns out I had to change every <GL/gl.h> in my project to <GL/glew.h> too, otherwise it was failing for including <GL/gl.h> before <GL/glew.h>. Once I'd done that, it worked after calling glewInit(). :)

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!