Jump to content
  • Advertisement
Sign in to follow this  
blanky

OpenGL Linux OpenGL

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

Hello guys, as you know I'm getting into OpenGL, anyways, I've noticed that there are some functions starting with w, wgle functions, that are strictly for windows, what are the linux equivalents? In other words, I'd like to, if you may, see some sample linux opengl code, simple or complex, I'd just like to see what the difference is, so that I could implement a crossplatform solution, thanks guys.

Share this post


Link to post
Share on other sites
Advertisement
I'm just telling you this in case you are not aware of it. If you are aware of it, good luck with your project!

There is a cross-platform OpenGL library avaliable - GLFW. There's a little more information on it here as well if you are interested.

Share this post


Link to post
Share on other sites
This looks like what I'm looking for, so I could make my programs, obviously make sure it doesn't contain functions specific to one OS like MessageBox, and compile on each system and it'll work, without having to modify the code, just compile it with the corresponding compiler right? Thanks.

EDIT: Although, how would I go about making controls in OpenGL, as JavaCoolDude's Widgest for example? I'm thinking GLFW doesn't support this, so another cross platform library that supports this is probably QT? I know QT supports OpenGL, and it'd support both systems I think. Basically, what I'm looking for is a way to write my programs so that I could compile the code for both systems without modifying the code, and if needed, very little. Thanks all, hope there's a solution. In other words, something like Quake3, how would I go about doing this? I know the source code has been released but it's a mess to me and I'm not an expert at it, thanks again.

Like, I've seen sources where at the top they have #ifdef WIN32, and take the corresponding course of action. So they have defined both linux and windows functions, I believe this is how quake3 is made, but I'm not sure, I'd like to know what you guys think, thanks.

Share this post


Link to post
Share on other sites
Quote:
Original post by blankdev
This looks like what I'm looking for, so I could make my programs, obviously make sure it doesn't contain functions specific to one OS like MessageBox, and compile on each system and it'll work, without having to modify the code, just compile it with the corresponding compiler right?


Correct, if you use all GLFW specific code, it should compile on any supported platform without a problem.

Quote:
I'm thinking GLFW doesn't support this, so another cross platform library that supports this is probably QT?


Well GLFW is just an OpenGL framework more or less. It does not come with anything special other than a system of input. You would need to add a library such as that or perhaps something such as CeGUI, which is used a lot for its cross-platform functionality. Ogre3D uses CEGUI.

Quote:
Although, how would I go about making controls in OpenGL, as JavaCoolDude's Widgest for example?


There seems to be a linux port as well on that page for that GUI, but when going between Windows and Linux, you'll probabaly have to change a few things here and there.

Quote:
Like, I've seen sources where at the top they have #ifdef WIN32, and take the corresponding course of action. So they have defined both linux and windows functions, I believe this is how quake3 is made, but I'm not sure, I'd like to know what you guys think, thanks.


Ah yes, that is more for when you take the approach of using platform specific code that you know you will need to use in a cross-platform environment.

If you are using OpenGL for cross platform apps, I'd strongly reccomend you take a look into using SDL. If there's anything else you are needing to know, please continue on [smile]

Share this post


Link to post
Share on other sites
Lots of thanks shannon and drew. I'm really impressed with GLFW though I haven't tried it, love how easy it looks though. SDL, is that any different from GLFW? I dont need any fancy input and sound stuff, just cross platform graphics that will compile on both platforms without modifying code. Does SDL let you invoke messageboxe's on both systems? If SDL isn't all that different from GLFW in terms of portability for OpenGL, I guess I'll see which one's easier then. All I really needed was that and also support for invoking messageboxes and dialougs and stuff like that, but now that you mention it, I might not need it anyways, CeGUI does that? I'll look into it tomorrow, thanks. And I didn't quite understand what you ment about Quake3's approach, I'm really appealed to it however, I'd like any info you can give me on it. I got a program that's like that, it's here: http://www.cr0.net:8040/code/opengl/ . In the linux binaries (it comes with both anyways so dont know what the difference is) it uses the Quake3 approach, though I dont understand it, would really like to know more about it though, so you think I should look into SDL? Thanks.

