krisnye's picture

Problem using ES20.GL on Windows with the AMD ES 2.0 Emulator DLL.

I am using:
Windows Vista
Visual Studio 2008
X86 processor

OpenTK is working fine using the standard OpenGL.GL class.

I have installed the AMD Es 2.0 Emulator but I get an exception whenever trying to use the ES20.GL class.
I have copied the libEGL.dll and libGLESv2.dll to the Windows\System32 and the application directory in order to make sure they're available to the application.

I get a NullReferenceException whenever accessing any function because all of the OpenTK.Graphics.ES20.Delegates fields are null.

How/when are these delegates initialized and why aren't they being initialized for me?

Does anyone else have success writing an ES20 sample on windows with the AMD ES 2.0 Emulator?


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
the Fiddler's picture

You can find a sample that has been tested to work with AMD's ES emulator here. (This is also available in the Examples.exe application that ships with OpenTK).

Off-hand, you need to pass the GraphicsContextFlags.Embedded flag to the GraphicsContext constructor before using any ES methods (check the GameWindow constructor in the aforementioned sample). The reason is that ES is initialized using completely different code than regular OpenGL - in other words, ES contexts are not interchangeable with regular GL contexts.

krisnye's picture

I've downloaded that sample, and I can't get it to work.

When using the AMD GL ES 2.0 Emulator I get an error on the line that sets the GL.Viewport. A GraphicsErrorException with "InvalidValue". (I figure this might be because it's not tested with my card which is an nVidia 8400M.

I have downloaded and tried the POWERVR SDK for OpenGL ES 2.0, and their sdk samples work, but I get an error with the above demo when using their DLLs. It fails somewhere inside of EGL.Initialize with an AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.

Anything else I should try or check?

aik6980's picture

same problem here,

I'm using Windows, with the machine mostly same spec as Krisnye
when I tried running ES20 Example mentioned above, I got this exception.


I did also copied libEGL.dll and libGLESv2.dll to the folder

Anything else I should try or check?

the Fiddler's picture

This exception indicates that OpenTK wasn't able to load the ES libraries. You might be missing some dependency or it might be something else entirely - I will try to see if I can reproduce this on my nvidia system.

aik6980's picture

thx! :)

just for addition, i'm using Vistax64.
the system is working fine on the examples that came with the AMD ES Emulator.

the Fiddler's picture

Ah, that changes some things. Make sure you are using the 64bit version of libEGLv2.dll rather than the 32bit one, as the latter will fail to load on a 64bit process (triggering the "platform not supported" exception).

aik6980's picture

Thanks for pointing that out, so I changed the target machine to "x86" and it got pass that exception.

btw, the story still going on, the application throw
System.NullReferenceException' occurred in OpenTK.dll

at GameWindows.cs, where
(glContext as IGraphicsContextInternal).LoadAll();

Thanks in advance

krisnye's picture


I had that same problem before, maybe this will fix if for you:

Make sure that you are passing GraphicsContextFlags.Embedded to the GameWindow constructor and NOT GraphicsContextFlags.Default.

Also make sure the MajorVersion is 2.0 and the MinorVersion is 0.0.

aik6980's picture

Thks for your answer Krisnye,

GraphicsContextFlags.Embedded , and [2,0] are passed correctly at the very first place.
Unfortunately still doesn't work :(

Do I have to copy the "libGLESv2.lib" and "libEGL.lib" to anywhere specific?
Or only the DLLs, regarding to ES20 is enough? (to the target Dir, and system Dir)

Thanks again!

the Fiddler's picture

The stacktrace for the NullReferenceException would be very useful in debugging this error.