PDA

View Full Version : Capturing image as bitmap



Rajveer
04-04-2002, 07:58 AM
I'm writing a 3D graphics software and I'd like to make calculations on a particular scene. OpenGL doesn't support this, so I was thinking about capturing the scene to a bitmap file and then writing another small program to do the calculations. Does anyone know how to capture an OpenGL scene to a bitmap file?

rts
04-04-2002, 09:03 AM
If only I had a dime for every time I posted this URL... why oh why don't people use the "Search"?
http://www.opengl.org/discussion_boards/ubb/Forum4/HTML/000182.html

Rajveer
04-05-2002, 09:40 AM
Okay, I went to that link. I took the screenshot.h and screenshot.c files and made a project with them for visual C++. I also linked the necessary openGL libraries in the settings:
OpenGL32.lib GLu32.lib and GLaux.lib

So why do I get 81 errors when I compile. Not only that, but most of the errors are in the gl.h header file. What am I forgetting to do?? Or what am I doing completely wrong??

Deiussum
04-05-2002, 10:56 AM
You didn't post any errors, but since you said you are getting errors in gl.h, I'm guessing those errors are along the lines of APIENTRY being undefined?

Do this.
#include <windows.h> //defines APIENTRY and other stuff used in gl.h
#include<GL/gl.h>


Note the order... windows.h, then gl.h

rts
04-06-2002, 05:52 PM
In real life I am the Amazing Kreskin (http://www.kreskin.com/) the Mentalist. Without seeing the errors (which you should always post, by the way, if you want people to help you) I'll bet you also get problems with __attribute__((packed)).

Now, of course, the first thing you do is go to Google (http://www.google.com/) and search for __attribute__((packed)). Eventually you will hit upon http://gcc.gnu.org/onlinedocs/gcc-3.0.4/gcc_5.html#SEC102
that explains that __attribute__((packed)) is a GCC extensions which says that the structures should be packed as tightly as possible.

And then, of course, you turn to the Visual Studio documentation to see how to accomplish the same thing. Hint: #pragma packed.


[This message has been edited by rts (edited 04-06-2002).]