PDA

View Full Version : What are the differences between win32 and x11 in opengl



aming
12-15-2000, 10:38 PM
There are many differences between win32 and X11 in glut library. I can find them in the readme.win. But I can not find any materials for opengl. Who can tell me?

Leyder Dylan
12-16-2000, 01:31 AM
I'm not sure but I think that X11 is for Linux et Win32 for Windows.

Deiussum
12-17-2000, 10:16 AM
I'm not sure I understand the question, but I think you're asking about the differences in using OpenGL in Windows vs. Linux. The only real difference is in the window creation and initialization, and other system specifics such as keyboard and mouse. In Windows you use functions such as ChoosePixelFormat, DescribePixelFormat, SetPixelFormat, and the wgl* functions. In Linux there are glx* functions (I think that's the prefix.) I've never done any pure X programming, but I'm pretty sure that you don't use Window's CreateWindow API to create a window in Linux. Glut is nice because it takes all those differences and provides a single set of function calls that work no matter what platform you're using.

aming
12-17-2000, 03:20 PM
Thank you very much.
In fact,my problem is that the differences in using gl.h,glu.h in Windows vs. Linux.
I am translating a program from MFC to C++,to run it on Linux platform. And the work is being done on Windows. So I need know the differences.

Deiussum
12-18-2000, 05:17 AM
First of all, MFC *IS* C++. It's a set of C++ classes that wrap the Win32 API as well as a few other minor things. It's a library, not a language. (Sorry, just a pet peave of mine when people try to claim VC++ and C++ are different languages.) http://www.opengl.org/discussion_boards/ubb/smile.gif

For your problem, you should be able to keep your gl* functions exactly as they are. I'm not sure exactly the design of your program, but you'll first have to either decide to use glut for Linux, or learn how to use the glx* functions for creating an OpenGL window under Linux. Glut is really simple to use, so I'd probably go down that path unless you really wanna learn the intricacies of the glx* functions.

Technically, if you are using a document/view hierarchy, you could probably keep your current doc/view code just by taking out some macros they use that are defined in the MFC headers, and implementing functions you use from the base class, which obviously wouldn't exist in Linux. It would probably be easier to redesign the code, though.

So basically, you'll probably be re-writing the whole framework and using cut/paste to put your gl* functions in the appropriate place.