# How to compile with OpenGL ES on Windows?

But when I tried to run (or compile and run) the executable in "samples" directory, I got the following message:

The program can't start because libGLESv2.dll is missing from your computer. Try reinstalling the program to fix the problem.

This sounds strange, because the sample program is directly linked with libGLESv2.lib, so it shouldn't even look for dll files.

But when I wanted to install dll files (libGLESv2.dll and libEGL.dll), I got the following error:

regsvr32 libGLESv2.dll


Make sure that "libGLESv2.dll" is a valid DLL or OCX file and try again.

So it looks like these dll files are kind of invalid.

Is the problem from my dll files? Or did I miss something in installation process?

• The problem you're having is that OpenGL is an API - it basically says "people of the world, it is your job to give other people OpenGL - here are the functions you must define" and your GPU drivers implement it. There's VERY LITTLE motivation for a desktop GPU to do ES stuff and Nvidia/AMD and co are not going to bother implementing it given nobody 'cept 15 people want it. I looked at Mesa's software renderer, then gave up because I didn't want to change my system. – Alec Teal Sep 21 '15 at 12:15
• What happens if you copy the dll into the folder where your program is being run? – SurvivalMachine Sep 21 '15 at 12:16
• i.imgur.com/VTwoXHR.png picture 1 (with the "fragment shader" code behind) i.imgur.com/2QDp5mc.png picture 2 - light at a different angle with the vertex shader behind. – Alec Teal Sep 21 '15 at 12:23

It seems like you're having several points where you're confused, so I'll go one by one:

• Not all LIB files are self contained. It depends on how the DLL is compiled and linked, but it is possible, and very common for some LIB files to simply contain stubs to the necessary functionality, which is provided by a DLL. This seems to be the case.

• The error as you see it, tells you everything you need to know. The DLL file cannot be found by Windows. The places where Windows looks for DLLs is not trivial, but if you want to make sure a specific DLL is loaded with your program, your best bet is to put the DLL file in the same folder as the executable file.

• Make sure you use a DLL with the same architecture (32-bit or 64-bit) as the target program. In the case of the sample you sent, the executable is 32-bit, so copy both libGLESv2.dll and libEGL.dll into the folder which has GLESSample.exe.

• regsvr is meant to register COM components, so in this case it is completely unrelated.

Once you copy the program, it runs, but then, at least in my PC, it ends with an "Failed to link program" error. This is an OpenGL error, so this most likely means that there are no OpenGL-ES drivers in my computer.

As you know, OpenGL-ES is a subset of OpenGL, meant for mobile devices. If there are OpenGL-ES drivers for my video card, I would have to install them to get it to run. The steps to get this to work are dependent on the video card vendor, and it seems that these samples are meant for AMD Radeon™ HD, AMD Mobility Radeon™ HD, and AMD FirePro™ graphics cards.

• The second solutions worked. I put the library in my program execution folder, and it finally ran. So do I have to put dll libraries with my binary if I publish my game ? libEGL.dll and libGLESv2.dll have a total size of 143ko (for 32-bit, a little more for 64-bit), it doesn't look very heavy. – Aracthor Sep 22 '15 at 1:45
• Glad to know it worked. If you plan on using those dlls, then yes, you would have to include them in your distribution. – Panda Pajama Sep 22 '15 at 13:31

I suggest you save yourself a lot of pain and grab the ARM Mali OpenGL ES Emulator, or the PowerVR Graphics SDK v3.3. This way you will be ready to roll in minutes. This of course assumes that you do not need your ES setup to run natively on Windows machines, e.g. when your game goes to market.

If you do need to the code to run natively on Windows, you could look at Google Angle (difficult) which translates GL calls into DirectX calls on the fly, or use the full OpenGL ES 2.0 API available under desktop OpenGL 4 (though I assume you specifically want the GLES 3.0 API, so these options may not help). I've done the latter and it works fine.