OpenGL ES2 support on Windows

Hey everyone, just wanted to mention that I’ve added OpenGL ES2 support on
Windows, making ES2 the first graphics standard to be supported by SDL
across the five main platforms.

On systems with driver support (recent nVidia drivers, some Intel system
AFAIK) you should get straight up ES2 context managed with WGL. Where
driver support is not available, SDL will try using ANGLE, which simulates
ES2 using Direct3D 9,. Binaries for ANGLE ship with Chrome/Chromium, or can
be compiled from source.

Enjoy!–
Gabriel.

Awesome!

Modern AMD GPUs advertise the ES2 entry points via the
ARB_ES2_compatibility extension, but do not ship EGL in the regular
drivers. You can use WGL to create a desktop context and access the ES2
entry points, or you can download a separate driver package with EGL.

My Intel Sandy Bridge (2000HD) with up-to-date drivers refuses to give me
either EGL or ARB_ES2_compatibility (maybe newer IGPs will fare better.)
ANGLE works fine.

2013/11/22 Gabriel Jacobo > Hey everyone, just wanted to mention that I’ve added OpenGL ES2 support on

Windows, making ES2 the first graphics standard to be supported by SDL
across the five main platforms.

On systems with driver support (recent nVidia drivers, some Intel system
AFAIK) you should get straight up ES2 context managed with WGL. Where
driver support is not available, SDL will try using ANGLE, which simulates
ES2 using Direct3D 9,. Binaries for ANGLE ship with Chrome/Chromium, or can
be compiled from source.

Enjoy!


Gabriel.


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

The ARB_ES2_compatibility[1] extension for desktop OpenGL is not a way to get OpenGL ES 2 on desktops, it just adds some (but not all) exclusive features of ES2 back into desktop OpenGL to make porting code simpler. The features of the extension are part of core desktop OpenGL since version 4.1, although some drivers will implement the features via the extension for GPUs which don?t support GL4+.

[1]: http://www.opengl.org/registry/specs/ARB/ES2_compatibility.txtOn Nov 22, 2013, at 1:42 PM, Stefanos A. wrote:

Awesome!

Modern AMD GPUs advertise the ES2 entry points via the ARB_ES2_compatibility extension, but do not ship EGL in the regular drivers. You can use WGL to create a desktop context and access the ES2 entry points, or you can download a separate driver package with EGL.

My Intel Sandy Bridge (2000HD) with up-to-date drivers refuses to give me either EGL or ARB_ES2_compatibility (maybe newer IGPs will fare better.) ANGLE works fine.

2013/11/22 Gabriel Jacobo
Hey everyone, just wanted to mention that I’ve added OpenGL ES2 support on Windows, making ES2 the first graphics standard to be supported by SDL across the five main platforms.

On systems with driver support (recent nVidia drivers, some Intel system AFAIK) you should get straight up ES2 context managed with WGL. Where driver support is not available, SDL will try using ANGLE, which simulates ES2 using Direct3D 9,. Binaries for ANGLE ship with Chrome/Chromium, or can be compiled from source.

Enjoy!


Gabriel.


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Gabriel Jacobo wrote:

Enjoy!

Excellent!

I don’t have NVIDIA, Intel or ANGLE so I went with the AMD OpenGL ES
SDK. Worked beautifully.

The ANGLE workaround for WIN_GLES_SetSwapInterval gets in the way
though. Does ANGLE have some unique vendor string that could be used
to enable the workaround?

Thanks for your work on this.

2013/11/23 Norfanin

Gabriel Jacobo wrote:

Enjoy!

Excellent!

I don’t have NVIDIA, Intel or ANGLE so I went with the AMD OpenGL ES
SDK. Worked beautifully.

The ANGLE workaround for WIN_GLES_SetSwapInterval gets in the way
though. Does ANGLE have some unique vendor string that could be used
to enable the workaround?

Thanks for your work on this.

Yeah, it might be worth looking into a way to detect if we are dealing with
ANGLE or a real EGL implementation, or at least have a hint to disable the
workaround.–
Gabriel.

gabomdq wrote:

2013/11/23 Norfanin <norfanin at gmail.com (norfanin at gmail.com)>

Gabriel Jacobo wrote:

Enjoy!

Excellent!

I don’t have NVIDIA, Intel or ANGLE so I went with the AMD OpenGL ES
SDK. Worked beautifully.

The ANGLE workaround for WIN_GLES_SetSwapInterval gets in the way
though. Does ANGLE have some unique vendor string that could be used
to enable the workaround?

Thanks for your work on this.

?
Yeah, it might be worth looking into a way to detect if we are dealing with ANGLE or a real EGL implementation, or at least have a hint to disable the workaround.


Gabriel.

Could you please provide minimal GL ES2 code for Windows? I am getting unresolved externals to glClear, glClearColor, glGetString and glViewport from SDL_main. Does SDL have to be compiled in different way to add ES support? I am trying to make it work with ANGLE

2014/1/23 slimshader <szymon.gatner at gmail.com>

gabomdq wrote:

2013/11/23 Norfanin <>

Quote:

Gabriel Jacobo wrote:

Quote:

Enjoy!

Excellent!

I don’t have NVIDIA, Intel or ANGLE so I went with the AMD OpenGL ES
SDK. Worked beautifully.

The ANGLE workaround for WIN_GLES_SetSwapInterval gets in the way
though. Does ANGLE have some unique vendor string that could be used
to enable the workaround?

Thanks for your work on this.

Yeah, it might be worth looking into a way to detect if we are dealing
with ANGLE or a real EGL implementation, or at least have a hint to disable
the workaround.


Gabriel.

Could you please provide minimal GL ES2 code for Windows? I am getting
unresolved externals to glClear, glClearColor, glGetString and glViewport
from SDL_main. Does SDL have to be compiled in different way to add ES
support? I am trying to make it work with ANGLE

You don’t need to do anything in particular…are you getting those errors
from your own project? Are you using Visual Studio? Which version? I only
updated the projects correctly for VS2013 as I don’t have the others and
for those I just changed the XML without being able to verify them.

Anyway, those symbols come from the GL library, you either need to link to
it (see ANGLE’s recommendations on how to set that up), or
SDL_LoadObject/SDL_LoadFunction the functions that you need (see
test/testgles2.c for an example of this), which can be a bit more involved
to set up (or you can just rip the functionality from inside SDL’s ES2
render code, or use a 3rd party library), but it’s easier to work with in
the end (and cross platform!).–
Gabriel.

gabomdq wrote:

You don’t need to do anything in particular…are you getting those errors from your own project? Are you using Visual Studio? Which version? I only updated the projects correctly for VS2013 as I don’t have the others and for those I just changed the XML without being able to verify them.

Anyway, those symbols come from the GL library, you either need to link to it (see ANGLE’s recommendations on how to set that up), or SDL_LoadObject/SDL_LoadFunction the functions that you need (see test/testgles2.c for an example of this), which can be a bit more involved to set up (or you can just rip the functionality from inside SDL’s ES2 render code, or use a 3rd party library), but it’s easier to work with in the end (and cross platform!).

Visual Studio 2012, own clear project. For example, do I include sdl_opengl.h or sdl_opengles2.h? If SDL uses GL functions explicitly (glColor etc) then I can’t do much about it can I? GL ES does not have those so linking to ANGLE will not help

2014/1/23 slimshader <szymon.gatner at gmail.com>

gabomdq wrote:

You don’t need to do anything in particular…are you getting those errors
from your own project? Are you using Visual Studio? Which version? I only
updated the projects correctly for VS2013 as I don’t have the others and
for those I just changed the XML without being able to verify them.

Anyway, those symbols come from the GL library, you either need to link to
it (see ANGLE’s recommendations on how to set that up), or
SDL_LoadObject/SDL_LoadFunction the functions that you need (see
test/testgles2.c for an example of this), which can be a bit more involved
to set up (or you can just rip the functionality from inside SDL’s ES2
render code, or use a 3rd party library), but it’s easier to work with in
the end (and cross platform!).

Visual Studio 2012, own clear project. For example, do I include
sdl_opengl.h or sdl_opengles2.h? If SDL uses GL functions explicitly
(glColor etc) then I can’t do much about it can I? GL ES does not have
those so linking to ANGLE will not help

If you want to use GLES2, include SDL_openles2.h

SDL, by design, does not require linking to OpenGL libraries (regular or
ES). You can try out the testgles2 project (which sadly right now is only
present in the VS2013 projects) to try the GL ES2 functionality on Windows.–
Gabriel.

glClearColor and glClearDepth and glDepthRange are different in GLES, they have an f added on to the end of the function name.

I.E. glClearColorf, glClearDepthf, and glDepthRangef.

This is the only case of GL and GLES having different function names.

They are float on GLES for performance reasons (mobile hardware) rather than double precision on GL (which on common PC hardware has to be converted to float for use anyway).On 01/23/2014 11:43 AM, slimshader wrote:

gabomdq wrote:

You don’t need to do anything in particular…are you getting those errors from your own project? Are you using Visual Studio? Which version? I only updated the projects correctly for VS2013 as I
don’t have the others and for those I just changed the XML without being able to verify them.

Anyway, those symbols come from the GL library, you either need to link to it (see ANGLE’s recommendations on how to set that up), or SDL_LoadObject/SDL_LoadFunction the functions that you need (see
test/testgles2.c for an example of this), which can be a bit more involved to set up (or you can just rip the functionality from inside SDL’s ES2 render code, or use a 3rd party library), but it’s
easier to work with in the end (and cross platform!).

Visual Studio 2012, own clear project. For example, do I include sdl_opengl.h or sdl_opengles2.h? If SDL uses GL functions explicitly (glColor etc) then I can’t do much about it can I? GL ES does not
have those so linking to ANGLE will not help


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


LordHavoc
Author of DarkPlaces Quake1 engine - http://icculus.org/twilight/darkplaces
Co-designer of Nexuiz - http://alientrap.org/nexuiz
"War does not prove who is right, it proves who is left." - Unknown
"Any sufficiently advanced technology is indistinguishable from a rigged demo." - James Klass
"A game is a series of interesting choices." - Sid Meier

gabomdq wrote:

2014/1/23 slimshader <@slimshader (@slimshader)>

gabomdq wrote:

You don’t need to do anything in particular…are you getting those errors from your own project? Are you using Visual Studio? Which version? I only updated the projects correctly for VS2013 as I don’t have the others and for those I just changed the XML without being able to verify them.

Anyway, those symbols come from the GL library, you either need to link to it (see ANGLE’s recommendations on how to set that up), or SDL_LoadObject/SDL_LoadFunction the functions that you need (see test/testgles2.c for an example of this), which can be a bit more involved to set up (or you can just rip the functionality from inside SDL’s ES2 render code, or use a 3rd party library), but it’s easier to work with in the end (and cross platform!).

Visual Studio 2012, own clear project. For example, do I include sdl_opengl.h or sdl_opengles2.h? If SDL uses GL functions explicitly (glColor etc) then I can’t do much about it can I? GL ES does not have those so linking to ANGLE will not help

If you want to use GLES2, include SDL_openles2.h

SDL, by design, does not require linking to OpenGL libraries (regular or ES). You can try out the testgles2 project (which sadly right now is only present in the VS2013 projects) to try the GL ES2 functionality on Windows.


Gabriel.

OK, I think it worked (I just took testgles2.c and copy-pased it to testgl and removed a define disabling code for Windows) :slight_smile:

Everything renders fine so I assume my driver is able to create GL ES context. How do I force ANGLE usage?

I mean: is there a way to tell SDL to try-load libGLESv2.dll even if video driver supports WGL_EXT_create_context_es2_profile extension?

slimshader wrote:>

gabomdq wrote:

2014/1/23 slimshader <@slimshader (@slimshader)>

gabomdq wrote:

You don’t need to do anything in particular…are you getting those errors from your own project? Are you using Visual Studio? Which version? I only updated the projects correctly for VS2013 as I don’t have the others and for those I just changed the XML without being able to verify them.

Anyway, those symbols come from the GL library, you either need to link to it (see ANGLE’s recommendations on how to set that up), or SDL_LoadObject/SDL_LoadFunction the functions that you need (see test/testgles2.c for an example of this), which can be a bit more involved to set up (or you can just rip the functionality from inside SDL’s ES2 render code, or use a 3rd party library), but it’s easier to work with in the end (and cross platform!).

Visual Studio 2012, own clear project. For example, do I include sdl_opengl.h or sdl_opengles2.h? If SDL uses GL functions explicitly (glColor etc) then I can’t do much about it can I? GL ES does not have those so linking to ANGLE will not help

If you want to use GLES2, include SDL_openles2.h

SDL, by design, does not require linking to OpenGL libraries (regular or ES). You can try out the testgles2 project (which sadly right now is only present in the VS2013 projects) to try the GL ES2 functionality on Windows.


Gabriel.

OK, I think it worked (I just took testgles2.c and copy-pased it to testgl and removed a define disabling code for Windows) :slight_smile:

Everything renders fine so I assume my driver is able to create GL ES context. How do I force ANGLE usage?

2014/1/24 slimshader <szymon.gatner at gmail.com>

I mean: is there a way to tell SDL to try-load libGLESv2.dll even if
video driver supports WGL_EXT_create_context_es2_profile extension?

No, there’s not. It would be somewhat useful for development, but right now
you have to edit SDL_windowsopengl.c, line 401:

_this->gl_data->HAS_WGL_EXT_create_context_es2_profile = SDL_TRUE;–
Gabriel.

gabomdq wrote:

2014/1/24 slimshader <@slimshader (@slimshader)>

No, there’s not. It would be somewhat useful for development, but right now you have to edit SDL_windowsopengl.c, line 401:

_this->gl_data->HAS_WGL_EXT_create_context_es2_profile = SDL_TRUE;

–?

Gabriel.

It works! Thanks for the assistance.