• Advertisement
Sign in to follow this  

[OpenGL] Render using buffer.

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

Is there any method that I save current frame buffer and render the buffer instead of full 3D scene in OpenGL. Because my scene do not change and it do not need any update, so I think if I can save my current frame buffer, and render using the buffer by just 2D rendering, performance will rise up dramatically. But, I didn't find the way. I read some function's decriptions, glCopyPixels(), glDrawPixels(). Unfortunately I didn't catch how can I make it using that functions. Any comments please...

Share this post


Link to post
Share on other sites
Advertisement
GLint index;
glGenTextures (1, &index);
glBindTexture (GL_TEXTURE_2D, index);
glCopyTexImage2D (GL_TEXTURE_2D, 0, GL_RGB, 0, 0, winW, winH, 0);

Now index is a texture that contains your scene (provided that the scene is a power-of-two thing, otherwise you'll have to mess around a bit to do it).

But, if your scene isn't changing, why re-display it? Only re-render when something has changed in your scene. :)

Share this post


Link to post
Share on other sites
glGenRenderbuffersEXT can be used to create a specialized offscreen render buffer. I use this for the same purpose you do.

Here is a list of the related functions:
glBindFramebufferEXT;
glDeleteFramebuffersEXT;
glGenFramebuffersEXT;
glFramebufferTexture2DEXT;
glBindRenderbufferEXT;
glDeleteRenderbuffersEXT;
glGenRenderbuffersEXT;
glRenderbufferStorageEXT;
glFramebufferRenderbufferEXT;

The reason to redisplay the 2D buffer is so that any areas of the screen which may have been drawn over by the OS can be refreshed in a non-OS-specific way.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement