Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 starting openGL
Index -> Programming, C++ -> C++ Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
saltpro15




PostPosted: Thu Mar 26, 2009 6:06 pm   Post subject: starting openGL

Hey guys,

I've been using C++ with various environments (MSVC++, Dev C++, Notepad++, Bluefish + command line)
and I want to start doing 3d graphics. I've heard the best way to do this is with openGL, now I know there's a good tut on this site for openGL, but I have a few questions
Right now I'm using Bluefish on Ubuntu, so where can I get glut for linux?
Will my programs still compile on Windows if i write them in Linux?
If 1 or 2 is a "no" then which Windows environment would you guys recommend? (MSVC++ or Dev C++)?

thanks,
Drew
Sponsor
Sponsor
Sponsor
sponsor
Insectoid




PostPosted: Thu Mar 26, 2009 7:23 pm   Post subject: RE:starting openGL

I'd like this too, I want to try Ruby with OpenGL.
DemonWasp




PostPosted: Thu Mar 26, 2009 7:34 pm   Post subject: RE:starting openGL

If you write in the portable subset of C++, you can get it to compile on both Windows and Linux. If you're careful, you can probably get OSX too. Cross-compiling is a chore, though, so be forewarned. You will need to compile for the target OS, which is probably best done ON that OS, with a compiler built for that platform.

No idea about GLUT though. My OpenGL stuff has all been through JMonkeyEngine on LWJGL.

Does Ruby even *have* OpenGL bindings?
rdrake




PostPosted: Thu Mar 26, 2009 7:40 pm   Post subject: Re: starting openGL

saltpro15 @ Thu Mar 26, 2009 6:06 pm wrote:
Right now I'm using Bluefish on Ubuntu, so where can I get glut for linux?
You need freeglut-dev. I believe it's this.

code:
sudo apt-get install freeglut3-dev


If not, remove the 3 from there.

saltpro15 @ Thu Mar 26, 2009 6:06 pm wrote:
Will my programs still compile on Windows if i write them in Linux?
Yes, before the GLUT and OpenGL include files you need to include the Windows API header. The following (from memory) should do the trick.

c++:
#ifdef WIN32
#include "Windows.h"
#endif

#include <GL/glu.h>
#include <GL/glut.h>

That should include the Windows API header only if you're compiling under Windows.

saltpro15 @ Thu Mar 26, 2009 6:06 pm wrote:
If 1 or 2 is a "no" then which Windows environment would you guys recommend? (MSVC++ or Dev C++)?
Personally I found Dev-C++ to be easiest on Windows. You install the OpenGL/GLUT package for it from the package manager.
wtd




PostPosted: Thu Mar 26, 2009 8:01 pm   Post subject: Re: RE:starting openGL

DemonWasp @ Fri Mar 27, 2009 8:34 am wrote:
If you write in the portable subset of C++, you can get it to compile on both Windows and Linux. If you're careful, you can probably get OSX too. Cross-compiling is a chore, though, so be forewarned. You will need to compile for the target OS, which is probably best done ON that OS, with a compiler built for that platform.

No idea about GLUT though. My OpenGL stuff has all been through JMonkeyEngine on LWJGL.

Does Ruby even *have* OpenGL bindings?


Most certainly yes.
saltpro15




PostPosted: Thu Mar 26, 2009 8:06 pm   Post subject: RE:starting openGL

I decided to go with Dev C++, found the file for glut, installed it, ran some sample code and I'm getting linker errors, anyone know what I did wrong?
DemonWasp




PostPosted: Thu Mar 26, 2009 8:55 pm   Post subject: RE:starting openGL

The libraries may not be on the LD_LIBRARY_PATH or similar. I'll assume you got the glut libraries through the repositories; can we see your linker errors?
CodeMonkey2000




PostPosted: Thu Mar 26, 2009 10:00 pm   Post subject: RE:starting openGL

Are you new to graphical APIs? If you are then I wouldn't recommend jumping right into openGL. Begin with SDL first, it's simple, but it only does 2D. On the plus side you can use SDL with openGL instead of using GLUT.
Sponsor
Sponsor
Sponsor
sponsor
rdrake




PostPosted: Fri Mar 27, 2009 12:25 am   Post subject: Re: RE:starting openGL

saltpro15 @ Thu Mar 26, 2009 8:06 pm wrote:
I decided to go with Dev C++, found the file for glut, installed it, ran some sample code and I'm getting linker errors, anyone know what I did wrong?
Chances are you didn't tell it the proper libraries to use.

code:
-lopengl -lglu -lglut -mwindows


I forget exactly now, haven't done any OpenGL in a while.
saltpro15




PostPosted: Tue Mar 31, 2009 5:04 pm   Post subject: RE:starting openGL

got it, thanks rdrake
Display posts from previous:   
   Index -> Programming, C++ -> C++ Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 10 Posts ]
Jump to:   


Style:  
Search: