OpenGL 3.2 in OS X 10.7

classic Classic list List threaded Threaded
15 messages Options
Reply | Threaded
Open this post in threaded view
|

OpenGL 3.2 in OS X 10.7

JStoecker
I heard that OS X 10.7 (Lion) supports OpenGL 3.2, and I've written a small C++ program that creates an OpenGL 3.2 context to verify this. However, I cannot use a GL3 profile with JOGL; no matter which profile I select I still get OpenGL 2.1 / shader language 1.20.

I haven't looked at the JOGL code itself, but I'm wondering if this is a quick fix I could make myself or if this is already something in the works?

Thanks
Reply | Threaded
Open this post in threaded view
|

Re: OpenGL 3.2 in OS X 10.7

Wade Walker
Administrator
Let me try upgrading my Mac to Lion and take a look. I can at least tell you if I see the same behavior.
Reply | Threaded
Open this post in threaded view
|

Re: OpenGL 3.2 in OS X 10.7

Sven Gothel
Administrator
In reply to this post by JStoecker
On Wednesday, July 20, 2011 08:57:58 PM JStoecker [via jogamp] wrote:
>
> I heard that OS X 10.7 (Lion) supports OpenGL 3.2, and I've written a small
> C++ program that creates an OpenGL 3.2 context to verify this. However, I
> cannot use a GL3 profile with JOGL; no matter which profile I select I still
> get OpenGL 2.1 / shader language 1.20.
>
> I haven't looked at the JOGL code itself, but I'm wondering if this is a
> quick fix I could make myself or if this is already something in the works?
>

Oh .. finally :)

Maybe you show how you did it ?

On X11/EGL/Win32 we have a new way of creating a GL context,
maybe you can adapt this to OSX as well ?
Right now, we just ignore the GL version at context creation
and say it's a GL2 thingy - and gather the version by the GL_VERSION string.
(This is the old method).

New method is to iterate through all GL versions, trying to create a context.
This is done once at startup for the default device, or any other device once,
when it's being used the 1st time.

+++

Questions regarding upgrading OSX to Lion (especially for our build node[s]).

- Will the SDK still be able to produce fat binaries for 32/64 bit mode ?

- Compatibility issues ?

- If things go wrong, can I row back to the prev. OSX installation ?

Thank you.
> Thanks
>
> _______________________________________________
> If you reply to this email, your message will be added to the discussion below:
> http://forum.jogamp.org/OpenGL-3-2-in-OS-X-10-7-tp3186330p3186330.html
> To start a new topic under jogl, email [hidden email]
> To unsubscribe from jogl, visit
health & wealth
mailto:
[hidden email] ; http://jausoft.com
land : +49 (471) 4707742 ; cell: +49 (151) 28145941
Timezone CET: PST+9, EST+6, UTC+1
Reply | Threaded
Open this post in threaded view
|

Re: OpenGL 3.2 in OS X 10.7

JStoecker
No kidding Sven, this is way overdue. Here is a sample C program that I used to check the context. I found this code on a forum somewhere as I've only used GLUT in the past for the window:

#include <OpenGL/OpenGL.h>
#include <OpenGL/gl3.h>
#include <stdio.h>

int main(int argc, char **argv)
{
  CGLContextObj ctx;
  CGLPixelFormatObj pix;
  GLint npix;
  CGLPixelFormatAttribute attribs[] = {
    kCGLPFAOpenGLProfile, kCGLOGLPVersion_3_2_Core, 0 };

  CGLChoosePixelFormat(attribs, &pix, &npix);
  CGLCreateContext(pix, NULL, &ctx);
  CGLSetCurrentContext(ctx);

  printf("Vendor:   %s\n", glGetString(GL_VENDOR));
  printf("Renderer: %s\n", glGetString(GL_RENDERER));
  printf("Version:  %s\n", glGetString(GL_VERSION));
  printf("GLSL:     %s\n", glGetString(GL_SHADING_LANGUAGE_VERSION));
  return 0;
}


Compiled with "gcc -framework OpenGL <filename>", and the output after running:

Vendor:   ATI Technologies Inc.
Renderer: AMD Radeon HD 6750M OpenGL Engine
Version:  3.2 ATI-7.2.9
GLSL:     1.50


To be honest, I can't really answer you questions about how OS X works with the binaries and downgrades. I'm actually a Linux user and I've only recently purchased my first Mac (to the dismay of some of my Linux peers). So far I've had no issues running any JOGL programs I've written with RC2. I *think* Lion is only 64 bit though.
Reply | Threaded
Open this post in threaded view
|

Re: OpenGL 3.2 in OS X 10.7

