OpenGL 3.0 support and new features

Started by spasi, August 19, 2008, 18:06:38

Previous topic - Next topic

spasi

Hello LWJGL users,

A bunch of new features has just been committed to the LWJGL SVN, including full OpenGL 3.0 support. The list:

- OpenGL 3.0 support (new context creation and sharing, new extension detection, all GL30 core functionality).
- OpenGL 3.0 extensions (ARB_draw_instanced, ARB_geometry_shader4, ARB_texture_buffer_object).
- Support for FORWARD_COMPATIBLE mode. This includes a "pseudo-FORWARD_COMPATIBLE" mode even for OpenGL versions prior to 3.0, so that developers can start cleaning up their codebases without GL30 compliant contexts.
- OpenGL 2.1 extensions (ARB_framebuffer_object, ARB_half_float_vertex, ARB_framebuffer_sRGB, ARB_map_buffer_range, ARB_texture_compression_rgtc, ARB_vertex_array_object, ARB_texture_rg, ARB_instanced_arrays).
- Support for packed floating point (EXT_packed_float) and sRGB (ARB_framebuffer_sRGB) PixelFormats.
- Support for EXT_direct_state_access.

The new ContextAttribs class encapsulates the information necessary to use the new context creation. Some examples:

// Create a normal context
Display.create(format);

// Create an OpenGL 2.1 context
Display.create(format, new ContextAttribs(2, 1));

// Create an OpenGL 3.0 context
Display.create(format, new ContextAttribs(3, 0));

// Create an OpenGL 3.0 context with forward compatible mode enabled.
Display.create(format, new ContextAttribs(3, 0).withForwardCompatible(true));

// Create an OpenGL 2.1 context with forward compatible mode (!) enabled.
// This is the "pseudo-FORWARD_COMPATIBLE" mode. It will fail with a GL30 compliant driver, but is useful for testing with older drivers.
// Note that this only removes deprecated functions, deprecated tokens used in non-deprecated functions will work normally.
Display.create(format, new ContextAttribs(2, 1).withForwardCompatible(true));


The PixelFormat class has been changed a bit. The old constructors are there for backwards compatibility, but if you want to use the new features there are a bunch of new withXXX methods to call, like this:

// Fixed-point format with sRGB
new PixelFormat(0, 24, 0).withSRGB(true);

// Floating-point format
new PixelFormat(0, 24, 0).withFloatingPoint(true);

// Pack floating-point format
new PixelFormat(0, 24, 0).withFloatingPointPacked(true);

// Floating-point format with sRGB
new PixelFormat(0, 24, 0).withFloatingPointPacked(true).withSRGB(true);


Knowns issues:

- OpenGL 3.0 context creation currently works on the windows platform only. Waiting for the GLX extension to add support for Linux. The pseudo-FORWARD_COMPATIBLE mode works though.
- Packed floating point and sRGB PixelFormats aren't supported on MacOSX.

Enjoy! :)

elias

Great work! I like the with* methods on PixelFormat and ContextAttribs, the existing PixelFormat constructors were quite clumsy.

- elias

princec

Blimey, you don't sleep at all do you!

Cas :)

kappa

Wow, great job, that update must be some sort of record, OpenGL 3.0 spec was only released a week ago.

bobjob

very cool.

will the update be added to LWJGL 1 or 2?

Matzon

Quote from: bobjob on August 20, 2008, 02:08:32
very cool.

will the update be added to LWJGL 1 or 2?
lwjgl 2, even though we're at RC1 mode  ::)

Fool Running

Programmers will, one day, rule the world... and the world won't notice until its too late.Just testing the marquee option ;D