Share this post


Link to post
Share on other sites
SDL out of the box has no GUI stuff... I use SDL to:
1) init video mode, pretty easy with SDL
2) deal with events (i.e. keypresses, mouse moves and buttons)

both are a cakewalk to do with SDL and the example included with SDL's docs would ge you up and running quickly with openGL, but... there is no GUI with just plain vanilla SDL, however if you ahve the time one can use one of the following: (taken from libsdl.org)

GUIlib - a C++ GUI widget library
http://www.libsdl.org/projects/GUIlib

JAD Menu - a simple OpenGL-based dialog and menu system
http://sourceforge.net/projects/jad

libUFO - a platform independent GUI for OpenGL written in C++
http://libufo.sourceforge.net

aedGUI - A simple C++ based GUI library for SDL
http://aedgui.sourceforge.net



and others are lister there too... though I ahve to admit Iahve mininal expereinces with using any of the above... also, some fellow on the forums was writing their own *nice* looking openGL gui, you may want to take alook at that one too (I had written my own GUI, and to make a reasonably good one can take a significant amount of time)

Share this post


Link to post
Share on other sites
I haven't checked all the links you guys gave me, I will, but anyways.

Thanks again, basically what I want is to start off learning OpenGL already ready to make cross platform programs. So I want a library, or a method as Quake3's, where it would compile for both linux and windows without modifying the code, if at all then just the defines or something else not too big. I also would like to know if there's a GUI library that works for both windows and linux, like QT, but something you guys recommend. Basically that'd be if I'm making a level editor or something like that. If there isn't I guess learning linux GUI prgramming isn't bad, but I dont know what I'm supposed to learn, X11? QT? GTK? I dont even know if GTK does that, but anyways, that's basically what I was looking for. I also didn't want a huge library as SDL that would add too much unneccessary stuff to my program, but I guess most libraries come with extras, so I guess it's okay. So basically:

What libraries do you recommend for cross platform:

GUI Programming
OpenGL Programming
Input Programming (would become a must have later on, maybe SDL would be good, but I've heard GLUT does it too, which is best?)
Sound Programming (I believe OpenAL would do this)

So I just wanted to start programming already accustomed to cross platform programming, thanks guys.

Could GLUT do this?

Quote:


Information from http://www.linux.com/howtos/Nvidia-OpenGL-Configuration/x103.shtml

MesaDemos provides many OpenGL demo programs and, more importantly, the GL Utility Toolkit (libglut) library. GLUT provides a window system independent interface between OpenGL and any supported window system. For instance, on the X Window System, it hides the details of using glX functions to setup a window. Programmers can write code once and can compile it to work on MS Windows or X, etc provided that a GLUT library is available on the target platform. Like libGLU, libglut is a standard part of most OpenGL installations and is required by many programs.


KRouge, thanks for all the links, but which do you recommend the most? I'm attracted to aedGUI since it says you dont have to learn another API, it's on top of SDL. I'm actually looking for GUI as in windows, not actual GUI within OpenGL Applications, for that I'd use JavaCoolDude's linux port to his gui system (I know it was someone else who made that port, huang or something). Just looking for window GUI cross platform, such as windows with widgets and the actual window containing the opengl within it itself. So basically I want a library that will let me make the window for both systems.

[Edited by - blankdev on September 13, 2005 6:29:57 PM]

Share this post


Link to post
Share on other sites
Sorry to double post, but I'm just really anxious to know, I'm guessing GLUT will do what I'm saying, make the window for OpenGL and all, I'll use aedGUI or JavaCoolDude's GUI in game however, is this good? Or should I use SDL over GLUT? Thanks. Also, if anyone can point me to any SDL tut's it'd be really nice, thanks.

I've noticed that with GLUT and SDL when you make a program, the console window pops up first, can I change this? Is there any library that does what these do without the console window? I doubt it, but it's alright. Also, will there be a performance degrade when using GLUT or SDL instead of just GL for the specific system? Would it be significant? Thanks.

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!