Wade Walker
Administrator
I upgraded my Mac to OS X Lion, then pulled down the latest JOGL 2 code and recompiled it (which also required the new 4.1 version of Xcode and a manual install of Java 1.6.0_26, since it doesn't come standard with Lion).

JOGL tests using GL2 still seem to work fine. When I try this:

GLProfile glprofile = GLProfile.get(GLProfile.GL3);

it doesn't seem to see GL3 as available. That part of the code is a bit convoluted , so I can't quite tell why it doesn't find GL3. Maybe Sven can point me to the right place to look?

Here's the debug output:

GLProfile.init firstUIActionOnProcess: true, thread: main
-----------------------------------------------------------------------------------------------------
Platform: Mac OS X 10.7 (os), x86_64 (arch) 2 cores
Platform: littleEndian true, 32Bit false, a-ptr bit-size 64
Platform: Java 1.6.0_26, Java HotSpot(TM) 64-Bit Server VM, Apple Inc., http://www.apple.com/, is JavaSE: true
-----------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------
Package: com.jogamp.common
Extension Name: null
Specification Title: null
Specification Vendor: null
Specification Version: null
Implementation Title: null
Implementation Vendor: null
Implementation Vendor ID: null
Implementation URL: null
Implementation Version: null
Implementation Branch: null
Implementation Commit: null
-----------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------
Package: javax.media.nativewindow
Extension Name: null
Specification Title: null
Specification Vendor: null
Specification Version: null
Implementation Title: null
Implementation Vendor: null
Implementation Vendor ID: null
Implementation URL: null
Implementation Version: null
Implementation Branch: null
Implementation Commit: null
-----------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------
Package: javax.media.opengl
Extension Name: null
Specification Title: null
Specification Vendor: null
Specification Version: null
Implementation Title: null
Implementation Vendor: null
Implementation Vendor ID: null
Implementation URL: null
Implementation Version: null
Implementation Branch: null
Implementation Commit: null
-----------------------------------------------------------------------------------------------------
GLDrawableFactory.static - Native OS Factory for: MacOSX: jogamp.opengl.macosx.cgl.awt.MacOSXAWTCGLDrawableFactory
java.lang.Throwable: Info: GLProfile.initProfilesForDevice: MacOSXGraphicsDevice[type MacOSX, connection decon, unitID 0, handle 0x0], isSet false
	at javax.media.opengl.GLProfile.initProfilesForDeviceCritical(Unknown Source)
	at javax.media.opengl.GLProfile.initProfilesForDevice(Unknown Source)
	at javax.media.opengl.GLProfile.initProfilesForDefaultDevices(Unknown Source)
	at javax.media.opengl.GLProfile.access$000(Unknown Source)
	at javax.media.opengl.GLProfile$1.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	at javax.media.opengl.GLProfile.initSingleton(Unknown Source)
	at name.wadewalker.jogl2tests.CapsCheck.main(CapsCheck.java:24)
GLProfile.init map decon, desktopCtxUndef true, eglCtxUndef true
GLProfile.init map GLProfile[GL4bc/GL4bc] on devide decon
GLProfile.init map default GLProfile[GL4bc/GL4bc] on device decon
GLProfile.init map GLProfile[GL3bc/GL3bc] on devide decon
GLProfile.init map GLProfile[GL2/GL2] on devide decon
GLProfile.init map GLProfile[GL4/GL4] on devide decon
GLProfile.init map GLProfile[GL3/GL3] on devide decon
GLProfile.init map GLProfile[GL2GL3/GL2] on devide decon
GLProfile.init map *** no mapping for GLES2 on device decon
GLProfile.init map GLProfile[GL2ES2/GL2] on devide decon
GLProfile.init map *** no mapping for GLES1 on device decon
GLProfile.init map GLProfile[GL2ES1/GL2] on devide decon
GLProfile.initProfilesForDevice: MacOSXGraphicsDevice[type MacOSX, connection decon, unitID 0, handle 0x0]: desktop Shared Ctx false
GLProfile.init map decon, desktopCtxUndef false, eglCtxUndef false
GLProfile.init map *** no mapping for GL4bc on device decon
GLProfile.init map *** no mapping for GL3bc on device decon
GLProfile.init map GLProfile[GL2/GL2] on devide decon
GLProfile.init map default GLProfile[GL2/GL2] on device decon
GLProfile.init map *** no mapping for GL4 on device decon
GLProfile.init map *** no mapping for GL3 on device decon
GLProfile.init map GLProfile[GL2GL3/GL2] on devide decon
GLProfile.init map *** no mapping for GLES2 on device decon
GLProfile.init map GLProfile[GL2ES2/GL2] on devide decon
GLProfile.init map *** no mapping for GLES1 on device decon
GLProfile.init map GLProfile[GL2ES1/GL2] on devide decon
GLProfile.initProfilesForDevice: decon: added profile(s): desktop true, egl false
GLProfile.initProfilesForDevice: decon: GLAvailability[Native[GL4bc false, GL4 false, GL3bc false, GL3 false, GL2 true[1.5 (compatibility profile, any, old)], GL2ES1 true, GLES1 false, GL2ES2 true, GLES2 false], Profiles[GLProfile[GL2ES2/GL2], GLProfile[GL2ES1/GL2], GLProfile[GL2/GL2], GLProfile[GL2/GL2], GLProfile[GL2GL3/GL2], , default GLProfile[GL2/GL2]]]
GLProfile.dumpGLInfo: shared context n/a
GLProfile.init addedAnyProfile      true
GLProfile.init isAWTAvailable       true
GLProfile.init has desktopFactory   true
GLProfile.init hasDesktopGL         true
GLProfile.init hasGL234Impl         true
GLProfile.init has eglFactory       true
GLProfile.init hasGLES1Impl         false
GLProfile.init hasGLES2Impl         false
GLProfile.init defaultDesktopDevice MacOSXGraphicsDevice[type MacOSX, connection decon, unitID 0, handle 0x0]
GLProfile.init defaultEGLDevice     EGLGraphicsDevice[type EGL, connection decon, unitID 0, handle 0x0]
GLProfile.init defaultDevice        MacOSXGraphicsDevice[type MacOSX, connection decon, unitID 0, handle 0x0]
GLProfile.init: [GL4bc, GL3bc, GL2, GL4, GL3, GL2GL3, GLES2, GL2ES2, GLES1, GL2ES1], GLAvailability[Native[GL4bc false, GL4 false, GL3bc false, GL3 false, GL2 true[1.5 (compatibility profile, any, old)], GL2ES1 true, GLES1 false, GL2ES2 true, GLES2 false], Profiles[GLProfile[GL2ES2/GL2], GLProfile[GL2ES1/GL2], GLProfile[GL2/GL2], GLProfile[GL2/GL2], GLProfile[GL2GL3/GL2], , default GLProfile[GL2/GL2]]]
-----------------------------------------------------------------------------------------------------
Package: javax.media.opengl
Extension Name: null
Specification Title: null
Specification Vendor: null
Specification Version: null
Implementation Title: null
Implementation Vendor: null
Implementation Vendor ID: null
Implementation URL: null
Implementation Version: null
Implementation Branch: null
Implementation Commit: null
-----------------------------------------------------------------------------------------------------
Exception in thread "main" javax.media.opengl.GLException: No AWTGraphicsConfiguration: AWT-GLCanvas[Realized false,
	null-drawable,
	Realized false,
	Factory   null,
	handle    0x0,
	Drawable size -1x-1,
	AWT pos 0/0, size 0x0,
	visible true,
	null]
	at javax.media.opengl.awt.GLCanvas.getChosenGLCapabilities(Unknown Source)
	at name.wadewalker.jogl2tests.CapsCheck.main(CapsCheck.java:34)
Reply | Threaded
Open this post in threaded view
|

Re: OpenGL 3.2 in OS X 10.7

alterscape
I would love to see GL 3.2 supported in JOGL2 on OS X -- I actually upgraded to Lion on launch day specifically for GL 3.2 in JOGL, not realizing that it wouldn't be supported (which is totally my fault, for not checking first). Is there a timeline to get this upgraded? I'd like to use the GL 3.2 features in software I'm building in support of my dissertation.  I will take a look at the source and see how challenging it would be to make work, but I doubt I'll be much help, and I don't want to duplicate work the team's already working on.
Reply | Threaded
Open this post in threaded view
|

Re: OpenGL 3.2 in OS X 10.7

Sven Gothel
Administrator
On Thursday, July 21, 2011 11:01:30 PM alterscape [via jogamp] wrote:
>
> I would love to see GL 3.2 supported in JOGL2 on OS X -- I actually upgraded
> to Lion on launch day specifically for GL 3.2 in JOGL, not realizing that it
> wouldn't be supported (which is totally my fault, for not checking first).
> Is there a timeline to get this upgraded? I'd like to use the GL 3.2
> features in software I'm building in support of my dissertation.  I will
> take a look at the source and see how challenging it would be to make work,
> but I doubt I'll be much help, and I don't want to duplicate work the team's
> already working on.

Right now we have to finish linux-armv7l-eabi and android-armv7l-eabi
first. A huge workload regarding java/native-type GlueGen code
for data types incl. structs is now checked in and works well.

Current work in progress (wip) mobile branches are
  - gluegen/wip_mobile
  - jogl/wip_mobile

Next steps are JOGL on
  - linux-armv7l-eabi
    - X11, egl/es[12]

  - android-armv7l-eabi
    - android, NEWT + egl/es[12]

So little chance before SIGGRAPH, but after it, sure.

TODO on macosx to make it a 1st citizen again:
  - cocoa, NEWT + GL3

Of course, you or anybody else can do this themselves,
if willing and able to. In such case I am glad to help.
In such case, pls use git, read our wiki/faq, etc.

Cheers, Sven
Reply | Threaded
Open this post in threaded view
|

Re: OpenGL 3.2 in OS X 10.7

Wade Walker
Administrator
In reply to this post by alterscape
It looks like my Mac should support OpenGL 3.2, so maybe I can help with the code. My output of your test program is

Vendor:   NVIDIA Corporation
Renderer: NVIDIA GeForce 320M OpenGL Engine
Version:  3.2 NVIDIA-7.2.9
GLSL:     1.50

which looks good. Let me dig into the setup code a bit more and see what it looks like. If you'd like to look at it too, there are detailed instructions for building on the Mac at http://jogamp.org/wiki/index.php/Building_JOGL_on_the_command_line. Since you've already got Xcode re-installed on Lion, you could build JOGL very easily.

Reply | Threaded
Open this post in threaded view
|

Re: OpenGL 3.2 in OS X 10.7

alterscape
Sven,
  Thank you for the info! I've got xcode installed and am looking over the setup code now, trying to figure out where the assumption re: OpenGL 2.0 is actually made, and what the consequences are. I haven't done very much with JNI, but I am motivated, so we'll see.

Cheers,
Ryan
Reply | Threaded
Open this post in threaded view
|

Re: OpenGL 3.2 in OS X 10.7

Wade Walker
Administrator
It looks like the class MacOSXCGLDrawableFactory is missing some code that would be required to set up a shared context and query the profiles. You might compare it to WindowsWGLDrawableFactory and X11GLXDrawableFactory to see how it differs from platforms that support GL3 and GL4 now.
Reply | Threaded
Open this post in threaded view
|

Re: OpenGL 3.2 in OS X 10.7

Sven Gothel
Administrator
On Friday, July 22, 2011 04:54:49 AM Wade Walker [via jogamp] wrote:
>
> It looks like the class MacOSXCGLDrawableFactory is missing some code that
> would be required to set up a shared context and query the profiles. You
> might compare it to WindowsWGLDrawableFactory and X11GLXDrawableFactory to
> see how it differs from platforms that support GL3 and GL4 now.

In the EGL/X11/WGL GLContextImpl specialization,
we have a new way of ctx creation using the new ARB method
of passing some attributes (version, debug, ..):

  long abstract GLContextImpl.createContextARBImpl(..)

it's documented in GLContextImpl.

Problem: On all platforms, this is done at ctx creation. On OSX,
AFAIK it's done via the drawable / ctx binding. So a bit adaptation might be required.

If impl. properly in MacOSXCGLContext,
all functionality would be available, i.e. upfront query
of avail. versions and capabilities.

~Sven
Reply | Threaded
Open this post in threaded view
|

Re: OpenGL 3.2 in OS X 10.7

Wade Walker
Administrator
I've created bug 508 (https://jogamp.org/bugzilla/show_bug.cgi?id=508) to track this issue -- CC yourself on it to see updates. I'm currently working on applets (getting them working in all Mac browsers, as well as putting up a tutorial on the wiki), but I can take a look at this afterwards if JStoeker, alterscape, or Sven aren't working on it by then.
Reply | Threaded
Open this post in threaded view
|

Re: OpenGL 3.2 in OS X 10.7

Sven Gothel
Administrator
On Saturday, July 23, 2011 02:23:47 AM Wade Walker [via jogamp] wrote:
>
> I've created bug 508 (https://jogamp.org/bugzilla/show_bug.cgi?id=508) to
> track this issue -- CC yourself on it to see updates. I'm currently working
> on applets (getting them working in all Mac browsers, as well as putting up
> a tutorial on the wiki), but I can take a look at this afterwards if
> JStoeker, alterscape, or Sven aren't working on it by then.

Sweet.

Pls make Status CONFIRMED at least, so they are visible in the wiki:
  http://jogamp.org/wiki/index.php/SW_Tracking

UNCONFIRMED is only for new bugs by 'others' .. well, we need to walk through
those sometime, just did it for a few of those - then I stumbled on your new entries.

THANK YOU Wade for doing all this nice work.

~Sven
Reply | Threaded
Open this post in threaded view
|

Re: OpenGL 3.2 in OS X 10.7

Wade Walker
Administrator
OK, I'll start all bugs as "confirmed" from now on.
Reply | Threaded
Open this post in threaded view
|

Re: OpenGL 3.2 in OS X 10.7

alterscape
Hi,
  I haven't had any luck patching JOGL to enable GL3.2 on OS X. Is there any official movement on this front?

Ryan