Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

timbuk2

OpenGL creating offscreen OpenGL

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

Hi all, Does anyone know if/ how i can create an OpenGL world offscreen, i.e. without creating a window. I want to set up some kind of rendering engine in the background of my application where i can grab bitmaps from it every now and again but don''t want to see it on the screen. I have possible found two methods, one using P-Buffers, the other to set the PIXELFORMATDESCRIPTOR to draw PFD_DRAW_TO_BITMAP instead of PFD_DRAW_TO_WINDOW. Have any of you had any experience doing what I''m attempting, Hopefully someone can point me in the right direction, many thanx - Tim

Share this post


Link to post
Share on other sites
Advertisement
If performance is not important I strongly reccomend Mesa, or more precisely OSMesa (Off Screen Mesa). If can render directly into your own allocated frame buffer. Like this.

  
GLubyte *frameBuffer = new GLubyte[witdh*height*4];

OSMesaContext OSRC;

OSRC = OSMesaCreateContextExt(OSMESA_RGB, 16, 0, 0, 0);
OSMesaMakeCurrent(OSRC, frameBuffer, GL_UNSIGNED_BYTE, width, height)

// OpenGL code here

glFinish();

OSMesaDestroyContext(OSRC);

After the rendering context is destroyed, frameBuffer contains the image you just rendered.

Share this post


Link to post
Share on other sites
I would quite like it to be efficient, if anyone else has another method I would like to know. i will definately look into Mesa for the moment, thanx Brother Bob!!

Share this post


Link to post
Share on other sites
Read about the many subsets of buffers withen the array of the "Frame Buffer." The color buffer itself contains sometimes 4 sub-buffers: right and left ("stereo"), and back and front buffering. And they're meant to do exactly that, buffer. Ever hear of double-buffering? That's using both the front and back buffers and having a buffered frame ready to go. Here are free online books written by the geniuses at SGI who made da shit(OpenGL): Here's an OpenGL reference . But I don't think this is the part of the site that I was referring to. Still will help you. Does anybody know the link to the "Red Book" and the "Blue Book?"

[edited by - 63616C68h on March 8, 2003 10:34:16 AM]

Share this post


Link to post
Share on other sites
http://www.eecs.tulane.edu/www/graphics/doc/OpenGL-Man-Pages/opengl_index_spec.html

www.gamedev.net/download/redbook.pdf


I hope this is it.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!