Cannot get Derelict to work
Mike Parker via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sun Feb 7 06:04:49 PST 2016
On Sunday, 7 February 2016 at 12:55:30 UTC, Whirlpool wrote:
> Is it the same kind of problem as before ? If my understanding
> is correct [1], I need to link with the OpenGL DLL, don't I ? I
> found that I have an opengl32.dll file in C:\Windows\System32,
> and tried adding the path to it in the linker configuration of
No, you do not need to link with OpenGL. As the documentation
link you provided explains, Derelict bindings are all dynamic, so
there is no link time dependency on the bound library. It's all
runtime, which is why you have to call DerelictFoo.load.
> I am aware that this example from GLFW uses deprecated
> functions from OpenGL 2, is that the problem ? (I will try
> OpenGL 4 with the tutorials at [2] soon)
>
The problem is right there in the exception you posted. That's
what exceptions are for.
> First-chance exception:
> derelict.util.exception.SymbolLoadException Failed to load
> OpenGL symbol [glGetnTexImage] at
> ..\AppData\Roaming\dub\packages\derelict-util-2.0.4\source\derelict\util\exception.d(35)
You can see the exception thrown is a
derelict.util.exception.SymbolLoadException. As explained in the
Derelict documentation on load failures [1], this is thrown when
a symbol cannot be found in a DLL. It means that the loader found
the DLL just fine, but a function it expected to find wasn't
there. Here, that function is glGetnTexImage. So it has nothing
to do with your code, but is a problem in the DLL.
Normally, this means that you're trying to load version of a DLL
that is older than the binding you are using. However, OpenGL is
a special case, which is why it has the reload method. It will
only attempt to load the version of OpenGL supported by your
driver. This means that if it doesn't find a function it expects,
then either your driver is lying or DerelictGL3 is broken.
glGetnTexImage is part of the OpenGL 4.5 specification. I'm going
to make a guess that you are using an AMD (formerly ATI) card.
There is an open issue in the Derelict repo regarding their
latest drivers and 4.5 support [2]. It's not the first time it's
been reported to me. It seems the driver claims to support 4.5,
but some of the 4.5 functions fail to load. The way to work
around this is to specify a maximum OpenGL version as the second
of two arguments in the call to reload.
```
DerelictGL3.reload(GLVersion.None, GLVersion.GL44);
```
The first argument is the minimum version to load, which always
defaults to None. In effect, this says load everything from 1.2
(1.1 is loaded in the call to DerelictGL3.load) up to the highest
version the driver supports or up to 4.4, whichever is lower.
This line should be enough to work around the AMD driver issue.
Another point to make is that if you need deprecated functions,
DerelictGL3 is not what you want. You should import
derelict.opengl3.gl and use DerelictGL.load/reload instead. It
includes all of the deprecated functions. Just make sure you have
created a context that allows you to access the deprecated stuff.
As far as I know, 4.0+ (perhaps even 3.3) are core only. Note
that you *do not* need to load both DerelictGL3 and DerelictGL,
as the latter handles everything for you.
[1] http://derelictorg.github.io/using/fail.html
[2] https://github.com/DerelictOrg/DerelictGL3/issues/43
[3]
https://github.com/DerelictOrg/DerelictGL3/blob/master/source/derelict/opengl3/gl3.d#L80
More information about the Digitalmars-d-learn
mailing list