# How do I use glFramebufferTexture2DEXT() ?

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

## 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 on other sites
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 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().

• 17
• 11
• 11
• 9
• 49
• ### Forum Statistics

• Total Topics
631394
• Total Posts
2999753
×