Sign in to follow this  
TruckMack33

Save Image?

Recommended Posts

Okay, I sure hope I'm in the right place. I'm using Visual C++ 2008 Express Edition and the glut libraries. I'm trying to save the image in the window. Kinda like a capture screen or print screen. I looked into using the glutgetcolor to get the RBG components of each pixel. My reasoning is that I could make an algorithm to save them as .bmp file or possibly another file type. Unfortunately, there are two problems. 1) My graphics card evidently doesn't support the index display mode that is (necessary?) to use that call. 2) I'm currently using another display mode to draw object. This feature is absolutely necessary. Is there any way to capture the image using glut? If not, are there any alternatives?

Share this post


Link to post
Share on other sites
don't know about glut.
but something like this is straight forward:

unsigned char *outputImage = 0;
outputImage = new unsigned char[w * h * 3];
glReadPixels(0, 0, w-1, h-1, GL_RGB,GL_UNSIGNED_BYTE, outputImage);

Share this post


Link to post
Share on other sites
I assume that a GL_UNSIGNED_BYTE is 3 * sizeof(char), and thats why the three appears in
Quote:
Original post by steven katic
outputImage = new unsigned char[w * h * 3];


Thanks for a showing me it's possible. There's allot of information and discussion on the web about this. About the drawback that it can't get resolution better then the screen. But for now, the point was to learn that it was possible.

As far as glut, I believe GLUT is described as a wrapper for OpenGL. I think I might just spend the extra time writing the code directly in OpenGL instead of switching back and forth.

Thanks for the direction.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this