Any chance openglsurface with be updated...

to a more modern implementation of OpenGL? It’s currently only using v1.x according to the Language Reference

from wikipedia (http://en.wikipedia.org/wiki/OpenGL)
OpenGL 2.0 Release Date: September 7, 2004
OpenGL 2.1 Release Date: July 2, 2006
OpenGL 3.0 Release Date: August 11, 2008
OpenGL 3.1 Release Date: March 24, 2009
OpenGL 3.2 Release Date: August 3, 2009
OpenGL 3.3 Release Date: March 11, 2010 (I believe that this is the version that comes installed with OSX Mavericks)
.
.
.
currently sitting at OpenGL 4.4 Release Date: July 22, 2013

The OpenGLSurface control itself is, as far as I remember, agnostic to the version of OpenGL used. It simply is responsible for hosting the platform’s OpenGL context inside of the Xojo control hierarchy.

The OpenGL module is simply a large number of declares to the system’s OpenGL library. The functions in those libraries have platform-independent names and parameter types, so all that varies is the specific library name declared against. To use a newer version of OpenGL functions, you can perform those declares yourself.

You can use the OpenGLSurface with any OpenGL version/profile you want, granted your system support it.

But you have to configure the surface yourself, using the Configure event (plus other Methods on Windows). This is platform dependent though, on Mac OS X you just have to provide the right list of attributes, on Windows it’s a little bit more tricky.

The OpenGL module itself is kind of odd as even some functions from OpenGL v1.x are missing. So you will have to add the right Declare, and dynamic bindings for greater OpenGL versions and Extensions (through Delegates).

FYI, I’m working on the ‘XOpenGL’ toolkit that will be soon available which can create module(s) with Declares plus dynamic bindings for any OpenGL version/profile/extension(s) combination you choose - directly from the Khronos registry - and provide an easy to configure XOpenGLSurface. More on this soon.

Cheers,
Guy.

Could you elaborate a bit on what’d need to do on Windows? I know on OS X you have to use the Configure event to set the NSOpenGLPFAOpenGLProfile attribute with the appropriate value. Here’s an untested example of what would go in the Configure event for OS X:

[code]Const NSOpenGLPFAOpenGLProfile = 99
Const NSOpenGLProfileVersion3_2Core = &h0x3200

Dim result As New MemoryBlock(8)
result.Int32(0) = NSOpenGLPFAOpenGLProfile
result.Int32(4) = NSOpenGLProfileVersion3_2Core
Return result[/code]

Well, on Windows you first have to create an OpenGL Context in order to have access to the extended functions (WGL) that will allow you to create an ‘advanced’ OpenGL Context, that is with a choice of the OpenGL Version and Profile (Compatibility/Core) you want.

In the Configure event, no OpenGL context exist yet, so you have to proceed ones the Context is created.

[quote=79354:@Guy Rabiller]Well, on Windows you first have to create an OpenGL Context in order to have access to the extended functions (WGL) that will allow you to create an ‘advanced’ OpenGL Context, that is with a choice of the OpenGL Version and Profile (Compatibility/Core) you want.

In the Configure event, no OpenGL context exist yet, so you have to proceed ones the Context is created.[/quote]

Ah, I see. It seems that wglCreateContextAttribsARB, which is documented only on the OpenGL’s wgl_create_context spec and not MSDN, is the required function to use.

Yes, basically you’ll need wglGetPixelFormatAttribivARB, wglCreateContextAttribsARB and wglChoosePixelFormatARB.