Sign in to follow this  
MartinB

How do I use glFramebufferTexture2DEXT() ?

Recommended Posts

MartinB    123
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:

[code][ 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[/code]

My function that calls this function simply looks like this:

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

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
the_visualist    188
I got the function from glew.h (google it), there its defined in like that:
[code]#define glFramebufferTexture2DEXT GLEW_GET_FUN(__glewFramebufferTexture2DEXT)[/code]
Don't forget to call glewInit() once.

Share this post


Link to post
Share on other sites
MartinB    123
Thanks. Turns out I had to change [i]every[/i] <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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this