Jump to content

  • Log In with Google      Sign In   
  • Create Account


OpenGL for Linux and MacOSX?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
10 replies to this topic

#1 Neosettler   Members   -  Reputation: 150

Like
0Likes
Like

Posted 22 November 2012 - 09:58 AM

Hello OpenGL gurus,

I’ve been developing with OpenGL exclusively on Windows for several years now and I’m entering the cross-platform compiling world.

So far, I use skaslev-gl3w https://github.com/skaslev/gl3w to generate gl3w.h, gl3.h and gl3w.c. I found OpenGL32.lib within Visual Studio… it’s a wonderful world indeed… but when compiling with g++ on Linux, gl3w.c is requesting glx.h… and cough at glXGetProcAddress... Oups! There is no trace of this file on opengl.org and Googling on this topic is rather confusing so I decide to ask here.

1 - Why GLX? I thought pure GL was king on Linux... I'm confuse! (I surely dont want to rewrite my code)

2 - Where to find the official OpenGL package to develop on Linux and MacOSX?

Thx

Edited by Neosettler, 22 November 2012 - 01:01 PM.


Sponsor:

#2 Bregma   Crossbones+   -  Reputation: 4771

Like
3Likes
Like

Posted 22 November 2012 - 01:47 PM

I can't answer about MaC OS X, it's been too many years for me. Linux isn't an OS so there's no definitive answer there, but I can tell you about Debian-derived OSes (like Ubuntu), which are GNU-based OSes that can sometimes use the Linux kernel: try installing the libgl1-mesa-dev package. If you're asking about Android, another common OS that uses the Linux kernel, the GLES libraries should come with your devkit.

The answer to why your third-party software (skaslev-gl3w) uses GLX, well, you'd have to ask whoever developed it, but it's a handy and standard way to create a GL context on an X11 server.
Stephen M. Webb
Professional Free Software Developer

#3 Neosettler   Members   -  Reputation: 150

Like
0Likes
Like

Posted 22 November 2012 - 03:23 PM

Thank you Bregma,

Your answer almost gave me a heart attack. For all the porting a need to do, I thought OpenGL would be a breeze.

I’m currently working with CentOS/Redhat and I tried yum install libgl1-mesa-dev but the package is not found. So I’m guessing there’s extra steps to be made.

I simply need a pure OpenGL context 4.x, no extra lib, no fancy stuff, only the core… I’d really appreciate if anyone could help clear this up.

Thx again


#4 Martins Mozeiko   Crossbones+   -  Reputation: 1413

Like
2Likes
Like

Posted 22 November 2012 - 03:36 PM

On MacOSX read this about how OpenGL development works there: http://www.geeks3d.com/20121109/overview-of-opengl-support-on-os-x/

#5 tomlee   Members   -  Reputation: 104

Like
0Likes
Like

Posted 22 November 2012 - 03:43 PM

On CentOS/RHEL, you're probably after the mesa-libGL-devel package. :)

http://rpm.pbone.net/index.php3/stat/4/idpl/17834939/dir/centos_5/com/mesa-libGL-devel-6.5.1-7.10.el5.i386.rpm.html
Tom Lee -- http://tomlee.co

#6 Bregma   Crossbones+   -  Reputation: 4771

Like
1Likes
Like

Posted 22 November 2012 - 04:32 PM

I simply need a pure OpenGL context 4.x, no extra lib, no fancy stuff, only the core… I’d really appreciate if anyone could help clear this up.

Problems is there's not really such as thing as a pure OpenGL context. You're going to need something to draw to.

Even if you're going full screen, you're not directly programming the GPU and you're not driving the video output chips, you need to go through the OS kernel. A typical modern OS kernel is design to prevent you from getting at the hardware directly: you need to ask it nicely at the very least if it will do you the favour of accessing the hardware on your behalf. On a GNU/Linux system, that means getting the X11 server to share nicely. On Mac OS X that means getting the Quartz service to share nicely. Even on Microsoft Windows you need to share nicely with other applications calling into the embedded display service. On Android you use EGL to share the flinger nicely.

There are cross-platform libraries that will get you an OpenGL context. That's what they're for and why they're there. SDL, for example, works very well on all the above platforms. If you insist on doing without such a library, the source is free so you can see how it works and reimplement it yourself. Of course, it might turn out SDL uses glx/wgl/egl underneath, because to do otherwise would reimplement all those ioctl/X11/port/SYS calls. Might be worth checking, though, or even just using the library directly.
Stephen M. Webb
Professional Free Software Developer

#7 Karsten_   Members   -  Reputation: 1509

Like
3Likes
Like

Posted 22 November 2012 - 05:05 PM

The closest you can get to a "pure" OpenGL rendering context on X11 is by just using the X11 library itself.
Some of the older OpenGL books go into this but unfortunately it is becoming a bit of a lost art in the newer literature.

A good example is http://content.gpwiki.org/index.php/OpenGL:Tutorials:Setting_up_OpenGL_on_X11
As you can see, this uses GLX (which is what provides the rendering context).

Some more typical rendering contexts include...

glut
wxGLWidget (wxWidgets)
QtOpenGL (Qt)
Gtkglext (Gtk)
SDL

Personally, even though I am a C++ developer, I still highly recommend Glut. It is really portable and is already installed on most Linux distros. The 100% free implementation is called FreeGlut.

Edited by Karsten_, 22 November 2012 - 05:08 PM.

Mutiny - Open-source C++ Unity re-implementation.
Defile of Eden 2 - FreeBSD and OpenBSD binaries of our latest game.


#8 ic0de   Members   -  Reputation: 804

Like
0Likes
Like

Posted 22 November 2012 - 11:22 PM

I use SDL and OpenGL for my game. I found porting my game from windows to Linux was a breeze I didn't even need to edit any code and the computer seemed to have all the files I needed. As far as I know there is no such thing as "pure" OpenGL you will always need some way to window it. I also find using Glew helps but to each his own.

you know you program too much when you start ending sentences with semicolons;


#9 larspensjo   Members   -  Reputation: 1526

Like
0Likes
Like

Posted 23 November 2012 - 03:17 AM

If you want something portable that gives you only the OpenGL context, and nothing more, then I recommend glfw. Well, it gives you a little more, like interface to I/O (e.g. mouse, keyboard). In my opinion, glfw is a stronger and cleaner library than glut.
Current project: Ephenation.
Sharing OpenGL experiences: http://ephenationopengl.blogspot.com/

#10 Olof Hedman   Crossbones+   -  Reputation: 2665

Like
0Likes
Like

Posted 23 November 2012 - 03:49 AM

Thank you Bregma,

Your answer almost gave me a heart attack. For all the porting a need to do, I thought OpenGL would be a breeze.


Note though that all these libraries are only for setting up the GL context and getting a window to draw in, and some input (and possibly a few utility functions)

Those of course have to be OS specific.

All the actual rendering is the same standard OpenGL, as long as you use the same profile, so no need for heart attacks :)

(some drivers might have bugs, or allow some invalid behaviour that breaks on other drivers, but that is a separate story... )

Edited by Olof Hedman, 23 November 2012 - 03:50 AM.


#11 Neosettler   Members   -  Reputation: 150

Like
0Likes
Like

Posted 25 November 2012 - 12:25 AM

Thank you all for your inputs, I find out that VMware doesn't use the host GPU at all so it has all be in vain... I'm stuck with GL 2.1. sigh...




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS