OpenGL ES support for Windows

This commit is contained in:
Gabriel Jacobo 2013-11-22 13:24:53 -03:00
parent 45dbff2ee4
commit 61959aa67b
32 changed files with 6741 additions and 1210 deletions

42
README-windows.txt Normal file
View File

@ -0,0 +1,42 @@
================================================================================
Simple DirectMedia Layer for Windows
================================================================================
================================================================================
OpenGL ES 2.x support
================================================================================
SDL has support for OpenGL ES 2.x under Windows via two alternative
implementations.
The most straightforward method consists in running your app in a system with
a graphic card paired with a relatively recent (as of November of 2013) driver
which supports the WGL_EXT_create_context_es2_profile extension. Vendors known
to ship said extension on Windows currently include nVidia and Intel.
The other method involves using the ANGLE library (https://code.google.com/p/angleproject/)
If an OpenGL ES 2.x context is requested and no WGL_EXT_create_context_es2_profile
extension is found, SDL will try to load the libEGL.dll library provided by
ANGLE.
To obtain the ANGLE binaries, you can either compile from source from
https://chromium.googlesource.com/angle/angle or copy the relevant binaries from
a recent Chrome/Chromium install for Windows. The files you need are:
* libEGL.dll
* libGLESv2.dll
* d3dcompiler_46.dll (supports Windows Vista or later, better shader compiler)
or...
* d3dcompiler_43.dll (supports Windows XP or later)
If you compile ANGLE from source, you can configure it so it does not need the
d3dcompiler_* DLL at all (for details on this, see their documentation).
However, by default SDL will try to preload the d3dcompiler_46.dll to
comply with ANGLE's requirements. If you wish SDL to preload d3dcompiler_43.dll (to
support Windows XP) or to skip this step at all, you can use the
SDL_VIDEO_WIN_D3DCOMPILER hint (see SDL_hints.h for more details).
Known Bugs:
* SDL_GL_SetSwapInterval is currently a no op when using ANGLE. It appears
that there's a bug in the library which prevents the window contents from
refreshing if this is set to anything other than the default value.

View File

@ -415,6 +415,18 @@
RelativePath="..\..\include\SDL_cpuinfo.h" RelativePath="..\..\include\SDL_cpuinfo.h"
> >
</File> </File>
<File
RelativePath="..\..\include\\SDL_egl.h"
>
</File>
<File
RelativePath="..\..\src\video\sdl_egl_c.h"
>
</File>
<File
RelativePath="..\..\src\video\windows\SDL_windowsopengles.h"
>
</File>
<File <File
RelativePath="..\..\include\SDL_endian.h" RelativePath="..\..\include\SDL_endian.h"
> >
@ -1272,6 +1284,22 @@
RelativePath="..\..\src\video\windows\SDL_windowsopengl.c" RelativePath="..\..\src\video\windows\SDL_windowsopengl.c"
> >
</File> </File>
<File
RelativePath="..\..\src\render\opengles2\SDL_render_gles2.c"
>
</File>
<File
RelativePath="..\..\src\render\opengles2\SDL_shaders_gles2.c"
>
</File>
<File
RelativePath="..\..\src\video\SDL_egl.c"
>
</File>
<File
RelativePath="..\..\src\video\windows\SDL_windowsopengles.c"
>
</File>
<File <File
RelativePath="..\..\src\video\windows\SDL_windowsopengl.h" RelativePath="..\..\src\video\windows\SDL_windowsopengl.h"
> >

View File

@ -553,6 +553,9 @@
<ClInclude Include="..\..\src\events\SDL_windowevents_c.h" /> <ClInclude Include="..\..\src\events\SDL_windowevents_c.h" />
<ClInclude Include="..\..\src\video\windows\wmmsg.h" /> <ClInclude Include="..\..\src\video\windows\wmmsg.h" />
<ClInclude Include="resource.h" /> <ClInclude Include="resource.h" />
<ClInclude Include="..\..\include\SDL_egl.h" />
<ClInclude Include="..\..\src\video\sdl_egl_c.h" />
<ClInclude Include="..\..\src\video\windows\SDL_windowsopengles.h" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="..\..\src\core\windows\SDL_windows.c" /> <ClCompile Include="..\..\src\core\windows\SDL_windows.c" />
@ -669,6 +672,10 @@
<ClCompile Include="..\..\src\video\windows\SDL_windowsvideo.c" /> <ClCompile Include="..\..\src\video\windows\SDL_windowsvideo.c" />
<ClCompile Include="..\..\src\video\windows\SDL_windowswindow.c" /> <ClCompile Include="..\..\src\video\windows\SDL_windowswindow.c" />
<ClCompile Include="..\..\src\events\SDL_windowevents.c" /> <ClCompile Include="..\..\src\events\SDL_windowevents.c" />
<ClCompile Include="..\..\src\render\opengles2\SDL_render_gles2.c" />
<ClCompile Include="..\..\src\render\opengles2\SDL_shaders_gles2.c" />
<ClCompile Include="..\..\src\video\SDL_egl.c" />
<ClCompile Include="..\..\src\video\windows\SDL_windowsopengles.c" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ResourceCompile Include="..\..\src\main\windows\version.rc" /> <ResourceCompile Include="..\..\src\main\windows\version.rc" />

View File

@ -344,6 +344,9 @@
<ClInclude Include="..\..\src\events\SDL_windowevents_c.h" /> <ClInclude Include="..\..\src\events\SDL_windowevents_c.h" />
<ClInclude Include="..\..\src\video\windows\wmmsg.h" /> <ClInclude Include="..\..\src\video\windows\wmmsg.h" />
<ClInclude Include="resource.h" /> <ClInclude Include="resource.h" />
<ClInclude Include="..\..\include\SDL_egl.h" />
<ClInclude Include="..\..\src\video\sdl_egl_c.h" />
<ClInclude Include="..\..\src\video\windows\SDL_windowsopengles.h" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="..\..\src\core\windows\SDL_windows.c" /> <ClCompile Include="..\..\src\core\windows\SDL_windows.c" />
@ -460,6 +463,10 @@
<ClCompile Include="..\..\src\video\windows\SDL_windowswindow.c" /> <ClCompile Include="..\..\src\video\windows\SDL_windowswindow.c" />
<ClCompile Include="..\..\src\events\SDL_windowevents.c" /> <ClCompile Include="..\..\src\events\SDL_windowevents.c" />
<ClCompile Include="..\..\src\joystick\SDL_gamecontroller.c" /> <ClCompile Include="..\..\src\joystick\SDL_gamecontroller.c" />
<ClCompile Include="..\..\src\render\opengles2\SDL_render_gles2.c" />
<ClCompile Include="..\..\src\render\opengles2\SDL_shaders_gles2.c" />
<ClCompile Include="..\..\src\video\SDL_egl.c" />
<ClCompile Include="..\..\src\video\windows\SDL_windowsopengles.c" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ResourceCompile Include="..\..\src\main\windows\version.rc" /> <ResourceCompile Include="..\..\src\main\windows\version.rc" />

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations"> <ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32"> <ProjectConfiguration Include="Debug|Win32">
@ -232,6 +232,7 @@
<ClInclude Include="..\..\include\SDL_config_windows.h" /> <ClInclude Include="..\..\include\SDL_config_windows.h" />
<ClInclude Include="..\..\include\SDL_copying.h" /> <ClInclude Include="..\..\include\SDL_copying.h" />
<ClInclude Include="..\..\include\SDL_cpuinfo.h" /> <ClInclude Include="..\..\include\SDL_cpuinfo.h" />
<ClInclude Include="..\..\include\SDL_egl.h" />
<ClInclude Include="..\..\include\SDL_endian.h" /> <ClInclude Include="..\..\include\SDL_endian.h" />
<ClInclude Include="..\..\include\SDL_error.h" /> <ClInclude Include="..\..\include\SDL_error.h" />
<ClInclude Include="..\..\include\SDL_events.h" /> <ClInclude Include="..\..\include\SDL_events.h" />
@ -301,6 +302,7 @@
<ClInclude Include="..\..\src\video\SDL_blit_auto.h" /> <ClInclude Include="..\..\src\video\SDL_blit_auto.h" />
<ClInclude Include="..\..\src\video\SDL_blit_copy.h" /> <ClInclude Include="..\..\src\video\SDL_blit_copy.h" />
<ClInclude Include="..\..\src\video\SDL_blit_slow.h" /> <ClInclude Include="..\..\src\video\SDL_blit_slow.h" />
<ClInclude Include="..\..\src\video\sdl_egl_c.h" />
<ClInclude Include="..\..\src\video\SDL_shape_internals.h" /> <ClInclude Include="..\..\src\video\SDL_shape_internals.h" />
<ClInclude Include="..\..\src\audio\winmm\SDL_winmm.h" /> <ClInclude Include="..\..\src\audio\winmm\SDL_winmm.h" />
<ClInclude Include="..\..\src\audio\disk\SDL_diskaudio.h" /> <ClInclude Include="..\..\src\audio\disk\SDL_diskaudio.h" />
@ -340,6 +342,7 @@
<ClInclude Include="..\..\src\video\windows\SDL_windowsmodes.h" /> <ClInclude Include="..\..\src\video\windows\SDL_windowsmodes.h" />
<ClInclude Include="..\..\src\video\windows\SDL_windowsmouse.h" /> <ClInclude Include="..\..\src\video\windows\SDL_windowsmouse.h" />
<ClInclude Include="..\..\src\video\windows\SDL_windowsopengl.h" /> <ClInclude Include="..\..\src\video\windows\SDL_windowsopengl.h" />
<ClInclude Include="..\..\src\video\windows\SDL_windowsopengles.h" />
<ClInclude Include="..\..\src\video\windows\SDL_windowsshape.h" /> <ClInclude Include="..\..\src\video\windows\SDL_windowsshape.h" />
<ClInclude Include="..\..\src\video\windows\SDL_windowsvideo.h" /> <ClInclude Include="..\..\src\video\windows\SDL_windowsvideo.h" />
<ClInclude Include="..\..\src\video\windows\SDL_windowswindow.h" /> <ClInclude Include="..\..\src\video\windows\SDL_windowswindow.h" />
@ -368,6 +371,8 @@
<ClCompile Include="..\..\src\libm\s_scalbn.c" /> <ClCompile Include="..\..\src\libm\s_scalbn.c" />
<ClCompile Include="..\..\src\libm\s_sin.c" /> <ClCompile Include="..\..\src\libm\s_sin.c" />
<ClCompile Include="..\..\src\render\direct3d\SDL_render_d3d.c" /> <ClCompile Include="..\..\src\render\direct3d\SDL_render_d3d.c" />
<ClCompile Include="..\..\src\render\opengles2\SDL_render_gles2.c" />
<ClCompile Include="..\..\src\render\opengles2\SDL_shaders_gles2.c" />
<ClCompile Include="..\..\src\render\opengl\SDL_render_gl.c" /> <ClCompile Include="..\..\src\render\opengl\SDL_render_gl.c" />
<ClCompile Include="..\..\src\render\opengl\SDL_shaders_gl.c" /> <ClCompile Include="..\..\src\render\opengl\SDL_shaders_gl.c" />
<ClCompile Include="..\..\src\render\SDL_render.c" /> <ClCompile Include="..\..\src\render\SDL_render.c" />
@ -402,6 +407,7 @@
<ClCompile Include="..\..\src\video\SDL_bmp.c" /> <ClCompile Include="..\..\src\video\SDL_bmp.c" />
<ClCompile Include="..\..\src\cpuinfo\SDL_cpuinfo.c" /> <ClCompile Include="..\..\src\cpuinfo\SDL_cpuinfo.c" />
<ClCompile Include="..\..\src\video\SDL_clipboard.c" /> <ClCompile Include="..\..\src\video\SDL_clipboard.c" />
<ClCompile Include="..\..\src\video\SDL_egl.c" />
<ClCompile Include="..\..\src\video\SDL_shape.c" /> <ClCompile Include="..\..\src\video\SDL_shape.c" />
<ClCompile Include="..\..\src\audio\winmm\SDL_winmm.c" /> <ClCompile Include="..\..\src\audio\winmm\SDL_winmm.c" />
<ClCompile Include="..\..\src\audio\disk\SDL_diskaudio.c" /> <ClCompile Include="..\..\src\audio\disk\SDL_diskaudio.c" />
@ -457,6 +463,7 @@
<ClCompile Include="..\..\src\video\windows\SDL_windowsmodes.c" /> <ClCompile Include="..\..\src\video\windows\SDL_windowsmodes.c" />
<ClCompile Include="..\..\src\video\windows\SDL_windowsmouse.c" /> <ClCompile Include="..\..\src\video\windows\SDL_windowsmouse.c" />
<ClCompile Include="..\..\src\video\windows\SDL_windowsopengl.c" /> <ClCompile Include="..\..\src\video\windows\SDL_windowsopengl.c" />
<ClCompile Include="..\..\src\video\windows\SDL_windowsopengles.c" />
<ClCompile Include="..\..\src\video\windows\SDL_windowsshape.c" /> <ClCompile Include="..\..\src\video\windows\SDL_windowsshape.c" />
<ClCompile Include="..\..\src\video\windows\SDL_windowsvideo.c" /> <ClCompile Include="..\..\src\video\windows\SDL_windowsvideo.c" />
<ClCompile Include="..\..\src\video\windows\SDL_windowswindow.c" /> <ClCompile Include="..\..\src\video\windows\SDL_windowswindow.c" />

View File

@ -1,5 +1,8 @@
Microsoft Visual Studio Solution File, Format Version 12.00 
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013 # Visual Studio 2013
VisualStudioVersion = 12.0.21005.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SDL2", "SDL\SDL_VS2013.vcxproj", "{81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SDL2", "SDL\SDL_VS2013.vcxproj", "{81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}"
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SDL2main", "SDLmain\SDLmain_VS2013.vcxproj", "{DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SDL2main", "SDLmain\SDLmain_VS2013.vcxproj", "{DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}"
@ -102,6 +105,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testjoystick", "tests\testj
{DA956FD3-E143-46F2-9FE5-C77BEBC56B1A} = {DA956FD3-E143-46F2-9FE5-C77BEBC56B1A} {DA956FD3-E143-46F2-9FE5-C77BEBC56B1A} = {DA956FD3-E143-46F2-9FE5-C77BEBC56B1A}
EndProjectSection EndProjectSection
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testgles2", "tests\testgles2\testgles2_VS2013.vcxproj", "{E5287C64-0646-4BFA-A772-1DB5A649F35E}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32 Debug|Win32 = Debug|Win32
@ -252,6 +257,14 @@ Global
{55812185-D13C-4022-9C81-32E0F4A08BCC}.Release|Win32.Build.0 = Release|Win32 {55812185-D13C-4022-9C81-32E0F4A08BCC}.Release|Win32.Build.0 = Release|Win32
{55812185-D13C-4022-9C81-32E0F4A08BCC}.Release|x64.ActiveCfg = Release|x64 {55812185-D13C-4022-9C81-32E0F4A08BCC}.Release|x64.ActiveCfg = Release|x64
{55812185-D13C-4022-9C81-32E0F4A08BCC}.Release|x64.Build.0 = Release|x64 {55812185-D13C-4022-9C81-32E0F4A08BCC}.Release|x64.Build.0 = Release|x64
{E5287C64-0646-4BFA-A772-1DB5A649F35E}.Debug|Win32.ActiveCfg = Debug|Win32
{E5287C64-0646-4BFA-A772-1DB5A649F35E}.Debug|Win32.Build.0 = Debug|Win32
{E5287C64-0646-4BFA-A772-1DB5A649F35E}.Debug|x64.ActiveCfg = Debug|x64
{E5287C64-0646-4BFA-A772-1DB5A649F35E}.Debug|x64.Build.0 = Debug|x64
{E5287C64-0646-4BFA-A772-1DB5A649F35E}.Release|Win32.ActiveCfg = Release|Win32
{E5287C64-0646-4BFA-A772-1DB5A649F35E}.Release|Win32.Build.0 = Release|Win32
{E5287C64-0646-4BFA-A772-1DB5A649F35E}.Release|x64.ActiveCfg = Release|x64
{E5287C64-0646-4BFA-A772-1DB5A649F35E}.Release|x64.Build.0 = Release|x64
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
@ -273,5 +286,6 @@ Global
{55812185-D13C-4022-9C81-32E0F4A08336} = {CE748C1F-3C21-4825-AA6A-F895A023F7E7} {55812185-D13C-4022-9C81-32E0F4A08336} = {CE748C1F-3C21-4825-AA6A-F895A023F7E7}
{55812185-D13C-4022-9C81-32E0F4A08996} = {CE748C1F-3C21-4825-AA6A-F895A023F7E7} {55812185-D13C-4022-9C81-32E0F4A08996} = {CE748C1F-3C21-4825-AA6A-F895A023F7E7}
{55812185-D13C-4022-9C81-32E0F4A08BCC} = {CE748C1F-3C21-4825-AA6A-F895A023F7E7} {55812185-D13C-4022-9C81-32E0F4A08BCC} = {CE748C1F-3C21-4825-AA6A-F895A023F7E7}
{E5287C64-0646-4BFA-A772-1DB5A649F35E} = {CE748C1F-3C21-4825-AA6A-F895A023F7E7}
EndGlobalSection EndGlobalSection
EndGlobal EndGlobal

View File

@ -0,0 +1,207 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
Name="testgl2"
ProjectGUID="{8B5CFB38-CCBA-40A8-AD7A-89C57B070884}"
RootNamespace="testgl2"
TargetFrameworkVersion="131072"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory=".\Debug"
IntermediateDirectory=".\Debug"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC70.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="_DEBUG"
MkTypLibCompatible="true"
SuppressStartupBanner="true"
TargetEnvironment="1"
TypeLibraryName=".\Debug/testgl2.tlb"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\..\..\include"
PreprocessorDefinitions="_DEBUG,WIN32,_WINDOWS,HAVE_OPENGL"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
PrecompiledHeaderFile=".\Debug/testgles2.pch"
WarningLevel="3"
SuppressStartupBanner="true"
DebugInformationFormat="4"
CompileAs="0"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="1033"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalOptions="/MACHINE:I386"
AdditionalDependencies="opengl32.lib"
LinkIncremental="2"
SuppressStartupBanner="true"
GenerateDebugInformation="true"
ProgramDatabaseFile=".\Debug/testgles2.pdb"
SubSystem="2"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
Description="Copy SDL"
CommandLine="copy &quot;$(SolutionDir)\SDL\$(ConfigurationName)\SDL2.dll&quot; &quot;$(TargetDir)\SDL2.dll&quot;"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory=".\Release"
IntermediateDirectory=".\Release"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC70.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="NDEBUG"
MkTypLibCompatible="true"
SuppressStartupBanner="true"
TargetEnvironment="1"
TypeLibraryName=".\Release/testgles2.tlb"
/>
<Tool
Name="VCCLCompilerTool"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories="..\..\..\include"
PreprocessorDefinitions="NDEBUG,WIN32,_WINDOWS,HAVE_OPENGL"
StringPooling="true"
RuntimeLibrary="2"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
PrecompiledHeaderFile=".\Release/testgles2.pch"
WarningLevel="3"
SuppressStartupBanner="true"
CompileAs="0"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="1033"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalOptions="/MACHINE:I386"
AdditionalDependencies="opengl32.lib"
LinkIncremental="1"
SuppressStartupBanner="true"
ProgramDatabaseFile=".\Release/testgles2.pdb"
SubSystem="2"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
Description="Copy SDL"
CommandLine="copy &quot;$(SolutionDir)\SDL\$(ConfigurationName)\SDL2.dll&quot; &quot;$(TargetDir)\SDL2.dll&quot;"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<File
RelativePath="..\..\..\test\testgles2.c"
>
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@ -0,0 +1,238 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectName>testgles2</ProjectName>
<RootNamespace>testgles2</RootNamespace>
<ProjectGuid>{8B5CFB38-CCBA-40A8-AD7A-89C57B070884}</ProjectGuid>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseOfMfc>false</UseOfMfc>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseOfMfc>false</UseOfMfc>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseOfMfc>false</UseOfMfc>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseOfMfc>false</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Platform)\$(Configuration)\</OutDir>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(Platform)\$(Configuration)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Platform)\$(Configuration)\</IntDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(Platform)\$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Platform)\$(Configuration)\</OutDir>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(Platform)\$(Configuration)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Platform)\$(Configuration)\</IntDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(Platform)\$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Midl>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MkTypLibCompatible>true</MkTypLibCompatible>
<SuppressStartupBanner>true</SuppressStartupBanner>
<TargetEnvironment>Win32</TargetEnvironment>
</Midl>
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_DEBUG;WIN32;_WINDOWS;HAVE_OPENGL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<CompileAs>Default</CompileAs>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<Culture>0x0409</Culture>
</ResourceCompile>
<Link>
<AdditionalDependencies>opengl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<SuppressStartupBanner>true</SuppressStartupBanner>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
</Link>
<PostBuildEvent>
<Command>copy "$(SolutionDir)\SDL\$(Platform)\$(Configuration)\SDL2.dll" "$(TargetDir)\SDL2.dll"</Command>
</PostBuildEvent>
<PostBuildEvent>
<Message>Copy SDL</Message>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Midl>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MkTypLibCompatible>true</MkTypLibCompatible>
<SuppressStartupBanner>true</SuppressStartupBanner>
</Midl>
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_DEBUG;WIN32;_WINDOWS;HAVE_OPENGL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<CompileAs>Default</CompileAs>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<Culture>0x0409</Culture>
</ResourceCompile>
<Link>
<AdditionalDependencies>opengl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<SuppressStartupBanner>true</SuppressStartupBanner>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
</Link>
<PostBuildEvent>
<Command>copy "$(SolutionDir)\SDL\$(Platform)\$(Configuration)\SDL2.dll" "$(TargetDir)\SDL2.dll"</Command>
</PostBuildEvent>
<PostBuildEvent>
<Message>Copy SDL</Message>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Midl>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MkTypLibCompatible>true</MkTypLibCompatible>
<SuppressStartupBanner>true</SuppressStartupBanner>
<TargetEnvironment>Win32</TargetEnvironment>
</Midl>
<ClCompile>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<AdditionalIncludeDirectories>..\..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>NDEBUG;WIN32;_WINDOWS;HAVE_OPENGL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner>
<CompileAs>Default</CompileAs>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<Culture>0x0409</Culture>
</ResourceCompile>
<Link>
<AdditionalDependencies>opengl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<SuppressStartupBanner>true</SuppressStartupBanner>
<SubSystem>Windows</SubSystem>
</Link>
<PostBuildEvent>
<Command>copy "$(SolutionDir)\SDL\$(Platform)\$(Configuration)\SDL2.dll" "$(TargetDir)\SDL2.dll"</Command>
</PostBuildEvent>
<PostBuildEvent>
<Message>Copy SDL</Message>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Midl>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MkTypLibCompatible>true</MkTypLibCompatible>
<SuppressStartupBanner>true</SuppressStartupBanner>
</Midl>
<ClCompile>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<AdditionalIncludeDirectories>..\..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>NDEBUG;WIN32;_WINDOWS;HAVE_OPENGL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner>
<CompileAs>Default</CompileAs>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<Culture>0x0409</Culture>
</ResourceCompile>
<Link>
<AdditionalDependencies>opengl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<SuppressStartupBanner>true</SuppressStartupBanner>
<SubSystem>Windows</SubSystem>
</Link>
<PostBuildEvent>
<Command>copy "$(SolutionDir)\SDL\$(Platform)\$(Configuration)\SDL2.dll" "$(TargetDir)\SDL2.dll"</Command>
</PostBuildEvent>
<PostBuildEvent>
<Message>Copy SDL</Message>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\..\..\test\testgles2.c" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\SDLmain\SDLmain_VS2010.vcxproj">
<Project>{da956fd3-e142-46f2-9dd5-c78bebb56b7a}</Project>
</ProjectReference>
<ProjectReference Include="..\..\SDLtest\SDLtest_VS2010.vcxproj">
<Project>{da956fd3-e143-46f2-9fe5-c77bebc56b1a}</Project>
</ProjectReference>
<ProjectReference Include="..\..\SDL\SDL_VS2010.vcxproj">
<Project>{81ce8daf-ebb2-4761-8e45-b71abcca8c68}</Project>
</ProjectReference>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@ -0,0 +1,236 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectName>testgles2</ProjectName>
<RootNamespace>testgles2</RootNamespace>
<ProjectGuid>{8B5CFB38-CCBA-40A8-AD7A-89C57B070884}</ProjectGuid>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseOfMfc>false</UseOfMfc>
<PlatformToolset>v110</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseOfMfc>false</UseOfMfc>
<PlatformToolset>v110</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseOfMfc>false</UseOfMfc>
<PlatformToolset>v110</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseOfMfc>false</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>v110</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Platform)\$(Configuration)\</OutDir>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(Platform)\$(Configuration)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Platform)\$(Configuration)\</IntDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(Platform)\$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Platform)\$(Configuration)\</OutDir>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(Platform)\$(Configuration)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Platform)\$(Configuration)\</IntDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(Platform)\$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Midl>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MkTypLibCompatible>true</MkTypLibCompatible>
<SuppressStartupBanner>true</SuppressStartupBanner>
<TargetEnvironment>Win32</TargetEnvironment>
</Midl>
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_DEBUG;WIN32;_WINDOWS;HAVE_OPENGL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<CompileAs>Default</CompileAs>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<Culture>0x0409</Culture>
</ResourceCompile>
<Link>
<AdditionalDependencies>opengl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<SuppressStartupBanner>true</SuppressStartupBanner>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
</Link>
<PostBuildEvent>
<Command>copy "$(SolutionDir)\SDL\$(Platform)\$(Configuration)\SDL2.dll" "$(TargetDir)\SDL2.dll"</Command>
</PostBuildEvent>
<PostBuildEvent>
<Message>Copy SDL</Message>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Midl>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MkTypLibCompatible>true</MkTypLibCompatible>
<SuppressStartupBanner>true</SuppressStartupBanner>
</Midl>
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_DEBUG;WIN32;_WINDOWS;HAVE_OPENGL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<CompileAs>Default</CompileAs>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<Culture>0x0409</Culture>
</ResourceCompile>
<Link>
<AdditionalDependencies>opengl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<SuppressStartupBanner>true</SuppressStartupBanner>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
</Link>
<PostBuildEvent>
<Command>copy "$(SolutionDir)\SDL\$(Platform)\$(Configuration)\SDL2.dll" "$(TargetDir)\SDL2.dll"</Command>
</PostBuildEvent>
<PostBuildEvent>
<Message>Copy SDL</Message>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Midl>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MkTypLibCompatible>true</MkTypLibCompatible>
<SuppressStartupBanner>true</SuppressStartupBanner>
<TargetEnvironment>Win32</TargetEnvironment>
</Midl>
<ClCompile>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<AdditionalIncludeDirectories>..\..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>NDEBUG;WIN32;_WINDOWS;HAVE_OPENGL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner>
<CompileAs>Default</CompileAs>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<Culture>0x0409</Culture>
</ResourceCompile>
<Link>
<AdditionalDependencies>opengl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<SuppressStartupBanner>true</SuppressStartupBanner>
<SubSystem>Windows</SubSystem>
</Link>
<PostBuildEvent>
<Command>copy "$(SolutionDir)\SDL\$(Platform)\$(Configuration)\SDL2.dll" "$(TargetDir)\SDL2.dll"</Command>
</PostBuildEvent>
<PostBuildEvent>
<Message>Copy SDL</Message>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Midl>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MkTypLibCompatible>true</MkTypLibCompatible>
<SuppressStartupBanner>true</SuppressStartupBanner>
</Midl>
<ClCompile>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<AdditionalIncludeDirectories>..\..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>NDEBUG;WIN32;_WINDOWS;HAVE_OPENGL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner>
<CompileAs>Default</CompileAs>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<Culture>0x0409</Culture>
</ResourceCompile>
<Link>
<AdditionalDependencies>opengl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<SuppressStartupBanner>true</SuppressStartupBanner>
<SubSystem>Windows</SubSystem>
</Link>
<PostBuildEvent>
<Command>copy "$(SolutionDir)\SDL\$(Platform)\$(Configuration)\SDL2.dll" "$(TargetDir)\SDL2.dll"</Command>
</PostBuildEvent>
<PostBuildEvent>
<Message>Copy SDL</Message>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\..\..\test\testgles2.c" />
</ItemGroup>
<ItemGroup>
<Library Include="..\..\SDL\$(Platform)\$(Configuration)\SDL2.lib" />
<Library Include="..\..\SDLmain\$(Platform)\$(Configuration)\SDL2main.lib" />
<Library Include="..\..\SDLtest\$(Platform)\$(Configuration)\SDL2test.lib" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@ -0,0 +1,236 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectName>testgles2</ProjectName>
<RootNamespace>testgles2</RootNamespace>
<ProjectGuid>{E5287C64-0646-4BFA-A772-1DB5A649F35E}</ProjectGuid>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseOfMfc>false</UseOfMfc>
<PlatformToolset>v120</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseOfMfc>false</UseOfMfc>
<PlatformToolset>v120</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseOfMfc>false</UseOfMfc>
<PlatformToolset>v120</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseOfMfc>false</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>v120</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Platform)\$(Configuration)\</OutDir>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(Platform)\$(Configuration)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Platform)\$(Configuration)\</IntDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(Platform)\$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Platform)\$(Configuration)\</OutDir>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(Platform)\$(Configuration)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Platform)\$(Configuration)\</IntDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(Platform)\$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Midl>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MkTypLibCompatible>true</MkTypLibCompatible>
<SuppressStartupBanner>true</SuppressStartupBanner>
<TargetEnvironment>Win32</TargetEnvironment>
</Midl>
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_DEBUG;WIN32;_WINDOWS;HAVE_OPENGLES2;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<CompileAs>Default</CompileAs>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<Culture>0x0409</Culture>
</ResourceCompile>
<Link>
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
<SuppressStartupBanner>true</SuppressStartupBanner>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
</Link>
<PostBuildEvent>
<Command>copy "$(SolutionDir)\SDL\$(Platform)\$(Configuration)\SDL2.dll" "$(TargetDir)\SDL2.dll"</Command>
</PostBuildEvent>
<PostBuildEvent>
<Message>Copy SDL</Message>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Midl>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MkTypLibCompatible>true</MkTypLibCompatible>
<SuppressStartupBanner>true</SuppressStartupBanner>
</Midl>
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_DEBUG;WIN32;_WINDOWS;HAVE_OPENGLES2;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<CompileAs>Default</CompileAs>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<Culture>0x0409</Culture>
</ResourceCompile>
<Link>
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
<SuppressStartupBanner>true</SuppressStartupBanner>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
</Link>
<PostBuildEvent>
<Command>copy "$(SolutionDir)\SDL\$(Platform)\$(Configuration)\SDL2.dll" "$(TargetDir)\SDL2.dll"</Command>
</PostBuildEvent>
<PostBuildEvent>
<Message>Copy SDL</Message>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Midl>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MkTypLibCompatible>true</MkTypLibCompatible>
<SuppressStartupBanner>true</SuppressStartupBanner>
<TargetEnvironment>Win32</TargetEnvironment>
</Midl>
<ClCompile>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<AdditionalIncludeDirectories>..\..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>NDEBUG;WIN32;_WINDOWS;HAVE_OPENGLES2;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner>
<CompileAs>Default</CompileAs>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<Culture>0x0409</Culture>
</ResourceCompile>
<Link>
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
<SuppressStartupBanner>true</SuppressStartupBanner>
<SubSystem>Windows</SubSystem>
</Link>
<PostBuildEvent>
<Command>copy "$(SolutionDir)\SDL\$(Platform)\$(Configuration)\SDL2.dll" "$(TargetDir)\SDL2.dll"</Command>
</PostBuildEvent>
<PostBuildEvent>
<Message>Copy SDL</Message>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Midl>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MkTypLibCompatible>true</MkTypLibCompatible>
<SuppressStartupBanner>true</SuppressStartupBanner>
</Midl>
<ClCompile>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<AdditionalIncludeDirectories>..\..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>NDEBUG;WIN32;_WINDOWS;HAVE_OPENGLES2;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner>
<CompileAs>Default</CompileAs>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<Culture>0x0409</Culture>
</ResourceCompile>
<Link>
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
<SuppressStartupBanner>true</SuppressStartupBanner>
<SubSystem>Windows</SubSystem>
</Link>
<PostBuildEvent>
<Command>copy "$(SolutionDir)\SDL\$(Platform)\$(Configuration)\SDL2.dll" "$(TargetDir)\SDL2.dll"</Command>
</PostBuildEvent>
<PostBuildEvent>
<Message>Copy SDL</Message>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\..\..\test\testgles2.c" />
</ItemGroup>
<ItemGroup>
<Library Include="..\..\SDL\$(Platform)\$(Configuration)\SDL2.lib" />
<Library Include="..\..\SDLmain\$(Platform)\$(Configuration)\SDL2main.lib" />
<Library Include="..\..\SDLtest\$(Platform)\$(Configuration)\SDL2test.lib" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@ -180,6 +180,16 @@ typedef unsigned int uintptr_t;
#ifndef SDL_VIDEO_RENDER_OGL #ifndef SDL_VIDEO_RENDER_OGL
#define SDL_VIDEO_RENDER_OGL 1 #define SDL_VIDEO_RENDER_OGL 1
#endif #endif
#ifndef SDL_VIDEO_RENDER_OGL_ES2
#define SDL_VIDEO_RENDER_OGL_ES2 1
#endif
#ifndef SDL_VIDEO_OPENGL_ES2
#define SDL_VIDEO_OPENGL_ES2 1
#endif
#ifndef SDL_VIDEO_OPENGL_EGL
#define SDL_VIDEO_OPENGL_EGL 1
#endif
/* Enable system power support */ /* Enable system power support */
#define SDL_POWER_WINDOWS 1 #define SDL_POWER_WINDOWS 1

1389
include/SDL_egl.h Normal file

File diff suppressed because it is too large Load Diff

View File

@ -301,6 +301,21 @@ extern "C" {
*/ */
#define SDL_HINT_MAC_CTRL_CLICK_EMULATE_RIGHT_CLICK "SDL_MAC_CTRL_CLICK_EMULATE_RIGHT_CLICK" #define SDL_HINT_MAC_CTRL_CLICK_EMULATE_RIGHT_CLICK "SDL_MAC_CTRL_CLICK_EMULATE_RIGHT_CLICK"
/**
* \brief A variable specifying which shader compiler to preload when using the Chrome ANGLE binaries
*
* SDL has EGL and OpenGL ES2 support on Windows via the ANGLE project. It
* can use two different sets of binaries, those compiled by the user from source
* or those provided by the Chrome browser. In the later case, these binaries require
* that SDL loads
*
* This variable can be set to the following values:
* "d3dcompiler_46.dll" - default, best for Vista or later.
* "d3dcompiler_43.dll" - for XP support.
* "none" - do not load any library, useful if you compiled ANGLE from source and included the compiler in your binaries.
*
*/
#define SDL_HINT_VIDEO_WIN_D3DCOMPILER "SDL_VIDEO_WIN_D3DCOMPILER"
/** /**
* \brief An enumeration of hint priorities * \brief An enumeration of hint priorities

File diff suppressed because it is too large Load Diff

View File

@ -46,3 +46,5 @@ SDL_PROC(void, glBindFramebuffer, (GLenum, GLuint))
SDL_PROC(void, glFramebufferTexture2D, (GLenum, GLenum, GLenum, GLuint, GLint)) SDL_PROC(void, glFramebufferTexture2D, (GLenum, GLenum, GLenum, GLuint, GLint))
SDL_PROC(GLenum, glCheckFramebufferStatus, (GLenum)) SDL_PROC(GLenum, glCheckFramebufferStatus, (GLenum))
SDL_PROC(void, glDeleteFramebuffers, (GLsizei, const GLuint *)) SDL_PROC(void, glDeleteFramebuffers, (GLsizei, const GLuint *))
SDL_PROC(GLint, glGetAttribLocation, (GLuint, const GLchar *))

View File

@ -23,8 +23,9 @@
#if SDL_VIDEO_OPENGL_EGL #if SDL_VIDEO_OPENGL_EGL
#include "SDL_sysvideo.h" #include "SDL_sysvideo.h"
#include "SDL_egl.h" #include "SDL_egl_c.h"
#include "SDL_loadso.h"
#include "SDL_hints.h"
#if SDL_VIDEO_DRIVER_RPI #if SDL_VIDEO_DRIVER_RPI
/* Raspbian places the OpenGL ES/EGL binaries in a non standard path */ /* Raspbian places the OpenGL ES/EGL binaries in a non standard path */
@ -40,6 +41,13 @@
#define DEFAULT_OGL_ES_PVR "libGLES_CM.so" #define DEFAULT_OGL_ES_PVR "libGLES_CM.so"
#define DEFAULT_OGL_ES "libGLESv1_CM.so" #define DEFAULT_OGL_ES "libGLESv1_CM.so"
#elif SDL_VIDEO_DRIVER_WINDOWS
/* EGL AND OpenGL ES support via ANGLE */
#define DEFAULT_EGL "libEGL.dll"
#define DEFAULT_OGL_ES2 "libGLESv2.dll"
#define DEFAULT_OGL_ES_PVR "libGLES_CM.dll"
#define DEFAULT_OGL_ES "libGLESv1_CM.dll"
#else #else
/* Desktop Linux */ /* Desktop Linux */
#define DEFAULT_EGL "libEGL.so.1" #define DEFAULT_EGL "libEGL.so.1"
@ -49,7 +57,7 @@
#endif /* SDL_VIDEO_DRIVER_RPI */ #endif /* SDL_VIDEO_DRIVER_RPI */
#define LOAD_FUNC(NAME) \ #define LOAD_FUNC(NAME) \
*((void**)&_this->egl_data->NAME) = dlsym(dll_handle, #NAME); \ *((void**)&_this->egl_data->NAME) = SDL_LoadFunction(_this->egl_data->dll_handle, #NAME); \
if (!_this->egl_data->NAME) \ if (!_this->egl_data->NAME) \
{ \ { \
return SDL_SetError("Could not retrieve EGL function " #NAME); \ return SDL_SetError("Could not retrieve EGL function " #NAME); \
@ -61,12 +69,10 @@ void *
SDL_EGL_GetProcAddress(_THIS, const char *proc) SDL_EGL_GetProcAddress(_THIS, const char *proc)
{ {
static char procname[1024]; static char procname[1024];
void *handle;
void *retval; void *retval;
/* eglGetProcAddress is busted on Android http://code.google.com/p/android/issues/detail?id=7681 */ /* eglGetProcAddress is busted on Android http://code.google.com/p/android/issues/detail?id=7681 */
#if !defined(SDL_VIDEO_DRIVER_ANDROID) #if !defined(SDL_VIDEO_DRIVER_ANDROID)
handle = _this->egl_data->egl_dll_handle;
if (_this->egl_data->eglGetProcAddress) { if (_this->egl_data->eglGetProcAddress) {
retval = _this->egl_data->eglGetProcAddress(proc); retval = _this->egl_data->eglGetProcAddress(proc);
if (retval) { if (retval) {
@ -75,15 +81,11 @@ SDL_EGL_GetProcAddress(_THIS, const char *proc)
} }
#endif #endif
handle = _this->gl_config.dll_handle; retval = SDL_LoadFunction(_this->egl_data->egl_dll_handle, proc);
#if defined(__OpenBSD__) && !defined(__ELF__) if (!retval && SDL_strlen(proc) <= 1022) {
#undef dlsym(x,y);
#endif
retval = dlsym(handle, proc);
if (!retval && strlen(proc) <= 1022) {
procname[0] = '_'; procname[0] = '_';
strcpy(procname + 1, proc); SDL_strlcpy(procname + 1, proc, 1022);
retval = dlsym(handle, procname); retval = SDL_LoadFunction(_this->egl_data->egl_dll_handle, procname);
} }
return retval; return retval;
} }
@ -97,12 +99,12 @@ SDL_EGL_UnloadLibrary(_THIS)
_this->egl_data->egl_display = NULL; _this->egl_data->egl_display = NULL;
} }
if (_this->gl_config.dll_handle) { if (_this->egl_data->dll_handle) {
dlclose(_this->gl_config.dll_handle); SDL_UnloadObject(_this->egl_data->dll_handle);
_this->gl_config.dll_handle = NULL; _this->egl_data->dll_handle = NULL;
} }
if (_this->egl_data->egl_dll_handle) { if (_this->egl_data->egl_dll_handle) {
dlclose(_this->egl_data->egl_dll_handle); SDL_UnloadObject(_this->egl_data->egl_dll_handle);
_this->egl_data->egl_dll_handle = NULL; _this->egl_data->egl_dll_handle = NULL;
} }
@ -114,9 +116,11 @@ SDL_EGL_UnloadLibrary(_THIS)
int int
SDL_EGL_LoadLibrary(_THIS, const char *egl_path, NativeDisplayType native_display) SDL_EGL_LoadLibrary(_THIS, const char *egl_path, NativeDisplayType native_display)
{ {
void *dll_handle, *egl_dll_handle; /* The naming is counter intuitive, but hey, I just work here -- Gabriel */ void *dll_handle = NULL, *egl_dll_handle = NULL; /* The naming is counter intuitive, but hey, I just work here -- Gabriel */
char *path; char *path = NULL;
int dlopen_flags; #if SDL_VIDEO_DRIVER_WINDOWS
const char *d3dcompiler;
#endif
if (_this->egl_data) { if (_this->egl_data) {
return SDL_SetError("OpenGL ES context already created"); return SDL_SetError("OpenGL ES context already created");
@ -127,50 +131,63 @@ SDL_EGL_LoadLibrary(_THIS, const char *egl_path, NativeDisplayType native_displa
return SDL_OutOfMemory(); return SDL_OutOfMemory();
} }
#ifdef RTLD_GLOBAL #if SDL_VIDEO_DRIVER_WINDOWS
dlopen_flags = RTLD_LAZY | RTLD_GLOBAL; d3dcompiler = SDL_GetHint(SDL_HINT_VIDEO_WIN_D3DCOMPILER);
#else if (!d3dcompiler) {
dlopen_flags = RTLD_LAZY; /* By default we load the Vista+ compatible compiler */
d3dcompiler = "d3dcompiler_46.dll";
}
if (SDL_strcasecmp(d3dcompiler, "none") != 0) {
SDL_LoadObject(d3dcompiler);
}
#endif #endif
/* A funny thing, loading EGL.so first does not work on the Raspberry, so we load libGL* first */ /* A funny thing, loading EGL.so first does not work on the Raspberry, so we load libGL* first */
path = getenv("SDL_VIDEO_GL_DRIVER"); path = SDL_getenv("SDL_VIDEO_GL_DRIVER");
egl_dll_handle = dlopen(path, dlopen_flags); if (path != NULL) {
if ((path == NULL) | (egl_dll_handle == NULL)) { egl_dll_handle = SDL_LoadObject(path);
}
if (egl_dll_handle == NULL) {
if (_this->gl_config.major_version > 1) { if (_this->gl_config.major_version > 1) {
path = DEFAULT_OGL_ES2; path = DEFAULT_OGL_ES2;
egl_dll_handle = dlopen(path, dlopen_flags); egl_dll_handle = SDL_LoadObject(path);
} else { }
else {
path = DEFAULT_OGL_ES; path = DEFAULT_OGL_ES;
egl_dll_handle = dlopen(path, dlopen_flags); egl_dll_handle = SDL_LoadObject(path);
if (egl_dll_handle == NULL) { if (egl_dll_handle == NULL) {
path = DEFAULT_OGL_ES_PVR; path = DEFAULT_OGL_ES_PVR;
egl_dll_handle = dlopen(path, dlopen_flags); egl_dll_handle = SDL_LoadObject(path);
} }
} }
} }
_this->egl_data->egl_dll_handle = egl_dll_handle; _this->egl_data->egl_dll_handle = egl_dll_handle;
if (egl_dll_handle == NULL) { if (egl_dll_handle == NULL) {
return SDL_SetError("Could not initialize OpenGL ES library: %s", dlerror()); return SDL_SetError("Could not initialize OpenGL ES library");
} }
/* Loading libGL* in the previous step took care of loading libEGL.so, but we future proof by double checking */ /* Loading libGL* in the previous step took care of loading libEGL.so, but we future proof by double checking */
dll_handle = dlopen(egl_path, dlopen_flags); if (egl_path != NULL) {
dll_handle = SDL_LoadObject(egl_path);
}
/* Catch the case where the application isn't linked with EGL */ /* Catch the case where the application isn't linked with EGL */
if ((dlsym(dll_handle, "eglChooseConfig") == NULL) && (egl_path == NULL)) { if ((SDL_LoadFunction(dll_handle, "eglChooseConfig") == NULL) && (egl_path == NULL)) {
dlclose(dll_handle); if (dll_handle != NULL) {
path = getenv("SDL_VIDEO_EGL_DRIVER"); SDL_UnloadObject(dll_handle);
}
path = SDL_getenv("SDL_VIDEO_EGL_DRIVER");
if (path == NULL) { if (path == NULL) {
path = DEFAULT_EGL; path = DEFAULT_EGL;
} }
dll_handle = dlopen(path, dlopen_flags); dll_handle = SDL_LoadObject(path);
if (dll_handle == NULL) {
return SDL_SetError("Could not load EGL library");
}
} }
_this->gl_config.dll_handle = dll_handle;
if (dll_handle == NULL) { _this->egl_data->dll_handle = dll_handle;
return SDL_SetError("Could not load EGL library: %s", dlerror());
}
/* Load new function pointers */ /* Load new function pointers */
LOAD_FUNC(eglGetDisplay); LOAD_FUNC(eglGetDisplay);
@ -198,14 +215,14 @@ SDL_EGL_LoadLibrary(_THIS, const char *egl_path, NativeDisplayType native_displa
return SDL_SetError("Could not initialize EGL"); return SDL_SetError("Could not initialize EGL");
} }
_this->gl_config.dll_handle = dll_handle; _this->egl_data->dll_handle = dll_handle;
_this->egl_data->egl_dll_handle = egl_dll_handle; _this->egl_data->egl_dll_handle = egl_dll_handle;
_this->gl_config.driver_loaded = 1; _this->gl_config.driver_loaded = 1;
if (path) { if (path) {
strncpy(_this->gl_config.driver_path, path, sizeof(_this->gl_config.driver_path) - 1); SDL_strlcpy(_this->gl_config.driver_path, path, sizeof(_this->gl_config.driver_path) - 1);
} else { } else {
strcpy(_this->gl_config.driver_path, ""); *_this->gl_config.driver_path = '\0';
} }
/* We need to select a config here to satisfy some video backends such as X11 */ /* We need to select a config here to satisfy some video backends such as X11 */
@ -217,10 +234,10 @@ SDL_EGL_ChooseConfig(_THIS)
{ {
/* 64 seems nice. */ /* 64 seems nice. */
EGLint attribs[64]; EGLint attribs[64];
EGLint found_configs = 0; EGLint found_configs = 0, value;
/* 128 seems even nicer here */ /* 128 seems even nicer here */
EGLConfig configs[128]; EGLConfig configs[128];
int i, j, best_bitdiff = -1, bitdiff, value; int i, j, best_bitdiff = -1, bitdiff;
if (!_this->egl_data) { if (!_this->egl_data) {
/* The EGL library wasn't loaded, SDL_GetError() should have info */ /* The EGL library wasn't loaded, SDL_GetError() should have info */
@ -286,7 +303,7 @@ SDL_EGL_ChooseConfig(_THIS)
for ( i=0; i<found_configs; i++ ) { for ( i=0; i<found_configs; i++ ) {
bitdiff = 0; bitdiff = 0;
for (j = 0; ; j += 2) { for (j = 0; j < SDL_arraysize(attribs) - 1; j += 2) {
if (attribs[j] == EGL_NONE) { if (attribs[j] == EGL_NONE) {
break; break;
} }
@ -298,7 +315,6 @@ SDL_EGL_ChooseConfig(_THIS)
attribs[j] == EGL_ALPHA_SIZE || attribs[j] == EGL_ALPHA_SIZE ||
attribs[j] == EGL_DEPTH_SIZE || attribs[j] == EGL_DEPTH_SIZE ||
attribs[j] == EGL_STENCIL_SIZE)) { attribs[j] == EGL_STENCIL_SIZE)) {
_this->egl_data->eglGetConfigAttrib(_this->egl_data->egl_display, configs[i], attribs[j], &value); _this->egl_data->eglGetConfigAttrib(_this->egl_data->egl_display, configs[i], attribs[j], &value);
bitdiff += value - attribs[j + 1]; /* value is always >= attrib */ bitdiff += value - attribs[j + 1]; /* value is always >= attrib */
} }

View File

@ -25,62 +25,57 @@
#if SDL_VIDEO_OPENGL_EGL #if SDL_VIDEO_OPENGL_EGL
#include <EGL/egl.h> #include "SDL_egl.h"
#include <dlfcn.h>
#if defined(__OpenBSD__) && !defined(__ELF__)
#define dlsym(x,y) dlsym(x, "_" y)
#endif
#include "SDL_sysvideo.h" #include "SDL_sysvideo.h"
typedef struct SDL_EGL_VideoData typedef struct SDL_EGL_VideoData
{ {
void *egl_dll_handle; void *egl_dll_handle, *dll_handle;
EGLDisplay egl_display; EGLDisplay egl_display;
EGLConfig egl_config; EGLConfig egl_config;
int egl_swapinterval; int egl_swapinterval;
EGLDisplay(*eglGetDisplay) (NativeDisplayType display); EGLDisplay(EGLAPIENTRY *eglGetDisplay) (NativeDisplayType display);
EGLBoolean(*eglInitialize) (EGLDisplay dpy, EGLint * major, EGLBoolean(EGLAPIENTRY *eglInitialize) (EGLDisplay dpy, EGLint * major,
EGLint * minor); EGLint * minor);
EGLBoolean(*eglTerminate) (EGLDisplay dpy); EGLBoolean(EGLAPIENTRY *eglTerminate) (EGLDisplay dpy);
void *(*eglGetProcAddress) (const char * procName); void *(EGLAPIENTRY *eglGetProcAddress) (const char * procName);
EGLBoolean(*eglChooseConfig) (EGLDisplay dpy, EGLBoolean(EGLAPIENTRY *eglChooseConfig) (EGLDisplay dpy,
const EGLint * attrib_list, const EGLint * attrib_list,
EGLConfig * configs, EGLConfig * configs,
EGLint config_size, EGLint * num_config); EGLint config_size, EGLint * num_config);
EGLContext(*eglCreateContext) (EGLDisplay dpy, EGLContext(EGLAPIENTRY *eglCreateContext) (EGLDisplay dpy,
EGLConfig config, EGLConfig config,
EGLContext share_list, EGLContext share_list,
const EGLint * attrib_list); const EGLint * attrib_list);
EGLBoolean(*eglDestroyContext) (EGLDisplay dpy, EGLContext ctx); EGLBoolean(EGLAPIENTRY *eglDestroyContext) (EGLDisplay dpy, EGLContext ctx);
EGLSurface(*eglCreateWindowSurface) (EGLDisplay dpy, EGLSurface(EGLAPIENTRY *eglCreateWindowSurface) (EGLDisplay dpy,
EGLConfig config, EGLConfig config,
NativeWindowType window, NativeWindowType window,
const EGLint * attrib_list); const EGLint * attrib_list);
EGLBoolean(*eglDestroySurface) (EGLDisplay dpy, EGLSurface surface); EGLBoolean(EGLAPIENTRY *eglDestroySurface) (EGLDisplay dpy, EGLSurface surface);
EGLBoolean(*eglMakeCurrent) (EGLDisplay dpy, EGLSurface draw, EGLBoolean(EGLAPIENTRY *eglMakeCurrent) (EGLDisplay dpy, EGLSurface draw,
EGLSurface read, EGLContext ctx); EGLSurface read, EGLContext ctx);
EGLBoolean(*eglSwapBuffers) (EGLDisplay dpy, EGLSurface draw); EGLBoolean(EGLAPIENTRY *eglSwapBuffers) (EGLDisplay dpy, EGLSurface draw);
EGLBoolean(*eglSwapInterval) (EGLDisplay dpy, EGLint interval); EGLBoolean(EGLAPIENTRY *eglSwapInterval) (EGLDisplay dpy, EGLint interval);
const char *(*eglQueryString) (EGLDisplay dpy, EGLint name); const char *(EGLAPIENTRY *eglQueryString) (EGLDisplay dpy, EGLint name);
EGLBoolean(*eglGetConfigAttrib) (EGLDisplay dpy, EGLConfig config, EGLBoolean(EGLAPIENTRY *eglGetConfigAttrib) (EGLDisplay dpy, EGLConfig config,
EGLint attribute, EGLint * value); EGLint attribute, EGLint * value);
EGLBoolean(*eglWaitNative) (EGLint engine); EGLBoolean(EGLAPIENTRY *eglWaitNative) (EGLint engine);
EGLBoolean(*eglWaitGL)(void); EGLBoolean(EGLAPIENTRY *eglWaitGL)(void);
} SDL_EGL_VideoData; } SDL_EGL_VideoData;
/* OpenGLES functions */ /* OpenGLES functions */

View File

@ -25,7 +25,7 @@
/* Android SDL video driver implementation */ /* Android SDL video driver implementation */
#include "SDL_video.h" #include "SDL_video.h"
#include "../SDL_egl.h" #include "../SDL_egl_c.h"
#include "SDL_androidwindow.h" #include "SDL_androidwindow.h"
#include "SDL_androidvideo.h" #include "SDL_androidvideo.h"

View File

@ -45,7 +45,7 @@
static int Android_VideoInit(_THIS); static int Android_VideoInit(_THIS);
static void Android_VideoQuit(_THIS); static void Android_VideoQuit(_THIS);
#include "../SDL_egl.h" #include "../SDL_egl_c.h"
/* GL functions (SDL_androidgl.c) */ /* GL functions (SDL_androidgl.c) */
extern SDL_GLContext Android_GLES_CreateContext(_THIS, SDL_Window * window); extern SDL_GLContext Android_GLES_CreateContext(_THIS, SDL_Window * window);
extern int Android_GLES_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context); extern int Android_GLES_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context);

View File

@ -24,7 +24,7 @@
#define _SDL_androidwindow_h #define _SDL_androidwindow_h
#include "../../core/android/SDL_android.h" #include "../../core/android/SDL_android.h"
#include "../SDL_egl.h" #include "../SDL_egl_c.h"
extern int Android_CreateWindow(_THIS, SDL_Window * window); extern int Android_CreateWindow(_THIS, SDL_Window * window);
extern void Android_SetWindowTitle(_THIS, SDL_Window * window); extern void Android_SetWindowTitle(_THIS, SDL_Window * window);

View File

@ -26,7 +26,7 @@
#if SDL_VIDEO_DRIVER_RPI && SDL_VIDEO_OPENGL_EGL #if SDL_VIDEO_DRIVER_RPI && SDL_VIDEO_OPENGL_EGL
#include "../SDL_sysvideo.h" #include "../SDL_sysvideo.h"
#include "../SDL_egl.h" #include "../SDL_egl_c.h"
/* OpenGLES functions */ /* OpenGLES functions */
#define RPI_GLES_GetAttribute SDL_EGL_GetAttribute #define RPI_GLES_GetAttribute SDL_EGL_GetAttribute

View File

@ -25,6 +25,7 @@
#include "SDL_assert.h" #include "SDL_assert.h"
#include "SDL_loadso.h" #include "SDL_loadso.h"
#include "SDL_windowsvideo.h" #include "SDL_windowsvideo.h"
#include "SDL_windowsopengles.h"
/* WGL implementation of SDL OpenGL support */ /* WGL implementation of SDL OpenGL support */
@ -323,11 +324,35 @@ HasExtension(const char *extension, const char *extensions)
return SDL_FALSE; return SDL_FALSE;
} }
static void void
WIN_GL_InitExtensions(_THIS, HDC hdc) WIN_GL_InitExtensions(_THIS)
{ {
const char *(WINAPI * wglGetExtensionsStringARB) (HDC) = 0; const char *(WINAPI * wglGetExtensionsStringARB) (HDC) = 0;
const char *extensions; const char *extensions;
HWND hwnd;
HDC hdc;
HGLRC hglrc;
PIXELFORMATDESCRIPTOR pfd;
hwnd =
CreateWindow(SDL_Appname, SDL_Appname, (WS_POPUP | WS_DISABLED), 0, 0,
10, 10, NULL, NULL, SDL_Instance, NULL);
if (!hwnd) {
return;
}
WIN_PumpEvents(_this);
hdc = GetDC(hwnd);
WIN_GL_SetupPixelFormat(_this, &pfd);
SetPixelFormat(hdc, ChoosePixelFormat(hdc, &pfd), &pfd);
hglrc = _this->gl_data->wglCreateContext(hdc);
if (!hglrc) {
return;
}
_this->gl_data->wglMakeCurrent(hdc, hglrc);
wglGetExtensionsStringARB = (const char *(WINAPI *) (HDC)) wglGetExtensionsStringARB = (const char *(WINAPI *) (HDC))
_this->gl_data->wglGetProcAddress("wglGetExtensionsStringARB"); _this->gl_data->wglGetProcAddress("wglGetExtensionsStringARB");
@ -369,6 +394,18 @@ WIN_GL_InitExtensions(_THIS, HDC hdc)
_this->gl_data->wglSwapIntervalEXT = NULL; _this->gl_data->wglSwapIntervalEXT = NULL;
_this->gl_data->wglGetSwapIntervalEXT = NULL; _this->gl_data->wglGetSwapIntervalEXT = NULL;
} }
/* Check for WGL_EXT_create_context_es2_profile */
_this->gl_data->HAS_WGL_EXT_create_context_es2_profile = SDL_FALSE;
if (HasExtension("WGL_EXT_create_context_es2_profile", extensions)) {
_this->gl_data->HAS_WGL_EXT_create_context_es2_profile = SDL_TRUE;
}
_this->gl_data->wglMakeCurrent(hdc, NULL);
_this->gl_data->wglDeleteContext(hglrc);
ReleaseDC(hwnd, hdc);
DestroyWindow(hwnd);
WIN_PumpEvents(_this);
} }
static int static int
@ -396,8 +433,6 @@ WIN_GL_ChoosePixelFormatARB(_THIS, int *iAttribs, float *fAttribs)
if (hglrc) { if (hglrc) {
_this->gl_data->wglMakeCurrent(hdc, hglrc); _this->gl_data->wglMakeCurrent(hdc, hglrc);
WIN_GL_InitExtensions(_this, hdc);
if (_this->gl_data->HAS_WGL_ARB_pixel_format) { if (_this->gl_data->HAS_WGL_ARB_pixel_format) {
_this->gl_data->wglChoosePixelFormatARB(hdc, iAttribs, fAttribs, _this->gl_data->wglChoosePixelFormatARB(hdc, iAttribs, fAttribs,
1, &pixel_format, 1, &pixel_format,
@ -548,6 +583,27 @@ WIN_GL_CreateContext(_THIS, SDL_Window * window)
HDC hdc = ((SDL_WindowData *) window->driverdata)->hdc; HDC hdc = ((SDL_WindowData *) window->driverdata)->hdc;
HGLRC context, share_context; HGLRC context, share_context;
if (_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_ES &&
!_this->gl_data->HAS_WGL_EXT_create_context_es2_profile) {
/* Switch to EGL based functions */
WIN_GL_UnloadLibrary(_this);
_this->GL_LoadLibrary = WIN_GLES_LoadLibrary;
_this->GL_GetProcAddress = WIN_GLES_GetProcAddress;
_this->GL_UnloadLibrary = WIN_GLES_UnloadLibrary;
_this->GL_CreateContext = WIN_GLES_CreateContext;
_this->GL_MakeCurrent = WIN_GLES_MakeCurrent;
_this->GL_SetSwapInterval = WIN_GLES_SetSwapInterval;
_this->GL_GetSwapInterval = WIN_GLES_GetSwapInterval;
_this->GL_SwapWindow = WIN_GLES_SwapWindow;
_this->GL_DeleteContext = WIN_GLES_DeleteContext;
if (WIN_GLES_LoadLibrary(_this, NULL) != 0) {
return NULL;
}
return WIN_GLES_CreateContext(_this, window);
}
if (_this->gl_config.share_with_current_context) { if (_this->gl_config.share_with_current_context) {
share_context = (HGLRC)SDL_GL_GetCurrentContext(); share_context = (HGLRC)SDL_GL_GetCurrentContext();
} else { } else {
@ -622,8 +678,6 @@ WIN_GL_CreateContext(_THIS, SDL_Window * window)
return NULL; return NULL;
} }
WIN_GL_InitExtensions(_this, hdc);
return context; return context;
} }

View File

@ -29,6 +29,7 @@ struct SDL_GLDriverData
{ {
SDL_bool HAS_WGL_ARB_pixel_format; SDL_bool HAS_WGL_ARB_pixel_format;
SDL_bool HAS_WGL_EXT_swap_control_tear; SDL_bool HAS_WGL_EXT_swap_control_tear;
SDL_bool HAS_WGL_EXT_create_context_es2_profile;
void *(WINAPI * wglGetProcAddress) (const char *proc); void *(WINAPI * wglGetProcAddress) (const char *proc);
HGLRC(WINAPI * wglCreateContext) (HDC hdc); HGLRC(WINAPI * wglCreateContext) (HDC hdc);
@ -62,6 +63,7 @@ extern int WIN_GL_SetSwapInterval(_THIS, int interval);
extern int WIN_GL_GetSwapInterval(_THIS); extern int WIN_GL_GetSwapInterval(_THIS);
extern void WIN_GL_SwapWindow(_THIS, SDL_Window * window); extern void WIN_GL_SwapWindow(_THIS, SDL_Window * window);
extern void WIN_GL_DeleteContext(_THIS, SDL_GLContext context); extern void WIN_GL_DeleteContext(_THIS, SDL_GLContext context);
extern void WIN_GL_InitExtensions(_THIS);
#ifndef WGL_ARB_pixel_format #ifndef WGL_ARB_pixel_format
#define WGL_NUMBER_PIXEL_FORMATS_ARB 0x2000 #define WGL_NUMBER_PIXEL_FORMATS_ARB 0x2000

View File

@ -0,0 +1,141 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#include "SDL_config.h"
#if SDL_VIDEO_DRIVER_WINDOWS && SDL_VIDEO_OPENGL_EGL
#include "SDL_windowsvideo.h"
#include "SDL_windowsopengles.h"
#include "SDL_windowsopengl.h"
#include "SDL_log.h"
/* EGL implementation of SDL OpenGL support */
int
WIN_GLES_LoadLibrary(_THIS, const char *path) {
SDL_VideoData *data = (SDL_VideoData *)_this->driverdata;
/* If the profile requested is not GL ES, switch over to WIN_GL functions */
if (_this->gl_config.profile_mask != SDL_GL_CONTEXT_PROFILE_ES) {
#if SDL_VIDEO_OPENGL_WGL
WIN_GLES_UnloadLibrary(_this);
_this->GL_LoadLibrary = WIN_GL_LoadLibrary;
_this->GL_GetProcAddress = WIN_GL_GetProcAddress;
_this->GL_UnloadLibrary = WIN_GL_UnloadLibrary;
_this->GL_CreateContext = WIN_GL_CreateContext;
_this->GL_MakeCurrent = WIN_GL_MakeCurrent;
_this->GL_SetSwapInterval = WIN_GL_SetSwapInterval;
_this->GL_GetSwapInterval = WIN_GL_GetSwapInterval;
_this->GL_SwapWindow = WIN_GL_SwapWindow;
_this->GL_DeleteContext = WIN_GL_DeleteContext;
return WIN_GL_LoadLibrary(_this, path);
#else
return SDL_SetError("SDL not configured with OpenGL/WGL support");
#endif
}
if (_this->egl_data == NULL) {
return SDL_EGL_LoadLibrary(_this, NULL, EGL_DEFAULT_DISPLAY);
}
return 0;
}
SDL_GLContext
WIN_GLES_CreateContext(_THIS, SDL_Window * window)
{
SDL_GLContext context;
SDL_WindowData *data = (SDL_WindowData *)window->driverdata;
if (_this->gl_config.profile_mask != SDL_GL_CONTEXT_PROFILE_ES) {
/* Switch to WGL based functions */
WIN_GLES_UnloadLibrary(_this);
_this->GL_LoadLibrary = WIN_GL_LoadLibrary;
_this->GL_GetProcAddress = WIN_GL_GetProcAddress;
_this->GL_UnloadLibrary = WIN_GL_UnloadLibrary;
_this->GL_CreateContext = WIN_GL_CreateContext;
_this->GL_MakeCurrent = WIN_GL_MakeCurrent;
_this->GL_SetSwapInterval = WIN_GL_SetSwapInterval;
_this->GL_GetSwapInterval = WIN_GL_GetSwapInterval;
_this->GL_SwapWindow = WIN_GL_SwapWindow;
_this->GL_DeleteContext = WIN_GL_DeleteContext;
if (WIN_GL_LoadLibrary(_this, NULL) != 0) {
return NULL;
}
return WIN_GL_CreateContext(_this, window);
}
context = SDL_EGL_CreateContext(_this, data->egl_surface);
return context;
}
void
WIN_GLES_DeleteContext(_THIS, SDL_GLContext context)
{
SDL_EGL_DeleteContext(_this, context);
WIN_GLES_UnloadLibrary(_this);
}
SDL_EGL_SwapWindow_impl(WIN)
SDL_EGL_MakeCurrent_impl(WIN)
int
WIN_GLES_SetupWindow(_THIS, SDL_Window * window)
{
/* The current context is lost in here; save it and reset it. */
SDL_WindowData *windowdata = (SDL_WindowData *) window->driverdata;
SDL_Window *current_win = SDL_GL_GetCurrentWindow();
SDL_GLContext current_ctx = SDL_GL_GetCurrentContext();
if (_this->egl_data == NULL) {
if (SDL_EGL_LoadLibrary(_this, NULL, EGL_DEFAULT_DISPLAY) < 0) {
return -1;
}
}
/* Create the GLES window surface */
windowdata->egl_surface = SDL_EGL_CreateSurface(_this, (NativeWindowType)windowdata->hwnd);
if (windowdata->egl_surface == EGL_NO_SURFACE) {
return SDL_SetError("Could not create GLES window surface");
}
return WIN_GLES_MakeCurrent(_this, current_win, current_ctx);
}
int
WIN_GLES_SetSwapInterval(_THIS, int interval)
{
/* FIXME: This should call SDL_EGL_SetSwapInterval, but ANGLE has a bug that prevents this
* from working if we do (the window contents freeze and don't swap properly). So, we ignore
* the request for now.
*/
SDL_Log("WARNING: Ignoring SDL_GL_SetSwapInterval call due to ANGLE bug");
return 0;
}
#endif /* SDL_VIDEO_DRIVER_WINDOWS && SDL_VIDEO_OPENGL_EGL */
/* vi: set ts=4 sw=4 expandtab: */

View File

@ -0,0 +1,51 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#include "SDL_config.h"
#ifndef _SDL_winopengles_h
#define _SDL_winopengles_h
#if SDL_VIDEO_OPENGL_EGL
#include "../SDL_sysvideo.h"
#include "../SDL_egl_c.h"
/* OpenGLES functions */
#define WIN_GLES_GetAttribute SDL_EGL_GetAttribute
#define WIN_GLES_GetProcAddress SDL_EGL_GetProcAddress
#define WIN_GLES_UnloadLibrary SDL_EGL_UnloadLibrary
#define WIN_GLES_GetSwapInterval SDL_EGL_GetSwapInterval
/* See the WIN_GLES_GetSwapInterval implementation to see why this is commented out */
/*#define WIN_GLES_SetSwapInterval SDL_EGL_SetSwapInterval*/
extern int WIN_GLES_SetSwapInterval(_THIS, int interval);
extern int WIN_GLES_LoadLibrary(_THIS, const char *path);
extern SDL_GLContext WIN_GLES_CreateContext(_THIS, SDL_Window * window);
extern void WIN_GLES_SwapWindow(_THIS, SDL_Window * window);
extern int WIN_GLES_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context);
extern void WIN_GLES_DeleteContext(_THIS, SDL_GLContext context);
extern int WIN_GLES_SetupWindow(_THIS, SDL_Window * window);
#endif /* SDL_VIDEO_OPENGL_EGL */
#endif /* _SDL_winopengles_h */
/* vi: set ts=4 sw=4 expandtab: */

View File

@ -44,6 +44,7 @@
#include "SDL_windowsmodes.h" #include "SDL_windowsmodes.h"
#include "SDL_windowsmouse.h" #include "SDL_windowsmouse.h"
#include "SDL_windowsopengl.h" #include "SDL_windowsopengl.h"
#include "SDL_windowsopengles.h"
#include "SDL_windowswindow.h" #include "SDL_windowswindow.h"
#include "SDL_events.h" #include "SDL_events.h"
#include "SDL_loadso.h" #include "SDL_loadso.h"

View File

@ -273,6 +273,32 @@ WIN_CreateWindow(_THIS, SDL_Window * window)
DestroyWindow(hwnd); DestroyWindow(hwnd);
return -1; return -1;
} }
#if SDL_VIDEO_OPENGL_WGL
/* We need to initialize the extensions before deciding how to create ES profiles */
if (window->flags & SDL_WINDOW_OPENGL) {
WIN_GL_InitExtensions(_this);
}
#endif
#if SDL_VIDEO_OPENGL_ES2
if ((window->flags & SDL_WINDOW_OPENGL) &&
_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_ES
#if SDL_VIDEO_OPENGL_WGL
&& (!_this->gl_data || !_this->gl_data->HAS_WGL_EXT_create_context_es2_profile)
#endif
) {
#if SDL_VIDEO_OPENGL_EGL
if (WIN_GLES_SetupWindow(_this, window) < 0) {
WIN_DestroyWindow(_this, window);
return -1;
}
#else
return SDL_SetError("Could not create GLES window surface (no EGL support available)");
#endif /* SDL_VIDEO_OPENGL_EGL */
} else
#endif /* SDL_VIDEO_OPENGL_ES2 */
#if SDL_VIDEO_OPENGL_WGL #if SDL_VIDEO_OPENGL_WGL
if (window->flags & SDL_WINDOW_OPENGL) { if (window->flags & SDL_WINDOW_OPENGL) {
if (WIN_GL_SetupWindow(_this, window) < 0) { if (WIN_GL_SetupWindow(_this, window) < 0) {
@ -281,6 +307,7 @@ WIN_CreateWindow(_THIS, SDL_Window * window)
} }
} }
#endif #endif
return 0; return 0;
} }

View File

@ -23,6 +23,10 @@
#ifndef _SDL_windowswindow_h #ifndef _SDL_windowswindow_h
#define _SDL_windowswindow_h #define _SDL_windowswindow_h
#if SDL_VIDEO_OPENGL_EGL
#include "../SDL_egl_c.h"
#endif
typedef struct typedef struct
{ {
SDL_Window *window; SDL_Window *window;
@ -35,6 +39,9 @@ typedef struct
WPARAM mouse_button_flags; WPARAM mouse_button_flags;
BOOL expected_resize; BOOL expected_resize;
struct SDL_VideoData *videodata; struct SDL_VideoData *videodata;
#if SDL_VIDEO_OPENGL_EGL
EGLSurface egl_surface;
#endif
} SDL_WindowData; } SDL_WindowData;
extern int WIN_CreateWindow(_THIS, SDL_Window * window); extern int WIN_CreateWindow(_THIS, SDL_Window * window);

View File

@ -26,7 +26,7 @@
#if SDL_VIDEO_OPENGL_EGL #if SDL_VIDEO_OPENGL_EGL
#include "../SDL_sysvideo.h" #include "../SDL_sysvideo.h"
#include "../SDL_egl.h" #include "../SDL_egl_c.h"
typedef struct SDL_PrivateGLESData typedef struct SDL_PrivateGLESData
{ {

2
test/configure vendored
View File

@ -3902,7 +3902,7 @@ if test x$have_opengles = xyes; then
fi fi
if test x$have_opengles2 = xyes; then if test x$have_opengles2 = xyes; then
CFLAGS="$CFLAGS -DHAVE_OPENGLES2" CFLAGS="$CFLAGS -DHAVE_OPENGLES2"
GLES2LIB="$XPATH -lGLESv2" #GLES2LIB="$XPATH -lGLESv2"
fi fi
if test x$have_opengl = xyes; then if test x$have_opengl = xyes; then
CFLAGS="$CFLAGS -DHAVE_OPENGL" CFLAGS="$CFLAGS -DHAVE_OPENGL"

View File

@ -161,7 +161,7 @@ if test x$have_opengles = xyes; then
fi fi
if test x$have_opengles2 = xyes; then if test x$have_opengles2 = xyes; then
CFLAGS="$CFLAGS -DHAVE_OPENGLES2" CFLAGS="$CFLAGS -DHAVE_OPENGLES2"
GLES2LIB="$XPATH -lGLESv2" #GLES2LIB="$XPATH -lGLESv2"
fi fi
if test x$have_opengl = xyes; then if test x$have_opengl = xyes; then
CFLAGS="$CFLAGS -DHAVE_OPENGL" CFLAGS="$CFLAGS -DHAVE_OPENGL"

View File

@ -24,9 +24,45 @@
#include "SDL_opengles2.h" #include "SDL_opengles2.h"
typedef struct GLES2_Context
{
#define SDL_PROC(ret,func,params) ret (APIENTRY *func) params;
#include "../src/render/opengles2/SDL_gles2funcs.h"
#undef SDL_PROC
} GLES2_Context;
static SDLTest_CommonState *state; static SDLTest_CommonState *state;
static SDL_GLContext *context = NULL; static SDL_GLContext *context = NULL;
static int depth = 16; static int depth = 16;
static GLES2_Context ctx;
static int LoadContext(GLES2_Context * data)
{
#if SDL_VIDEO_DRIVER_UIKIT
#define __SDL_NOGETPROCADDR__
#elif SDL_VIDEO_DRIVER_ANDROID
#define __SDL_NOGETPROCADDR__
#elif SDL_VIDEO_DRIVER_PANDORA
#define __SDL_NOGETPROCADDR__
#endif
#if defined __SDL_NOGETPROCADDR__
#define SDL_PROC(ret,func,params) data->func=func;
#else
#define SDL_PROC(ret,func,params) \
do { \
data->func = SDL_GL_GetProcAddress(#func); \
if ( ! data->func ) { \
return SDL_SetError("Couldn't load GLES2 function %s: %s\n", #func, SDL_GetError()); \
} \
} while ( 0 );
#endif /* _SDL_NOGETPROCADDR_ */
#include "../src/render/opengles2/SDL_gles2funcs.h"
#undef SDL_PROC
return 0;
}
/* Call this instead of exit(), so we can clean up SDL: atexit() is evil. */ /* Call this instead of exit(), so we can clean up SDL: atexit() is evil. */
static void static void
@ -51,9 +87,9 @@ quit(int rc)
#define GL_CHECK(x) \ #define GL_CHECK(x) \
x; \ x; \
{ \ { \
GLenum glError = glGetError(); \ GLenum glError = ctx.glGetError(); \
if(glError != GL_NO_ERROR) { \ if(glError != GL_NO_ERROR) { \
fprintf(stderr, "glGetError() = %i (0x%.8x) at line %i\n", glError, glError, __LINE__); \ SDL_Log("glGetError() = %i (0x%.8x) at line %i\n", glError, glError, __LINE__); \
quit(1); \ quit(1); \
} \ } \
} }
@ -157,25 +193,26 @@ multiply_matrix(float *lhs, float *rhs, float *r)
void void
process_shader(GLuint *shader, const char * source, GLint shader_type) process_shader(GLuint *shader, const char * source, GLint shader_type)
{ {
GLint status; GLint status = GL_FALSE;
const char *shaders[1] = { NULL }; const char *shaders[1] = { NULL };
/* Create shader and load into GL. */ /* Create shader and load into GL. */
*shader = GL_CHECK(glCreateShader(shader_type)); *shader = GL_CHECK(ctx.glCreateShader(shader_type));
shaders[0] = source; shaders[0] = source;
GL_CHECK(glShaderSource(*shader, 1, shaders, NULL)); GL_CHECK(ctx.glShaderSource(*shader, 1, shaders, NULL));
/* Clean up shader source. */ /* Clean up shader source. */
shaders[0] = NULL; shaders[0] = NULL;
/* Try compiling the shader. */ /* Try compiling the shader. */
GL_CHECK(glCompileShader(*shader)); GL_CHECK(ctx.glCompileShader(*shader));
GL_CHECK(glGetShaderiv(*shader, GL_COMPILE_STATUS, &status)); GL_CHECK(ctx.glGetShaderiv(*shader, GL_COMPILE_STATUS, &status));
// Dump debug info (source and log) if compilation failed. // Dump debug info (source and log) if compilation failed.
if(status != GL_TRUE) { if(status != GL_TRUE) {
SDL_Log("Shader compilation failed");
quit(-1); quit(-1);
} }
} }
@ -350,7 +387,7 @@ Render(unsigned int width, unsigned int height, shader_data* data)
perspective_matrix(45.0, (double)width/(double)height, 0.01, 100.0, matrix_perspective); perspective_matrix(45.0, (double)width/(double)height, 0.01, 100.0, matrix_perspective);
multiply_matrix(matrix_perspective, matrix_modelview, matrix_mvp); multiply_matrix(matrix_perspective, matrix_modelview, matrix_mvp);
GL_CHECK(glUniformMatrix4fv(data->attr_mvp, 1, GL_FALSE, matrix_mvp)); GL_CHECK(ctx.glUniformMatrix4fv(data->attr_mvp, 1, GL_FALSE, matrix_mvp));
data->angle_x += 3; data->angle_x += 3;
data->angle_y += 2; data->angle_y += 2;
@ -363,8 +400,8 @@ Render(unsigned int width, unsigned int height, shader_data* data)
if(data->angle_z >= 360) data->angle_z -= 360; if(data->angle_z >= 360) data->angle_z -= 360;
if(data->angle_z < 0) data->angle_z += 360; if(data->angle_z < 0) data->angle_z += 360;
GL_CHECK(glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT)); GL_CHECK(ctx.glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT));
GL_CHECK(glDrawArrays(GL_TRIANGLES, 0, 36)); GL_CHECK(ctx.glDrawArrays(GL_TRIANGLES, 0, 36));
} }
int int
@ -412,7 +449,7 @@ main(int argc, char *argv[])
} }
} }
if (consumed < 0) { if (consumed < 0) {
fprintf(stderr, "Usage: %s %s [--fsaa] [--accel] [--zdepth %%d]\n", argv[0], SDL_Log ("Usage: %s %s [--fsaa] [--accel] [--zdepth %%d]\n", argv[0],
SDLTest_CommonUsage(state)); SDLTest_CommonUsage(state));
quit(1); quit(1);
} }
@ -437,13 +474,13 @@ main(int argc, char *argv[])
state->gl_accelerated=1; state->gl_accelerated=1;
} }
if (!SDLTest_CommonInit(state)) { if (!SDLTest_CommonInit(state)) {
return;
quit(2); quit(2);
return 0;
} }
context = SDL_calloc(state->num_windows, sizeof(context)); context = SDL_calloc(state->num_windows, sizeof(context));
if (context == NULL) { if (context == NULL) {
fprintf(stderr, "Out of memory!\n"); SDL_Log("Out of memory!\n");
quit(2); quit(2);
} }
@ -451,11 +488,20 @@ main(int argc, char *argv[])
for (i = 0; i < state->num_windows; i++) { for (i = 0; i < state->num_windows; i++) {
context[i] = SDL_GL_CreateContext(state->windows[i]); context[i] = SDL_GL_CreateContext(state->windows[i]);
if (!context[i]) { if (!context[i]) {
fprintf(stderr, "SDL_GL_CreateContext(): %s\n", SDL_GetError()); SDL_Log("SDL_GL_CreateContext(): %s\n", SDL_GetError());
quit(2); quit(2);
} }
} }
/* Important: call this *after* creating the context */
if (LoadContext(&ctx) < 0) {
SDL_Log("Could not load GLES2 functions\n");
quit(2);
return 0;
}
if (state->render_flags & SDL_RENDERER_PRESENTVSYNC) { if (state->render_flags & SDL_RENDERER_PRESENTVSYNC) {
SDL_GL_SetSwapInterval(1); SDL_GL_SetSwapInterval(1);
} else { } else {
@ -463,65 +509,65 @@ main(int argc, char *argv[])
} }
SDL_GetCurrentDisplayMode(0, &mode); SDL_GetCurrentDisplayMode(0, &mode);
printf("Screen bpp: %d\n", SDL_BITSPERPIXEL(mode.format)); SDL_Log("Screen bpp: %d\n", SDL_BITSPERPIXEL(mode.format));
printf("\n"); SDL_Log("\n");
printf("Vendor : %s\n", glGetString(GL_VENDOR)); SDL_Log("Vendor : %s\n", ctx.glGetString(GL_VENDOR));
printf("Renderer : %s\n", glGetString(GL_RENDERER)); SDL_Log("Renderer : %s\n", ctx.glGetString(GL_RENDERER));
printf("Version : %s\n", glGetString(GL_VERSION)); SDL_Log("Version : %s\n", ctx.glGetString(GL_VERSION));
printf("Extensions : %s\n", glGetString(GL_EXTENSIONS)); SDL_Log("Extensions : %s\n", ctx.glGetString(GL_EXTENSIONS));
printf("\n"); SDL_Log("\n");
status = SDL_GL_GetAttribute(SDL_GL_RED_SIZE, &value); status = SDL_GL_GetAttribute(SDL_GL_RED_SIZE, &value);
if (!status) { if (!status) {
printf("SDL_GL_RED_SIZE: requested %d, got %d\n", 5, value); SDL_Log("SDL_GL_RED_SIZE: requested %d, got %d\n", 5, value);
} else { } else {
fprintf(stderr, "Failed to get SDL_GL_RED_SIZE: %s\n", SDL_Log( "Failed to get SDL_GL_RED_SIZE: %s\n",
SDL_GetError()); SDL_GetError());
} }
status = SDL_GL_GetAttribute(SDL_GL_GREEN_SIZE, &value); status = SDL_GL_GetAttribute(SDL_GL_GREEN_SIZE, &value);
if (!status) { if (!status) {
printf("SDL_GL_GREEN_SIZE: requested %d, got %d\n", 5, value); SDL_Log("SDL_GL_GREEN_SIZE: requested %d, got %d\n", 5, value);
} else { } else {
fprintf(stderr, "Failed to get SDL_GL_GREEN_SIZE: %s\n", SDL_Log( "Failed to get SDL_GL_GREEN_SIZE: %s\n",
SDL_GetError()); SDL_GetError());
} }
status = SDL_GL_GetAttribute(SDL_GL_BLUE_SIZE, &value); status = SDL_GL_GetAttribute(SDL_GL_BLUE_SIZE, &value);
if (!status) { if (!status) {
printf("SDL_GL_BLUE_SIZE: requested %d, got %d\n", 5, value); SDL_Log("SDL_GL_BLUE_SIZE: requested %d, got %d\n", 5, value);
} else { } else {
fprintf(stderr, "Failed to get SDL_GL_BLUE_SIZE: %s\n", SDL_Log( "Failed to get SDL_GL_BLUE_SIZE: %s\n",
SDL_GetError()); SDL_GetError());
} }
status = SDL_GL_GetAttribute(SDL_GL_DEPTH_SIZE, &value); status = SDL_GL_GetAttribute(SDL_GL_DEPTH_SIZE, &value);
if (!status) { if (!status) {
printf("SDL_GL_DEPTH_SIZE: requested %d, got %d\n", depth, value); SDL_Log("SDL_GL_DEPTH_SIZE: requested %d, got %d\n", depth, value);
} else { } else {
fprintf(stderr, "Failed to get SDL_GL_DEPTH_SIZE: %s\n", SDL_Log( "Failed to get SDL_GL_DEPTH_SIZE: %s\n",
SDL_GetError()); SDL_GetError());
} }
if (fsaa) { if (fsaa) {
status = SDL_GL_GetAttribute(SDL_GL_MULTISAMPLEBUFFERS, &value); status = SDL_GL_GetAttribute(SDL_GL_MULTISAMPLEBUFFERS, &value);
if (!status) { if (!status) {
printf("SDL_GL_MULTISAMPLEBUFFERS: requested 1, got %d\n", value); SDL_Log("SDL_GL_MULTISAMPLEBUFFERS: requested 1, got %d\n", value);
} else { } else {
fprintf(stderr, "Failed to get SDL_GL_MULTISAMPLEBUFFERS: %s\n", SDL_Log( "Failed to get SDL_GL_MULTISAMPLEBUFFERS: %s\n",
SDL_GetError()); SDL_GetError());
} }
status = SDL_GL_GetAttribute(SDL_GL_MULTISAMPLESAMPLES, &value); status = SDL_GL_GetAttribute(SDL_GL_MULTISAMPLESAMPLES, &value);
if (!status) { if (!status) {
printf("SDL_GL_MULTISAMPLESAMPLES: requested %d, got %d\n", fsaa, SDL_Log("SDL_GL_MULTISAMPLESAMPLES: requested %d, got %d\n", fsaa,
value); value);
} else { } else {
fprintf(stderr, "Failed to get SDL_GL_MULTISAMPLESAMPLES: %s\n", SDL_Log( "Failed to get SDL_GL_MULTISAMPLESAMPLES: %s\n",
SDL_GetError()); SDL_GetError());
} }
} }
if (accel) { if (accel) {
status = SDL_GL_GetAttribute(SDL_GL_ACCELERATED_VISUAL, &value); status = SDL_GL_GetAttribute(SDL_GL_ACCELERATED_VISUAL, &value);
if (!status) { if (!status) {
printf("SDL_GL_ACCELERATED_VISUAL: requested 1, got %d\n", value); SDL_Log("SDL_GL_ACCELERATED_VISUAL: requested 1, got %d\n", value);
} else { } else {
fprintf(stderr, "Failed to get SDL_GL_ACCELERATED_VISUAL: %s\n", SDL_Log( "Failed to get SDL_GL_ACCELERATED_VISUAL: %s\n",
SDL_GetError()); SDL_GetError());
} }
} }
@ -533,12 +579,12 @@ main(int argc, char *argv[])
status = SDL_GL_MakeCurrent(state->windows[i], context[i]); status = SDL_GL_MakeCurrent(state->windows[i], context[i]);
if (status) { if (status) {
printf("SDL_GL_MakeCurrent(): %s\n", SDL_GetError()); SDL_Log("SDL_GL_MakeCurrent(): %s\n", SDL_GetError());
/* Continue for next window */ /* Continue for next window */
continue; continue;
} }
glViewport(0, 0, state->window_w, state->window_h); ctx.glViewport(0, 0, state->window_w, state->window_h);
data = &datas[i]; data = &datas[i];
data->angle_x = 0; data->angle_y = 0; data->angle_z = 0; data->angle_x = 0; data->angle_y = 0; data->angle_z = 0;
@ -548,32 +594,32 @@ main(int argc, char *argv[])
process_shader(&data->shader_frag, _shader_frag_src, GL_FRAGMENT_SHADER); process_shader(&data->shader_frag, _shader_frag_src, GL_FRAGMENT_SHADER);
/* Create shader_program (ready to attach shaders) */ /* Create shader_program (ready to attach shaders) */
data->shader_program = GL_CHECK(glCreateProgram()); data->shader_program = GL_CHECK(ctx.glCreateProgram());
/* Attach shaders and link shader_program */ /* Attach shaders and link shader_program */
GL_CHECK(glAttachShader(data->shader_program, data->shader_vert)); GL_CHECK(ctx.glAttachShader(data->shader_program, data->shader_vert));
GL_CHECK(glAttachShader(data->shader_program, data->shader_frag)); GL_CHECK(ctx.glAttachShader(data->shader_program, data->shader_frag));
GL_CHECK(glLinkProgram(data->shader_program)); GL_CHECK(ctx.glLinkProgram(data->shader_program));
/* Get attribute locations of non-fixed attributes like color and texture coordinates. */ /* Get attribute locations of non-fixed attributes like color and texture coordinates. */
data->attr_position = GL_CHECK(glGetAttribLocation(data->shader_program, "av4position")); data->attr_position = GL_CHECK(ctx.glGetAttribLocation(data->shader_program, "av4position"));
data->attr_color = GL_CHECK(glGetAttribLocation(data->shader_program, "av3color")); data->attr_color = GL_CHECK(ctx.glGetAttribLocation(data->shader_program, "av3color"));
/* Get uniform locations */ /* Get uniform locations */
data->attr_mvp = GL_CHECK(glGetUniformLocation(data->shader_program, "mvp")); data->attr_mvp = GL_CHECK(ctx.glGetUniformLocation(data->shader_program, "mvp"));
GL_CHECK(glUseProgram(data->shader_program)); GL_CHECK(ctx.glUseProgram(data->shader_program));
/* Enable attributes for position, color and texture coordinates etc. */ /* Enable attributes for position, color and texture coordinates etc. */
GL_CHECK(glEnableVertexAttribArray(data->attr_position)); GL_CHECK(ctx.glEnableVertexAttribArray(data->attr_position));
GL_CHECK(glEnableVertexAttribArray(data->attr_color)); GL_CHECK(ctx.glEnableVertexAttribArray(data->attr_color));
/* Populate attributes for position, color and texture coordinates etc. */ /* Populate attributes for position, color and texture coordinates etc. */
GL_CHECK(glVertexAttribPointer(data->attr_position, 3, GL_FLOAT, GL_FALSE, 0, _vertices)); GL_CHECK(ctx.glVertexAttribPointer(data->attr_position, 3, GL_FLOAT, GL_FALSE, 0, _vertices));
GL_CHECK(glVertexAttribPointer(data->attr_color, 3, GL_FLOAT, GL_FALSE, 0, _colors)); GL_CHECK(ctx.glVertexAttribPointer(data->attr_color, 3, GL_FLOAT, GL_FALSE, 0, _colors));
GL_CHECK(glEnable(GL_CULL_FACE)); GL_CHECK(ctx.glEnable(GL_CULL_FACE));
GL_CHECK(glEnable(GL_DEPTH_TEST)); GL_CHECK(ctx.glEnable(GL_DEPTH_TEST));
} }
/* Main render loop */ /* Main render loop */
@ -592,11 +638,11 @@ main(int argc, char *argv[])
if (event.window.windowID == SDL_GetWindowID(state->windows[i])) { if (event.window.windowID == SDL_GetWindowID(state->windows[i])) {
status = SDL_GL_MakeCurrent(state->windows[i], context[i]); status = SDL_GL_MakeCurrent(state->windows[i], context[i]);
if (status) { if (status) {
printf("SDL_GL_MakeCurrent(): %s\n", SDL_GetError()); SDL_Log("SDL_GL_MakeCurrent(): %s\n", SDL_GetError());
break; break;
} }
/* Change view port to the new window dimensions */ /* Change view port to the new window dimensions */
glViewport(0, 0, event.window.data1, event.window.data2); ctx.glViewport(0, 0, event.window.data1, event.window.data2);
/* Update window content */ /* Update window content */
Render(event.window.data1, event.window.data2, &datas[i]); Render(event.window.data1, event.window.data2, &datas[i]);
SDL_GL_SwapWindow(state->windows[i]); SDL_GL_SwapWindow(state->windows[i]);
@ -611,7 +657,7 @@ main(int argc, char *argv[])
for (i = 0; i < state->num_windows; ++i) { for (i = 0; i < state->num_windows; ++i) {
status = SDL_GL_MakeCurrent(state->windows[i], context[i]); status = SDL_GL_MakeCurrent(state->windows[i], context[i]);
if (status) { if (status) {
printf("SDL_GL_MakeCurrent(): %s\n", SDL_GetError()); SDL_Log("SDL_GL_MakeCurrent(): %s\n", SDL_GetError());
/* Continue for next window */ /* Continue for next window */
continue; continue;
@ -624,11 +670,12 @@ main(int argc, char *argv[])
/* Print out some timing information */ /* Print out some timing information */
now = SDL_GetTicks(); now = SDL_GetTicks();
if (now > then) { if (now > then) {
printf("%2.2f frames per second\n", SDL_Log("%2.2f frames per second\n",
((double) frames * 1000) / (now - then)); ((double) frames * 1000) / (now - then));
} }
#if !defined(__ANDROID__) #if !defined(__ANDROID__)
quit(0); quit(0);
return 0;
#endif #endif
return 0; return 0;
} }
@ -638,7 +685,7 @@ main(int argc, char *argv[])
int int
main(int argc, char *argv[]) main(int argc, char *argv[])
{ {
printf("No OpenGL ES support on this system\n"); SDL_Log("No OpenGL ES support on this system\n");
return 1; return 1;
} }