PDA

View Full Version : glFramebufferTexture2D in early version of opengl(vertex)



mbikos
05-21-2015, 11:10 AM
Hi guys!
I want to be able to use glFramebufferTexture2D in order to create a FrameBuffer Object(FBO) and render my entire current opengl scene to a texture of an FBO.(just like in this tutorial (http://www.lighthouse3d.com/tutorials/opengl_framebuffer_objects/)

However I am using an earlier version of openGL(no shaders at all-only vertices etc) and glut and gl.h can't find the command glFramebufferTexture2D at all.What can I do to achieve this in OpenGL early versions(no shaders)? Should I include glew.h too? And If I do can I continue writing my program or do I have to create shaders etc?

Alfonse Reinheart
05-21-2015, 11:56 AM
What can I do to achieve this in OpenGL early versions(no shaders)?

Nothing. If your version of OpenGL is so outdated that it's not even 2.0, odds are good that it doesn't support EXT_framebuffer_object or the ARB version. It's not so much that you need shaders, but that anything that doesn't offer them also won't offer FBO support.

So you'll have to copy the framebuffer pixels to a texture with glCopyTexSubImage.

mbikos
05-22-2015, 03:17 AM
Ok but what if my openGL version supports newer opengl?Then, can I just include glew.h and get what I want? Or do I have to do shader programming?

GClements
05-22-2015, 05:00 AM
Ok but what if my openGL version supports newer opengl?Then, can I just include glew.h and get what I want? Or do I have to do shader programming?

You don't need to use shaders to use FBOs.

If you're on Windows, opengl32.dll only exports the symbols for the OpenGL 1.1 API. Any functions added in later versions or in extensions have to be accessed through a pointer obtained from wglGetProcAddress(). GLEW just simplifies the process.