Images

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.

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

Hello,

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

cheers,
John

I am working on a topology optimisation software developed at my institute, see http://ime.auc.dk/~jfy
I am in a hurry, so

bye
Jens

Originally posted by john:
[b]Hello,

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

cheers,
John[/b]

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).]

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).]

Sorry, as I sayed I was in a hurry. Of course it should be www.ime.auc.dk/~jfy

bye

Fynbo

Originally posted by kanet77:
[b]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).][/b]