PDA

View Full Version : Images



Fynbo
03-18-2003, 07:52 AM
I desperately need to know how to capture an images of en rendered geometry I OpenGL. I need the picture in an optimisation software, so it will be nice if it is fast.

HalcyonBlaze
03-18-2003, 06:48 PM
Look up operations on the frame buffer. I think the exact function you are looking for is glReadPixels(...). I'm not 100% sure that that is the name though.

- Halcyon

john
03-18-2003, 08:25 PM
Hello,

Fynbo: I'm interested; what are you working on?

cheers,
John

Fynbo
03-18-2003, 09:09 PM
I am working on a topology optimisation software developed at my institute, see http://ime.auc.dk/~jfy
I am in a hurry, so http://www.opengl.org/discussion_boards/ubb/wink.gif

bye
Jens



Originally posted by john:
Hello,

Fynbo: I'm interested; what are you working on?

cheers,
John

kanet77
03-19-2003, 04:02 PM
Just a note to anyone else who has trouble with the link. I could only get to the page if I included the 'www'. http://www.ime.auc.dk/~jfy/

I agree with HalcyonBlaze that glReadPixels() should do the trick.

[This message has been edited by kanet77 (edited 03-19-2003).]

oliii
03-19-2003, 05:58 PM
GLubyte* CaptureFrameBuffer(GLint x, GLint y, GLsizei w, GLsizei h)
{
GLubyte *Buffer = new GLubyte[w * h * 4];
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
glReadPixels(x, y, w, h, GL_RGBA, GL_UNSIGNED_BYTE, (GLvoid*) Buffer);
return Buffer;
}

mind you, capturing the frame buffer is inherently slow. But there are no other openGL alternatives I'm aware of. You could hack it using the Win32 GDI. after all, it's just like doing a screen capture. That might be faster in windowed mode. You can expect an average of 5 fps or lower using glReadPixels().

[This message has been edited by oliii (edited 03-19-2003).]

Fynbo
03-21-2003, 12:47 AM
Sorry, as I sayed I was in a hurry. Of course it should be www.ime.auc.dk/~jfy (http://www.ime.auc.dk/~jfy)

bye

Fynbo


Originally posted by kanet77:
Just a note to anyone else who has trouble with the link. I could only get to the page if I included the 'www'. http://www.ime.auc.dk/~jfy/

I agree with HalcyonBlaze that glReadPixels() should do the trick.

[This message has been edited by kanet77 (edited 03-19-2003).]