Jump to content
  • Advertisement
Sign in to follow this  
TruckMack33

Save Image?

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

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
Advertisement
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
Sign in to follow this  

  • 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!