PDA

View Full Version : [opengl] draw offscreen into a Frame Buffer Object to use as a texture



nkint
26th June 2013, 19:23
Hi!
Sorry I'm new new to c++ and compilation/including problems.
I have some code in pure opengl and i have to take it, use for drawing the stuffs on some offscreen buffer, and then use this buffer as a texture.

What I have tried is to take code that uses frame buffer objects and write it inside a QGLWidget.

The first problem is that I can't use method such as
glGenFramebuffers or glBindFramebuffer because I'm not able to import "glew.h" both in Ubuntu and in Mac osx. I'm using QtCreator and I'm importing openg with:


# add opengl libs
QT += opengl
LIBS += -lglut -lGLU -lGL # this line is needed only in linux

inside the .pro file. But in the future I'd like to use cmake.

The fact is that I'm using Qt because I like it very much but I'd like to stay as general as possible (use pure opengl functions and not QFramebufferObject) because my collegues could use my code inside something else.
But if there is no way, I will use them if I will found a very suitable example for render-into-texture.

Anyway, inside initializeGL if I cout


std::cout << "gl version:" << glGetString(GL_VERSION) << std::endl;
// I get:
//gl version:4.3.0 NVIDIA 319.23


So.. they should be supported. And original opengl program I found for what I need runs ok with other window/opengl-context manager.

Can someone help me?