View previous topic :: View next topic |
Author |
Message |
aldacron
Joined: 05 May 2004 Posts: 1322 Location: Seoul, South Korea
|
Posted: Tue Jan 24, 2012 8:37 am Post subject: DerelictGL3 |
|
|
In a recent post, I announced that I'll be restructuring Derelict and moving it over to github. I also said that I would redo the way OpenGL extensions are loaded. I've made some amount of progress toward that end. DerelictUtil is ported over and I've begun work on a new OpenGL binding, DerelictGL3.
DerelictGL3 is based on the C header, gl3.h, which only includes non-deprecated functionality from the core 3.x+ profiles. I've tried to simplify the loading process from the way it works for DerelictGL in Derelict2. I've also tried to make it more practical for those who aren't using a third-party lib to handle 3.x+ context creation.
First, here's how it will look if you are using a third-party lib(like SDL2 or GLFW3 -- both of which will be supported in Derelict 3) to create a 3.x+ context:
Code: |
import derelict.opengl3.gl3;
// Load the shared library and openGL version 1.1
DerelictGL3.load();
// Create your context with the third party lib
...
// Load all available versions + extensions
GLVersion loadedVersion = DerelictGL3.reload();
|
No more loadClassicVersions, loadModernVersions and loadExtensions. It's all boiled down into these two calls. The process is the same if you are creating your own context, but with an additional call to reload:
Code: |
import derelict.opengl3.gl3;
// Load the shared library and openGL version 1.1
DerelictGL3.load();
// Create a classic style context
...
// Load all available versions + extensions, but ignore the return value.
DerelictGL3.reload();
// Create your 3.x+ context and destroy the old one
...
// Call reload again. This time, you can trust the return value.
GLVersion loadedVersion = DerelictGL3.reload();
|
reload is intended to be called any time you change contexts. But you need to be aware that it will load every version the driver claims to support, regardless of whether or not you have created a 3.x+ context. For this reason and because deprecated functions are not included in the binding, I recommend that you use Derelict 2 if you need to restrict yourself to OpenGL 2.1 or less.
I've still got some more work to do before I create a github repository for this. I want to make sure it all works as expected and also get the new extension loader worked out. Just wanted to throw this out there so everyone can see where my head is. _________________ The One With D | The One With Aldacron | D Bits |
|
Back to top |
|
|
dav1d
Joined: 12 Sep 2011 Posts: 40
|
Posted: Wed Jan 25, 2012 12:07 pm Post subject: |
|
|
Cool, I like this idea.
What about OpenGL 4? |
|
Back to top |
|
|
aldacron
Joined: 05 May 2004 Posts: 1322 Location: Seoul, South Korea
|
Posted: Wed Jan 25, 2012 9:14 pm Post subject: |
|
|
I've implemented support for everything up to the current 4.2. The name 'DerelictGL3' comes from gl3.h. The '3' means '3+'. _________________ The One With D | The One With Aldacron | D Bits |
|
Back to top |
|
|
dav1d
Joined: 12 Sep 2011 Posts: 40
|
Posted: Thu Jan 26, 2012 12:15 am Post subject: |
|
|
Seems like a misleading name, or is it just me? |
|
Back to top |
|
|
aldacron
Joined: 05 May 2004 Posts: 1322 Location: Seoul, South Korea
|
Posted: Thu Jan 26, 2012 1:37 am Post subject: |
|
|
Depends on how you look at it. The traditional gl.h includes prototypes for all of OpenGL up to 4.2, but does not exclude any deprecated functionality. There was a desire to implement a header that ditched the deprecated stuff, so gl3.h was born since it was in the OpenGL 3 series that deprecation was introduced. In other words, there has never been a gl1.h or gl2.h. From that perspective, it makes sense. _________________ The One With D | The One With Aldacron | D Bits |
|
Back to top |
|
|
RuZiggy
Joined: 14 Sep 2008 Posts: 10
|
Posted: Thu Jan 26, 2012 7:59 am Post subject: |
|
|
aldacron, thank you for you work.
But...in Derelict2 as far as I know you've put almost all OpenGL core functions inside a mixin. This makes IDE's autcomplete impossible and useless.
It's so HARD to code this way. Can you please do it in a natural way? xD
I mean, Derelict -- is the only thing I am using D for, and when I need every minute to browse the web (or sources) for function name (and arguments) it's makes me cry :'( |
|
Back to top |
|
|
doob
Joined: 06 Jan 2007 Posts: 367
|
Posted: Thu Jan 26, 2012 2:49 pm Post subject: |
|
|
That was to be able to support both D1 and D2 in the same source file. He's dropping the D1 support, if I understand everything correctly. |
|
Back to top |
|
|
aldacron
Joined: 05 May 2004 Posts: 1322 Location: Seoul, South Korea
|
Posted: Fri Jan 27, 2012 12:57 am Post subject: |
|
|
RuZiggy wrote: | aldacron, thank you for you work.
But...in Derelict2 as far as I know you've put almost all OpenGL core functions inside a mixin. This makes IDE's autcomplete impossible and useless.
It's so HARD to code this way. Can you please do it in a natural way? xD
I mean, Derelict -- is the only thing I am using D for, and when I need every minute to browse the web (or sources) for function name (and arguments) it's makes me cry :'( |
There will be no mixins since I'm dropping support for D1, but you still aren't going to get any autocomplete for function parameters. You're calling function pointers. _________________ The One With D | The One With Aldacron | D Bits |
|
Back to top |
|
|
RuZiggy
Joined: 14 Sep 2008 Posts: 10
|
Posted: Wed Feb 01, 2012 10:56 am Post subject: |
|
|
aldacron wrote: | I'm dropping support for D1 |
:'( |
|
Back to top |
|
|
aldacron
Joined: 05 May 2004 Posts: 1322 Location: Seoul, South Korea
|
Posted: Wed Feb 01, 2012 9:45 pm Post subject: |
|
|
Derelict2 will still be around as long as D1 support is needed. And I do plan to improve the situation with DerelictGL there. I wasn't aware of all of the details surrounding OpenGL 3+ when I initially added support for it. I need to touch things up a bit. As-is, it's potentially broken. _________________ The One With D | The One With Aldacron | D Bits |
|
Back to top |
|
|
bioinfornatics
Joined: 22 Jun 2010 Posts: 90
|
Posted: Thu Feb 02, 2012 3:20 pm Post subject: |
|
|
great
could you add a build system (make by example) for to be able build as shared or static lib
if you choose make file they are a template here who support both
https://github.com/bioinfornatics/MakefileForD |
|
Back to top |
|
|
aldacron
Joined: 05 May 2004 Posts: 1322 Location: Seoul, South Korea
|
|
Back to top |
|
|
|