LWJGL Forum

Programming => Lightweight Java Gaming Library => Topic started by: kKdH on August 12, 2012, 12:31:04

Title: OpenGL 3.2 on Mac OS X 10.8
Post by: kKdH on August 12, 2012, 12:31:04
I want to use OpenGL 3.2 features (e.g. VAOs) on Mac OS X 10.8. But i don't get a 3.2 context. The following lines...


PixelFormat pixelFormat = new PixelFormat();

ContextAttribs contextAtrributes = new ContextAttribs(3, 2);
contextAtrributes.withProfileCompatibility(false);
contextAtrributes.withProfileCore(true);

Display.setDisplayMode(new DisplayMode(width, height));
Display.create(pixelFormat, contextAtrributes);

System.out.println("OS name " + System.getProperty("os.name"));
System.out.println("OS version " + System.getProperty("os.version"));
System.out.println("LWJGL version " + org.lwjgl.Sys.getVersion());
System.out.println("OpenGL version " + glGetString(GL_VERSION));


result in:

OS name Mac OS X
OS version 10.8
LWJGL version 2.8.4
OpenGL version 2.1 NVIDIA-8.0.51


What is the reason why i can't use 3.2? Due to http://lwjgl.org/forum/index.php/topic,4071.0.html (http://lwjgl.org/forum/index.php/topic,4071.0.html) support for OpenGL 3.2 was added.

Thanks very much...
Title: Re: OpenGL 3.2 on Mac OS X 10.8
Post by: kappa on August 12, 2012, 13:57:53
simply passing the following context attribs should work:

new ContextAttribs(3, 2).withProfileCore(true)
Title: Re: OpenGL 3.2 on Mac OS X 10.8
Post by: kKdH on August 12, 2012, 14:27:16
Thanks for your answer, it works very well but i'm confused.  ???

What is the difference between:

[...]
ContextAttribs contextAtrributes = new ContextAttribs(3, 2).withProfileCore(true);
[...]
Display.create(pixelFormat, contextAtrributes);
[...]


and:

[...]
ContextAttribs contextAtrributes = new ContextAttribs(3, 2);
contextAtrributes.withProfileCore(true);
[...]
Display.create(pixelFormat, contextAtrributes);
[...]


Why does the second approach not work?
Title: Re: OpenGL 3.2 on Mac OS X 10.8
Post by: spasi on August 12, 2012, 15:41:38
ContextAttribs is an immutable class. Every time you call a with<Whatever> method, a new instance is returned.
Title: Re: OpenGL 3.2 on Mac OS X 10.8
Post by: princec on August 12, 2012, 22:39:59
Can't help but thinking all this part of the API is a bit ... confusing.

Cas :)
Title: Re: OpenGL 3.2 on Mac OS X 10.8
Post by: kKdH on August 13, 2012, 05:35:58
Thank you for your speedy assistance!  :)