
-----------------------------------
saltpro15
Thu Mar 26, 2009 6:06 pm

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

-----------------------------------
Insectoid
Thu Mar 26, 2009 7:23 pm

RE:starting openGL
-----------------------------------
I'd like this too, I want to try Ruby with OpenGL.

-----------------------------------
DemonWasp
Thu Mar 26, 2009 7:34 pm

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 [url=http://jmonkeyengine.com/]JMonkeyEngine on [url=http://lwjgl.org/]LWJGL.

Does Ruby even *have* OpenGL bindings?

-----------------------------------
rdrake
Thu Mar 26, 2009 7:40 pm

Re: starting openGL
-----------------------------------
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.

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.

#ifdef WIN32
#include "Windows.h"
#endif

#include 
#include 
That should include the Windows API header only if you're compiling under Windows.

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
Thu Mar 26, 2009 8:01 pm

Re: 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 

Most certainly yes.

-----------------------------------
saltpro15
Thu Mar 26, 2009 8:06 pm

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
Thu Mar 26, 2009 8:55 pm

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
Thu Mar 26, 2009 10:00 pm

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.

-----------------------------------
rdrake
Fri Mar 27, 2009 12:25 am

Re: 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?Chances are you didn't tell it the proper libraries to use.

[code]-lopengl -lglu -lglut -mwindows[/code]

I forget exactly now, haven't done any OpenGL in a while.

-----------------------------------
saltpro15
Tue Mar 31, 2009 5:04 pm

RE:starting openGL
-----------------------------------
got it, thanks rdrake
