Commit 49be2ad9 by Geoff Lang

Add an ANGLE sample framework.

BUG=angle:521 Change-Id: If1fc6198dbbe44f0ade5539cff540e3e086f2a3b Reviewed-on: https://chromium-review.googlesource.com/188722Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Tested-by: 's avatarGeoff Lang <geofflang@chromium.org>
parent f81e69b9
...@@ -36,12 +36,12 @@ ...@@ -36,12 +36,12 @@
</PropertyGroup> </PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile> <ClCompile>
<AdditionalIncludeDirectories>..\..\samples\gles2_book\Common;..\..\include;C:\Program Files (x86)\Windows Kits\8.0\Include\shared;C:\Program Files (x86)\Windows Kits\8.0\Include\um;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>..\..\samples\gles2_book\Common;..\..\include;..\..\samples\angle\sample_util;C:\Program Files (x86)\Windows Kits\8.0\Include\shared;C:\Program Files (x86)\Windows Kits\8.0\Include\um;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalOptions>/MP %(AdditionalOptions)</AdditionalOptions> <AdditionalOptions>/MP %(AdditionalOptions)</AdditionalOptions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<BufferSecurityCheck>true</BufferSecurityCheck> <BufferSecurityCheck>true</BufferSecurityCheck>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<DisableSpecificWarnings>4100;4127;4189;4239;4244;4245;4512;4702;4530;4718;%(DisableSpecificWarnings)</DisableSpecificWarnings> <DisableSpecificWarnings>4201;4100;4127;4189;4239;4244;4245;4512;4702;4530;4718;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<FunctionLevelLinking>true</FunctionLevelLinking> <FunctionLevelLinking>true</FunctionLevelLinking>
<MinimalRebuild>false</MinimalRebuild> <MinimalRebuild>false</MinimalRebuild>
<Optimization>Disabled</Optimization> <Optimization>Disabled</Optimization>
...@@ -65,18 +65,18 @@ ...@@ -65,18 +65,18 @@
<TargetMachine>MachineX86</TargetMachine> <TargetMachine>MachineX86</TargetMachine>
</Link> </Link>
<ResourceCompile> <ResourceCompile>
<AdditionalIncludeDirectories>..\..\samples\gles2_book\Common;..\..\include;C:\Program Files (x86)\Windows Kits\8.0\Include\shared;C:\Program Files (x86)\Windows Kits\8.0\Include\um;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>..\..\samples\gles2_book\Common;..\..\include;..\..\samples\angle\sample_util;C:\Program Files (x86)\Windows Kits\8.0\Include\shared;C:\Program Files (x86)\Windows Kits\8.0\Include\um;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<Culture>0x0409</Culture> <Culture>0x0409</Culture>
<PreprocessorDefinitions>ANGLE_TRANSLATOR_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>ANGLE_TRANSLATOR_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ResourceCompile> </ResourceCompile>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile> <ClCompile>
<AdditionalIncludeDirectories>..\..\samples\gles2_book\Common;..\..\include;C:\Program Files (x86)\Windows Kits\8.0\Include\shared;C:\Program Files (x86)\Windows Kits\8.0\Include\um;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>..\..\samples\gles2_book\Common;..\..\include;..\..\samples\angle\sample_util;C:\Program Files (x86)\Windows Kits\8.0\Include\shared;C:\Program Files (x86)\Windows Kits\8.0\Include\um;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalOptions>/MP %(AdditionalOptions)</AdditionalOptions> <AdditionalOptions>/MP %(AdditionalOptions)</AdditionalOptions>
<BufferSecurityCheck>true</BufferSecurityCheck> <BufferSecurityCheck>true</BufferSecurityCheck>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<DisableSpecificWarnings>4100;4127;4189;4239;4244;4245;4512;4702;4530;4718;%(DisableSpecificWarnings)</DisableSpecificWarnings> <DisableSpecificWarnings>4201;4100;4127;4189;4239;4244;4245;4512;4702;4530;4718;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<FunctionLevelLinking>true</FunctionLevelLinking> <FunctionLevelLinking>true</FunctionLevelLinking>
<MinimalRebuild>false</MinimalRebuild> <MinimalRebuild>false</MinimalRebuild>
<Optimization>MaxSpeed</Optimization> <Optimization>MaxSpeed</Optimization>
...@@ -100,7 +100,7 @@ ...@@ -100,7 +100,7 @@
<TargetMachine>MachineX86</TargetMachine> <TargetMachine>MachineX86</TargetMachine>
</Link> </Link>
<ResourceCompile> <ResourceCompile>
<AdditionalIncludeDirectories>..\..\samples\gles2_book\Common;..\..\include;C:\Program Files (x86)\Windows Kits\8.0\Include\shared;C:\Program Files (x86)\Windows Kits\8.0\Include\um;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>..\..\samples\gles2_book\Common;..\..\include;..\..\samples\angle\sample_util;C:\Program Files (x86)\Windows Kits\8.0\Include\shared;C:\Program Files (x86)\Windows Kits\8.0\Include\um;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<Culture>0x0409</Culture> <Culture>0x0409</Culture>
<PreprocessorDefinitions>ANGLE_TRANSLATOR_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>ANGLE_TRANSLATOR_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ResourceCompile> </ResourceCompile>
...@@ -149,6 +149,10 @@ ...@@ -149,6 +149,10 @@
<Project>{80E5C3D9-93C2-943E-176F-C9A903E27BC9}</Project> <Project>{80E5C3D9-93C2-943E-176F-C9A903E27BC9}</Project>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly> <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\samples\sample_util.vcxproj">
<Project>{297C46B0-9263-A9EA-82B1-EA221E7D7C7F}</Project>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
</ProjectReference>
<ProjectReference Include="..\samples\hello_triangle.vcxproj"> <ProjectReference Include="..\samples\hello_triangle.vcxproj">
<Project>{3F4D97A9-0809-E0E4-5A3F-B6ACB6EABB46}</Project> <Project>{3F4D97A9-0809-E0E4-5A3F-B6ACB6EABB46}</Project>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly> <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
......
...@@ -12,6 +12,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "All", "All.vcxproj", "{D048 ...@@ -12,6 +12,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "All", "All.vcxproj", "{D048
{B4D06330-EED1-6F99-BCA4-2F913908C38A} = {B4D06330-EED1-6F99-BCA4-2F913908C38A} {B4D06330-EED1-6F99-BCA4-2F913908C38A} = {B4D06330-EED1-6F99-BCA4-2F913908C38A}
{6BC75FF2-C11A-C393-F9BB-BF29FF29D736} = {6BC75FF2-C11A-C393-F9BB-BF29FF29D736} {6BC75FF2-C11A-C393-F9BB-BF29FF29D736} = {6BC75FF2-C11A-C393-F9BB-BF29FF29D736}
{80E5C3D9-93C2-943E-176F-C9A903E27BC9} = {80E5C3D9-93C2-943E-176F-C9A903E27BC9} {80E5C3D9-93C2-943E-176F-C9A903E27BC9} = {80E5C3D9-93C2-943E-176F-C9A903E27BC9}
{297C46B0-9263-A9EA-82B1-EA221E7D7C7F} = {297C46B0-9263-A9EA-82B1-EA221E7D7C7F}
{3F4D97A9-0809-E0E4-5A3F-B6ACB6EABB46} = {3F4D97A9-0809-E0E4-5A3F-B6ACB6EABB46} {3F4D97A9-0809-E0E4-5A3F-B6ACB6EABB46} = {3F4D97A9-0809-E0E4-5A3F-B6ACB6EABB46}
{A6E86EB3-561F-9FAB-670F-EF23556344BE} = {A6E86EB3-561F-9FAB-670F-EF23556344BE} {A6E86EB3-561F-9FAB-670F-EF23556344BE} = {A6E86EB3-561F-9FAB-670F-EF23556344BE}
{37E1BB43-65DC-A25A-042E-30B88E6C75A2} = {37E1BB43-65DC-A25A-042E-30B88E6C75A2} {37E1BB43-65DC-A25A-042E-30B88E6C75A2} = {37E1BB43-65DC-A25A-042E-30B88E6C75A2}
...@@ -99,6 +100,12 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "post_sub_buffer", "..\sampl ...@@ -99,6 +100,12 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "post_sub_buffer", "..\sampl
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "preprocessor", "..\src\preprocessor.vcxproj", "{C7BAF548-697D-2DCB-9DF3-9D1506A7B444}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "preprocessor", "..\src\preprocessor.vcxproj", "{C7BAF548-697D-2DCB-9DF3-9D1506A7B444}"
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sample_util", "..\samples\sample_util.vcxproj", "{297C46B0-9263-A9EA-82B1-EA221E7D7C7F}"
ProjectSection(ProjectDependencies) = postProject
{FBAEE4F6-562A-588F-01F9-72DCABB3B061} = {FBAEE4F6-562A-588F-01F9-72DCABB3B061}
{7FBD6F69-B9A4-69F1-A12B-8DACB3F8CD81} = {7FBD6F69-B9A4-69F1-A12B-8DACB3F8CD81}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "simple_texture_2d", "..\samples\simple_texture_2d.vcxproj", "{0BD6333E-E82C-7665-C386-CDA40096413D}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "simple_texture_2d", "..\samples\simple_texture_2d.vcxproj", "{0BD6333E-E82C-7665-C386-CDA40096413D}"
ProjectSection(ProjectDependencies) = postProject ProjectSection(ProjectDependencies) = postProject
{80E5C3D9-93C2-943E-176F-C9A903E27BC9} = {80E5C3D9-93C2-943E-176F-C9A903E27BC9} {80E5C3D9-93C2-943E-176F-C9A903E27BC9} = {80E5C3D9-93C2-943E-176F-C9A903E27BC9}
...@@ -158,6 +165,10 @@ Global ...@@ -158,6 +165,10 @@ Global
{293E74D1-544C-D368-02A0-52F61A4D0679}.Debug|Win32.Build.0 = Debug|Win32 {293E74D1-544C-D368-02A0-52F61A4D0679}.Debug|Win32.Build.0 = Debug|Win32
{293E74D1-544C-D368-02A0-52F61A4D0679}.Release|Win32.ActiveCfg = Release|Win32 {293E74D1-544C-D368-02A0-52F61A4D0679}.Release|Win32.ActiveCfg = Release|Win32
{293E74D1-544C-D368-02A0-52F61A4D0679}.Release|Win32.Build.0 = Release|Win32 {293E74D1-544C-D368-02A0-52F61A4D0679}.Release|Win32.Build.0 = Release|Win32
{297C46B0-9263-A9EA-82B1-EA221E7D7C7F}.Debug|Win32.ActiveCfg = Debug|Win32
{297C46B0-9263-A9EA-82B1-EA221E7D7C7F}.Debug|Win32.Build.0 = Debug|Win32
{297C46B0-9263-A9EA-82B1-EA221E7D7C7F}.Release|Win32.ActiveCfg = Release|Win32
{297C46B0-9263-A9EA-82B1-EA221E7D7C7F}.Release|Win32.Build.0 = Release|Win32
{37E1BB43-65DC-A25A-042E-30B88E6C75A2}.Debug|Win32.ActiveCfg = Debug|Win32 {37E1BB43-65DC-A25A-042E-30B88E6C75A2}.Debug|Win32.ActiveCfg = Debug|Win32
{37E1BB43-65DC-A25A-042E-30B88E6C75A2}.Debug|Win32.Build.0 = Debug|Win32 {37E1BB43-65DC-A25A-042E-30B88E6C75A2}.Debug|Win32.Build.0 = Debug|Win32
{37E1BB43-65DC-A25A-042E-30B88E6C75A2}.Release|Win32.ActiveCfg = Release|Win32 {37E1BB43-65DC-A25A-042E-30B88E6C75A2}.Release|Win32.ActiveCfg = Release|Win32
......
<?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="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{297C46B0-9263-A9EA-82B1-EA221E7D7C7F}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>sample_util</RootNamespace>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props"/>
<PropertyGroup Label="Configuration">
<CharacterSet>Unicode</CharacterSet>
<ConfigurationType>StaticLibrary</ConfigurationType>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props"/>
<ImportGroup Label="ExtensionSettings"/>
<ImportGroup Label="PropertySheets">
<Import Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"/>
</ImportGroup>
<PropertyGroup Label="UserMacros"/>
<PropertyGroup>
<ExecutablePath>$(ExecutablePath);$(MSBuildProjectDirectory)\..\..\third_party\cygwin\bin\;$(MSBuildProjectDirectory)\..\..\third_party\python_26\</ExecutablePath>
<OutDir>$(SolutionDir)$(Configuration)_$(Platform)\</OutDir>
<IntDir>$(OutDir)obj\$(ProjectName)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
<TargetName>$(ProjectName)</TargetName>
<TargetPath>$(OutDir)lib\$(ProjectName)$(TargetExt)</TargetPath>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<AdditionalIncludeDirectories>..\..\include;..\..\samples\angle\sample_util;C:\Program Files (x86)\Windows Kits\8.0\Include\shared;C:\Program Files (x86)\Windows Kits\8.0\Include\um;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalOptions>/MP %(AdditionalOptions)</AdditionalOptions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<BufferSecurityCheck>true</BufferSecurityCheck>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<DisableSpecificWarnings>4201;4100;4127;4189;4239;4244;4245;4512;4702;4530;4718;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<FunctionLevelLinking>true</FunctionLevelLinking>
<MinimalRebuild>false</MinimalRebuild>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;_SCL_SECURE_NO_WARNINGS;_HAS_EXCEPTIONS=0;_WIN32_WINNT=0x0600;_WINDOWS;NOMINMAX;WIN32;WIN32_LEAN_AND_MEAN;WINVER=0x0600;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<RuntimeTypeInfo>false</RuntimeTypeInfo>
<TreatWarningAsError>true</TreatWarningAsError>
<WarningLevel>Level4</WarningLevel>
</ClCompile>
<Lib>
<AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<OutputFile>$(OutDir)lib\$(ProjectName)$(TargetExt)</OutputFile>
</Lib>
<Link>
<AdditionalDependencies>kernel32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;user32.lib;uuid.lib;odbc32.lib;odbccp32.lib;delayimp.lib</AdditionalDependencies>
<AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<FixedBaseAddress>false</FixedBaseAddress>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ImportLibrary>$(OutDir)lib\$(TargetName).lib</ImportLibrary>
<MapFileName>$(OutDir)$(TargetName).map</MapFileName>
<SubSystem>Console</SubSystem>
<TargetMachine>MachineX86</TargetMachine>
</Link>
<ResourceCompile>
<AdditionalIncludeDirectories>..\..\include;..\..\samples\angle\sample_util;C:\Program Files (x86)\Windows Kits\8.0\Include\shared;C:\Program Files (x86)\Windows Kits\8.0\Include\um;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<Culture>0x0409</Culture>
</ResourceCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<AdditionalIncludeDirectories>..\..\include;..\..\samples\angle\sample_util;C:\Program Files (x86)\Windows Kits\8.0\Include\shared;C:\Program Files (x86)\Windows Kits\8.0\Include\um;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalOptions>/MP %(AdditionalOptions)</AdditionalOptions>
<BufferSecurityCheck>true</BufferSecurityCheck>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<DisableSpecificWarnings>4201;4100;4127;4189;4239;4244;4245;4512;4702;4530;4718;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<FunctionLevelLinking>true</FunctionLevelLinking>
<MinimalRebuild>false</MinimalRebuild>
<Optimization>MaxSpeed</Optimization>
<PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;_SCL_SECURE_NO_WARNINGS;_HAS_EXCEPTIONS=0;_WIN32_WINNT=0x0600;_WINDOWS;NOMINMAX;WIN32;WIN32_LEAN_AND_MEAN;WINVER=0x0600;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<RuntimeTypeInfo>false</RuntimeTypeInfo>
<TreatWarningAsError>true</TreatWarningAsError>
<WarningLevel>Level4</WarningLevel>
</ClCompile>
<Lib>
<AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<OutputFile>$(OutDir)lib\$(ProjectName)$(TargetExt)</OutputFile>
</Lib>
<Link>
<AdditionalDependencies>kernel32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;user32.lib;uuid.lib;odbc32.lib;odbccp32.lib;delayimp.lib</AdditionalDependencies>
<AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<FixedBaseAddress>false</FixedBaseAddress>
<GenerateDebugInformation>false</GenerateDebugInformation>
<ImportLibrary>$(OutDir)lib\$(TargetName).lib</ImportLibrary>
<MapFileName>$(OutDir)$(TargetName).map</MapFileName>
<SubSystem>Console</SubSystem>
<TargetMachine>MachineX86</TargetMachine>
</Link>
<ResourceCompile>
<AdditionalIncludeDirectories>..\..\include;..\..\samples\angle\sample_util;C:\Program Files (x86)\Windows Kits\8.0\Include\shared;C:\Program Files (x86)\Windows Kits\8.0\Include\um;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<Culture>0x0409</Culture>
</ResourceCompile>
</ItemDefinitionGroup>
<ItemGroup>
<None Include="..\..\samples\samples.gyp"/>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\samples\angle\sample_util\Window.h"/>
<ClInclude Include="..\..\samples\angle\sample_util\Vector.h"/>
<ClInclude Include="..\..\samples\angle\sample_util\keyboard.h"/>
<ClInclude Include="..\..\samples\angle\sample_util\shader_utils.h"/>
<ClInclude Include="..\..\samples\angle\sample_util\path_utils.h"/>
<ClInclude Include="..\..\samples\angle\sample_util\Timer.h"/>
<ClInclude Include="..\..\samples\angle\sample_util\mouse.h"/>
<ClInclude Include="..\..\samples\angle\sample_util\Event.h"/>
<ClInclude Include="..\..\samples\angle\sample_util\random_utils.h"/>
<ClInclude Include="..\..\samples\angle\sample_util\tga_utils.h"/>
<ClInclude Include="..\..\samples\angle\sample_util\SampleApplication.h"/>
<ClInclude Include="..\..\samples\angle\sample_util\win32\Win32Timer.h"/>
<ClInclude Include="..\..\samples\angle\sample_util\win32\Win32Window.h"/>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\samples\angle\sample_util\Window.cpp"/>
<ClCompile Include="..\..\samples\angle\sample_util\Vector.cpp"/>
<ClCompile Include="..\..\samples\angle\sample_util\shader_utils.cpp"/>
<ClCompile Include="..\..\samples\angle\sample_util\SampleApplication.cpp"/>
<ClCompile Include="..\..\samples\angle\sample_util\tga_utils.cpp"/>
<ClCompile Include="..\..\samples\angle\sample_util\random_utils.cpp"/>
<ClCompile Include="..\..\samples\angle\sample_util\win32\Win32Timer.cpp"/>
<ClCompile Include="..\..\samples\angle\sample_util\win32\Win32Window.cpp"/>
<ClCompile Include="..\..\samples\angle\sample_util\win32\Win32_path_utils.cpp"/>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\src\libEGL.vcxproj">
<Project>{FBAEE4F6-562A-588F-01F9-72DCABB3B061}</Project>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
</ProjectReference>
<ProjectReference Include="..\src\libGLESv2.vcxproj">
<Project>{7FBD6F69-B9A4-69F1-A12B-8DACB3F8CD81}</Project>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
</ProjectReference>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets"/>
<ImportGroup Label="ExtensionTargets"/>
</Project>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="angle">
<UniqueIdentifier>{2039F76D-4C9A-B8A0-444A-4766C6F6104A}</UniqueIdentifier>
</Filter>
<Filter Include="angle\sample_util">
<UniqueIdentifier>{60D21765-6E5A-8668-B584-931D7874AF54}</UniqueIdentifier>
</Filter>
<Filter Include="angle\sample_util\win32">
<UniqueIdentifier>{789FEF16-EFE7-512E-F91B-DF7E0D72FB79}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<None Include="..\..\samples\samples.gyp"/>
<ClCompile Include="..\..\samples\angle\sample_util\Window.cpp">
<Filter>angle\sample_util</Filter>
</ClCompile>
<ClInclude Include="..\..\samples\angle\sample_util\Window.h">
<Filter>angle\sample_util</Filter>
</ClInclude>
<ClInclude Include="..\..\samples\angle\sample_util\Vector.h">
<Filter>angle\sample_util</Filter>
</ClInclude>
<ClCompile Include="..\..\samples\angle\sample_util\Vector.cpp">
<Filter>angle\sample_util</Filter>
</ClCompile>
<ClInclude Include="..\..\samples\angle\sample_util\keyboard.h">
<Filter>angle\sample_util</Filter>
</ClInclude>
<ClInclude Include="..\..\samples\angle\sample_util\shader_utils.h">
<Filter>angle\sample_util</Filter>
</ClInclude>
<ClInclude Include="..\..\samples\angle\sample_util\path_utils.h">
<Filter>angle\sample_util</Filter>
</ClInclude>
<ClInclude Include="..\..\samples\angle\sample_util\Timer.h">
<Filter>angle\sample_util</Filter>
</ClInclude>
<ClCompile Include="..\..\samples\angle\sample_util\shader_utils.cpp">
<Filter>angle\sample_util</Filter>
</ClCompile>
<ClInclude Include="..\..\samples\angle\sample_util\mouse.h">
<Filter>angle\sample_util</Filter>
</ClInclude>
<ClInclude Include="..\..\samples\angle\sample_util\Event.h">
<Filter>angle\sample_util</Filter>
</ClInclude>
<ClCompile Include="..\..\samples\angle\sample_util\SampleApplication.cpp">
<Filter>angle\sample_util</Filter>
</ClCompile>
<ClInclude Include="..\..\samples\angle\sample_util\random_utils.h">
<Filter>angle\sample_util</Filter>
</ClInclude>
<ClCompile Include="..\..\samples\angle\sample_util\tga_utils.cpp">
<Filter>angle\sample_util</Filter>
</ClCompile>
<ClInclude Include="..\..\samples\angle\sample_util\tga_utils.h">
<Filter>angle\sample_util</Filter>
</ClInclude>
<ClCompile Include="..\..\samples\angle\sample_util\random_utils.cpp">
<Filter>angle\sample_util</Filter>
</ClCompile>
<ClInclude Include="..\..\samples\angle\sample_util\SampleApplication.h">
<Filter>angle\sample_util</Filter>
</ClInclude>
<ClInclude Include="..\..\samples\angle\sample_util\win32\Win32Timer.h">
<Filter>angle\sample_util\win32</Filter>
</ClInclude>
<ClCompile Include="..\..\samples\angle\sample_util\win32\Win32Timer.cpp">
<Filter>angle\sample_util\win32</Filter>
</ClCompile>
<ClCompile Include="..\..\samples\angle\sample_util\win32\Win32Window.cpp">
<Filter>angle\sample_util\win32</Filter>
</ClCompile>
<ClInclude Include="..\..\samples\angle\sample_util\win32\Win32Window.h">
<Filter>angle\sample_util\win32</Filter>
</ClInclude>
<ClCompile Include="..\..\samples\angle\sample_util\win32\Win32_path_utils.cpp">
<Filter>angle\sample_util\win32</Filter>
</ClCompile>
</ItemGroup>
</Project>
...@@ -75,6 +75,12 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "post_sub_buffer", "post_sub ...@@ -75,6 +75,12 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "post_sub_buffer", "post_sub
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "preprocessor", "..\src\preprocessor.vcxproj", "{C7BAF548-697D-2DCB-9DF3-9D1506A7B444}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "preprocessor", "..\src\preprocessor.vcxproj", "{C7BAF548-697D-2DCB-9DF3-9D1506A7B444}"
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sample_util", "sample_util.vcxproj", "{297C46B0-9263-A9EA-82B1-EA221E7D7C7F}"
ProjectSection(ProjectDependencies) = postProject
{FBAEE4F6-562A-588F-01F9-72DCABB3B061} = {FBAEE4F6-562A-588F-01F9-72DCABB3B061}
{7FBD6F69-B9A4-69F1-A12B-8DACB3F8CD81} = {7FBD6F69-B9A4-69F1-A12B-8DACB3F8CD81}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "simple_texture_2d", "simple_texture_2d.vcxproj", "{0BD6333E-E82C-7665-C386-CDA40096413D}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "simple_texture_2d", "simple_texture_2d.vcxproj", "{0BD6333E-E82C-7665-C386-CDA40096413D}"
ProjectSection(ProjectDependencies) = postProject ProjectSection(ProjectDependencies) = postProject
{80E5C3D9-93C2-943E-176F-C9A903E27BC9} = {80E5C3D9-93C2-943E-176F-C9A903E27BC9} {80E5C3D9-93C2-943E-176F-C9A903E27BC9} = {80E5C3D9-93C2-943E-176F-C9A903E27BC9}
...@@ -134,6 +140,10 @@ Global ...@@ -134,6 +140,10 @@ Global
{293E74D1-544C-D368-02A0-52F61A4D0679}.Debug|Win32.Build.0 = Debug|Win32 {293E74D1-544C-D368-02A0-52F61A4D0679}.Debug|Win32.Build.0 = Debug|Win32
{293E74D1-544C-D368-02A0-52F61A4D0679}.Release|Win32.ActiveCfg = Release|Win32 {293E74D1-544C-D368-02A0-52F61A4D0679}.Release|Win32.ActiveCfg = Release|Win32
{293E74D1-544C-D368-02A0-52F61A4D0679}.Release|Win32.Build.0 = Release|Win32 {293E74D1-544C-D368-02A0-52F61A4D0679}.Release|Win32.Build.0 = Release|Win32
{297C46B0-9263-A9EA-82B1-EA221E7D7C7F}.Debug|Win32.ActiveCfg = Debug|Win32
{297C46B0-9263-A9EA-82B1-EA221E7D7C7F}.Debug|Win32.Build.0 = Debug|Win32
{297C46B0-9263-A9EA-82B1-EA221E7D7C7F}.Release|Win32.ActiveCfg = Release|Win32
{297C46B0-9263-A9EA-82B1-EA221E7D7C7F}.Release|Win32.Build.0 = Release|Win32
{37E1BB43-65DC-A25A-042E-30B88E6C75A2}.Debug|Win32.ActiveCfg = Debug|Win32 {37E1BB43-65DC-A25A-042E-30B88E6C75A2}.Debug|Win32.ActiveCfg = Debug|Win32
{37E1BB43-65DC-A25A-042E-30B88E6C75A2}.Debug|Win32.Build.0 = Debug|Win32 {37E1BB43-65DC-A25A-042E-30B88E6C75A2}.Debug|Win32.Build.0 = Debug|Win32
{37E1BB43-65DC-A25A-042E-30B88E6C75A2}.Release|Win32.ActiveCfg = Release|Win32 {37E1BB43-65DC-A25A-042E-30B88E6C75A2}.Release|Win32.ActiveCfg = Release|Win32
......
//
// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
#ifndef SAMPLE_UTIL_EVENT_H
#define SAMPLE_UTIL_EVENT_H
#include "keyboard.h"
#include "mouse.h"
class Event
{
public:
struct MoveEvent
{
int X;
int Y;
};
struct SizeEvent
{
int Width;
int Height;
};
struct KeyEvent
{
Key Code;
bool Alt;
bool Control;
bool Shift;
bool System;
};
struct MouseMoveEvent
{
int X;
int Y;
};
struct MouseButtonEvent
{
MouseButton Button;
int X;
int Y;
};
struct MouseWheelEvent
{
int Delta;
};
enum EventType
{
EVENT_CLOSED, // The window requested to be closed
EVENT_MOVED, // The window has moved
EVENT_RESIZED, // The window was resized
EVENT_LOST_FOCUS, // The window lost the focus
EVENT_GAINED_FOCUS, // The window gained the focus
EVENT_TEXT_ENTERED, // A character was entered
EVENT_KEY_PRESSED, // A key was pressed
EVENT_KEY_RELEASED, // A key was released
EVENT_MOUSE_WHEEL_MOVED, // The mouse wheel was scrolled
EVENT_MOUSE_BUTTON_PRESSED, // A mouse button was pressed
EVENT_MOUSE_BUTTON_RELEASED, // A mouse button was released
EVENT_MOUSE_MOVED, // The mouse cursor moved
EVENT_MOUSE_ENTERED, // The mouse cursor entered the area of the window
EVENT_MOUSE_LEFT, // The mouse cursor left the area of the window
};
EventType Type;
union
{
MoveEvent Move; // Move event parameters
SizeEvent Size; // Size event parameters
KeyEvent Key; // Key event parameters
MouseMoveEvent MouseMove; // Mouse move event parameters
MouseButtonEvent MouseButton; // Mouse button event parameters
MouseWheelEvent MouseWheel; // Mouse wheel event parameters
};
};
#endif SAMPLE_UTIL_EVENT_H
//
// Copyright (c) 2013 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
#include "SampleApplication.h"
#ifdef _WIN32
#include "win32/Win32Timer.h"
#include "win32/Win32Window.h"
#else
#error unsupported OS.
#endif
SampleApplication::SampleApplication(const std::string& name, size_t width, size_t height)
: mClientVersion(2),
mWidth(width),
mHeight(height),
mName(name),
mRunning(false),
#ifdef _WIN32
mTimer(new Win32Timer()),
mWindow(new Win32Window())
#endif
{
}
SampleApplication::~SampleApplication()
{
}
bool SampleApplication::initialize()
{
return true;
}
void SampleApplication::destroy()
{
}
void SampleApplication::step(float dt, double totalTime)
{
}
void SampleApplication::draw()
{
}
Window *SampleApplication::getWindow() const
{
return mWindow.get();
}
int SampleApplication::run()
{
if (!mWindow->initialize(mName, mWidth, mHeight) || !initializeGL())
{
return -1;
}
mRunning = true;
int result = 0;
if (!initialize())
{
mRunning = false;
result = -1;
}
mTimer->start();
double prevTime = 0.0;
while (mRunning)
{
double elapsedTime = mTimer->getElapsedTime();
double deltaTime = elapsedTime - prevTime;
step(static_cast<float>(deltaTime), elapsedTime);
// Clear events that the application did not process from this frame
Event event;
while (popEvent(&event))
{
// If the application did not catch a close event, close now
if (event.Type == Event::EVENT_CLOSED)
{
exit();
}
}
if (!mRunning)
{
break;
}
draw();
eglSwapBuffers(mWindow->getDisplay(), mSurface);
mWindow->messageLoop();
prevTime = elapsedTime;
}
destroy();
destroyGL();
mWindow->destroy();
return result;
}
void SampleApplication::exit()
{
mRunning = false;
}
bool SampleApplication::popEvent(Event *event)
{
return mWindow->popEvent(event);
}
bool SampleApplication::initializeGL()
{
const EGLint configAttributes[] =
{
EGL_RED_SIZE, 8,
EGL_GREEN_SIZE, 8,
EGL_BLUE_SIZE, 8,
EGL_ALPHA_SIZE, 8,
EGL_DEPTH_SIZE, 24,
EGL_STENCIL_SIZE, 8,
EGL_SAMPLE_BUFFERS, EGL_DONT_CARE,
EGL_NONE
};
EGLint configCount;
if (!eglChooseConfig(mWindow->getDisplay(), configAttributes, &mConfig, 1, &configCount) || (configCount != 1))
{
destroyGL();
return false;
}
mSurface = eglCreateWindowSurface(mWindow->getDisplay(), mConfig, mWindow->getNativeWindow(), NULL);
if (mSurface == EGL_NO_SURFACE)
{
eglGetError(); // Clear error and try again
mSurface = eglCreateWindowSurface(mWindow->getDisplay(), mConfig, NULL, NULL);
}
if (eglGetError() != EGL_SUCCESS)
{
destroyGL();
return false;
}
EGLint contextAttibutes[] =
{
EGL_CONTEXT_CLIENT_VERSION, mClientVersion,
EGL_NONE
};
mContext = eglCreateContext(mWindow->getDisplay(), mConfig, NULL, contextAttibutes);
if (eglGetError() != EGL_SUCCESS)
{
destroyGL();
return false;
}
eglMakeCurrent(mWindow->getDisplay(), mSurface, mSurface, mContext);
if (eglGetError() != EGL_SUCCESS)
{
destroyGL();
return false;
}
// Turn off vsync
eglSwapInterval(mWindow->getDisplay(), 0);
return true;
}
void SampleApplication::destroyGL()
{
eglDestroySurface(mWindow->getDisplay(), mSurface);
mSurface = 0;
eglDestroyContext(mWindow->getDisplay(), mContext);
mContext = 0;
}
//
// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
#ifndef SAMPLE_UTIL_SAMPLE_APPLICATION_H
#define SAMPLE_UTIL_SAMPLE_APPLICATION_H
#define GL_GLEXT_PROTOTYPES
#include <GLES3/gl3.h>
#include <GLES3/gl3ext.h>
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
#include "Window.h"
#include "Timer.h"
#include <string>
#include <list>
#include <cstdint>
#include <memory>
class SampleApplication
{
public:
SampleApplication(const std::string& name, size_t width, size_t height);
virtual ~SampleApplication();
virtual bool initialize();
virtual void destroy();
virtual void step(float dt, double totalTime);
virtual void draw();
Window *getWindow() const;
bool popEvent(Event *event);
int run();
void exit();
private:
bool initializeGL();
void destroyGL();
EGLConfig mConfig;
EGLSurface mSurface;
EGLContext mContext;
GLuint mClientVersion;
size_t mWidth;
size_t mHeight;
std::string mName;
bool mRunning;
std::unique_ptr<Timer> mTimer;
std::unique_ptr<Window> mWindow;
};
#endif // SAMPLE_UTIL_SAMPLE_APPLICATION_H
//
// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
#ifndef SAMPLE_UTIL_TIMER_H
#define SAMPLE_UTIL_TIMER_H
class Timer
{
public:
virtual void start() = 0;
virtual void stop() = 0;
virtual double getElapsedTime() const = 0;
};
#endif // SAMPLE_UTIL_TIMER_H
//
// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
#include "Vector.h"
#include <math.h>
Vector3::Vector3()
: x(0.0),
y(0.0),
z(0.0)
{
}
Vector3::Vector3(float x, float y, float z)
: x(x),
y(y),
z(z)
{
}
float Vector3::length(const Vector3 &vec)
{
float lenSquared = lengthSquared(vec);
return (lenSquared != 0.0f) ? sqrt(lenSquared) : 0.0f;
}
float Vector3::lengthSquared(const Vector3 &vec)
{
return vec.x * vec.x +
vec.y * vec.y +
vec.z * vec.z;
}
Vector3 Vector3::normalize(const Vector3 &vec)
{
Vector3 ret(0.0f, 0.0f, 0.0f);
float len = length(vec);
if (len != 0.0f)
{
float invLen = 1.0f / len;
ret.x = vec.x * invLen;
ret.y = vec.y * invLen;
ret.z = vec.z * invLen;
}
return ret;
}
float Vector3::dot(const Vector3 &a, const Vector3 &b)
{
return a.x * b.x +
a.y * b.y +
a.z * b.z;
}
Vector3 Vector3::cross(const Vector3 &a, const Vector3 &b)
{
return Vector3(a.y * b.z - a.z * b.y,
a.z * b.x - a.x * b.z,
a.x * b.y - a.y * b.x);
}
Vector3 operator*(const Vector3 &a, const Vector3 &b)
{
return Vector3(a.x * b.x,
a.y * b.y,
a.z * b.z);
}
Vector3 operator*(const Vector3 &a, const float& b)
{
return Vector3(a.x * b,
a.y * b,
a.z * b);
}
Vector3 operator/(const Vector3 &a, const Vector3 &b)
{
return Vector3(a.x / b.x,
a.y / b.y,
a.z / b.z);
}
Vector3 operator/(const Vector3 &a, const float& b)
{
return Vector3(a.x / b,
a.y / b,
a.z / b);
}
Vector3 operator+(const Vector3 &a, const Vector3 &b)
{
return Vector3(a.x + b.x,
a.y + b.y,
a.z + b.z);
}
Vector3 operator-(const Vector3 &a, const Vector3 &b)
{
return Vector3(a.x - b.x,
a.y - b.y,
a.z - b.z);
}
Vector4::Vector4()
: x(0.0f),
y(0.0f),
z(0.0f),
w(0.0f)
{
}
Vector4::Vector4(float x, float y, float z, float w)
: x(x),
y(y),
z(z),
w(w)
{
}
float Vector4::length(const Vector4 &vec)
{
float lenSquared = lengthSquared(vec);
return (lenSquared != 0.0f) ? sqrt(lenSquared) : 0.0f;
}
float Vector4::lengthSquared(const Vector4 &vec)
{
return vec.x * vec.x +
vec.y * vec.y +
vec.z * vec.z +
vec.w * vec.w;
}
Vector4 Vector4::normalize(const Vector4 &vec)
{
Vector4 ret(0.0f, 0.0f, 0.0f, 1.0f);
if (vec.w != 0.0f)
{
float invLen = 1.0f / vec.w;
ret.x = vec.x * invLen;
ret.y = vec.y * invLen;
ret.z = vec.z * invLen;
}
return ret;
}
float Vector4::dot(const Vector4 &a, const Vector4 &b)
{
return a.x * b.x +
a.y * b.y +
a.z * b.z +
a.w * b.w;
}
//
// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
#ifndef SAMPLE_UTIL_VECTOR_H
#define SAMPLE_UTIL_VECTOR_H
struct Vector3
{
union
{
struct
{
float x, y, z;
};
float data[3];
};
Vector3();
Vector3(float x, float y, float z);
static float length(const Vector3 &vec);
static float lengthSquared(const Vector3 &vec);
static Vector3 normalize(const Vector3 &vec);
static float dot(const Vector3 &a, const Vector3 &b);
static Vector3 cross(const Vector3 &a, const Vector3 &b);
};
Vector3 operator*(const Vector3 &a, const Vector3 &b);
Vector3 operator*(const Vector3 &a, const float& b);
Vector3 operator/(const Vector3 &a, const Vector3 &b);
Vector3 operator/(const Vector3 &a, const float& b);
Vector3 operator+(const Vector3 &a, const Vector3 &b);
Vector3 operator-(const Vector3 &a, const Vector3 &b);
struct Vector4
{
union
{
struct
{
float x, y, z, w;
};
float data[4];
};
Vector4();
Vector4(float x, float y, float z, float w);
static float length(const Vector4 &vec);
static float lengthSquared(const Vector4 &vec);
static Vector4 normalize(const Vector4 &vec);
static float dot(const Vector4 &a, const Vector4 &b);
};
#endif // SAMPLE_UTIL_VECTOR_H
//
// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
#include "Window.h"
Window::Window()
: mWidth(0),
mHeight(0)
{
}
int Window::getWidth() const
{
return mWidth;
}
int Window::getHeight() const
{
return mHeight;
}
bool Window::popEvent(Event *event)
{
if (mEvents.size() > 0 && event)
{
*event = mEvents.front();
mEvents.pop_front();
return true;
}
else
{
return false;
}
}
void Window::pushEvent(Event event)
{
switch (event.Type)
{
case Event::EVENT_RESIZED:
mWidth = event.Size.Width;
mHeight = event.Size.Height;
break;
}
mEvents.push_back(event);
}
//
// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
#ifndef SAMPLE_UTIL_WINDOW_H
#define SAMPLE_UTIL_WINDOW_H
#include "Event.h"
#include <EGL/egl.h>
#include <EGL/eglext.h>
#include <list>
class Window
{
public:
Window();
virtual bool initialize(const std::string &name, size_t width, size_t height) = 0;
virtual void destroy() = 0;
int getWidth() const;
int getHeight() const;
virtual void setMousePosition(int x, int y) = 0;
virtual EGLDisplay getDisplay() const = 0;
virtual EGLNativeWindowType getNativeWindow() const = 0;
virtual EGLNativeDisplayType getNativeDisplay() const = 0;
virtual void messageLoop() = 0;
bool popEvent(Event *event);
void pushEvent(Event event);
private:
int mWidth;
int mHeight;
std::list<Event> mEvents;
};
#endif // SAMPLE_UTIL_WINDOW_H
//
// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
#ifndef SAMPLE_UTIL_KEYBOARD_H
#define SAMPLE_UTIL_KEYBOARD_H
enum Key
{
KEY_UNKNOWN,
KEY_A, // The A key
KEY_B, // The B key
KEY_C, // The C key
KEY_D, // The D key
KEY_E, // The E key
KEY_F, // The F key
KEY_G, // The G key
KEY_H, // The H key
KEY_I, // The I key
KEY_J, // The J key
KEY_K, // The K key
KEY_L, // The L key
KEY_M, // The M key
KEY_N, // The N key
KEY_O, // The O key
KEY_P, // The P key
KEY_Q, // The Q key
KEY_R, // The R key
KEY_S, // The S key
KEY_T, // The T key
KEY_U, // The U key
KEY_V, // The V key
KEY_W, // The W key
KEY_X, // The X key
KEY_Y, // The Y key
KEY_Z, // The Z key
KEY_NUM0, // The 0 key
KEY_NUM1, // The 1 key
KEY_NUM2, // The 2 key
KEY_NUM3, // The 3 key
KEY_NUM4, // The 4 key
KEY_NUM5, // The 5 key
KEY_NUM6, // The 6 key
KEY_NUM7, // The 7 key
KEY_NUM8, // The 8 key
KEY_NUM9, // The 9 key
KEY_ESCAPE, // The escape key
KEY_LCONTROL, // The left control key
KEY_LSHIFT, // The left shift key
KEY_LALT, // The left alt key
KEY_LSYSTEM, // The left OS specific key: Window (Windows and Linux), Apple (MacOS X), ...
KEY_RCONTROL, // The right control key
KEY_RSHIFT, // The right shift key
KEY_RALT, // The right alt key
KEY_RSYSTEM, // The right OS specific key: Window (Windows and Linux), Apple (MacOS X), ...
KEY_MENU, // The menu key
KEY_LBRACKET, // The [ key
KEY_RBRACKET, // The ] key
KEY_SEMICOLON, // The ; key
KEY_COMMA, // The , key
KEY_PERIOD, // The . key
KEY_QUOTE, // The ' key
KEY_SLASH, // The / key
KEY_BACKSLASH, // The \ key
KEY_TILDE, // The ~ key
KEY_EQUAL, // The = key
KEY_DASH, // The - key
KEY_SPACE, // The space key
KEY_RETURN, // The return key
KEY_BACK, // The backspace key
KEY_TAB, // The tabulation key
KEY_PAGEUP, // The page up key
KEY_PAGEDOWN, // The page down key
KEY_END, // The end key
KEY_HOME, // The home key
KEY_INSERT, // The insert key
KEY_DELETE, // The delete key
KEY_ADD, // +
KEY_SUBTRACT, // -
KEY_MULTIPLY, // *
KEY_DIVIDE, // /
KEY_LEFT, // Left arrow
KEY_RIGHT, // Right arrow
KEY_UP, // Up arrow
KEY_DOWN, // Down arrow
KEY_NUMPAD0, // The numpad 0 key
KEY_NUMPAD1, // The numpad 1 key
KEY_NUMPAD2, // The numpad 2 key
KEY_NUMPAD3, // The numpad 3 key
KEY_NUMPAD4, // The numpad 4 key
KEY_NUMPAD5, // The numpad 5 key
KEY_NUMPAD6, // The numpad 6 key
KEY_NUMPAD7, // The numpad 7 key
KEY_NUMPAD8, // The numpad 8 key
KEY_NUMPAD9, // The numpad 9 key
KEY_F1, // The F1 key
KEY_F2, // The F2 key
KEY_F3, // The F3 key
KEY_F4, // The F4 key
KEY_F5, // The F5 key
KEY_F6, // The F6 key
KEY_F7, // The F7 key
KEY_F8, // The F8 key
KEY_F9, // The F8 key
KEY_F10, // The F10 key
KEY_F11, // The F11 key
KEY_F12, // The F12 key
KEY_F13, // The F13 key
KEY_F14, // The F14 key
KEY_F15, // The F15 key
KEY_PAUSE, // The pause key
KEY_COUNT,
};
#endif // SAMPLE_UTIL_KEYBOARD_H
//
// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
#ifndef SAMPLE_UTIL_MOUSE_H
#define SAMPLE_UTIL_MOUSE_H
enum MouseButton
{
MOUSEBUTTON_UNKNOWN,
MOUSEBUTTON_LEFT,
MOUSEBUTTON_RIGHT,
MOUSEBUTTON_MIDDLE,
MOUSEBUTTON_BUTTON4,
MOUSEBUTTON_BUTTON5,
MOUSEBUTTON_COUNT,
};
#endif // SAMPLE_UTIL_MOUSE_H
//
// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
#ifndef SAMPLE_UTIL_PATH_UTILS_H
#define SAMPLE_UTIL_PATH_UTILS_H
#include <string>
std::string GetExecutablePath();
std::string GetExecutableDirectory();
#endif // SAMPLE_UTIL_PATH_UTILS_H
//
// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
#include "random_utils.h"
#include <time.h>
#include <cstdlib>
float RandomBetween(float min, float max)
{
static bool randInitialized = false;
if (!randInitialized)
{
srand(time(NULL));
randInitialized = true;
}
const size_t divisor = 10000;
return min + ((rand() % divisor) / static_cast<float>(divisor)) * (max - min);
}
//
// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
#ifndef SAMPLE_UTIL_RANDOM_UTILS_H
#define SAMPLE_UTIL_RANDOM_UTILS_H
float RandomBetween(float min, float max);
#endif // SAMPLE_UTIL_RANDOM_UTILS_H
//
// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
#include "shader_utils.h"
#include <vector>
#include <iostream>
GLuint CompileShader(GLenum type, const std::string &source)
{
GLuint shader = glCreateShader(type);
const char *sourceArray[1] = { source.c_str() };
glShaderSource(shader, 1, sourceArray, NULL);
glCompileShader(shader);
GLint compileResult;
glGetShaderiv(shader, GL_COMPILE_STATUS, &compileResult);
if (compileResult == 0)
{
GLint infoLogLength;
glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &infoLogLength);
std::vector<GLchar> infoLog(infoLogLength);
glGetShaderInfoLog(shader, infoLog.size(), NULL, infoLog.data());
std::cerr << "shader compilation failed: " << infoLog.data();
glDeleteShader(shader);
shader = 0;
}
return shader;
}
GLuint CompileProgram(const std::string &vsSource, const std::string &fsSource)
{
GLuint program = glCreateProgram();
GLuint vs = CompileShader(GL_VERTEX_SHADER, vsSource);
GLuint fs = CompileShader(GL_FRAGMENT_SHADER, fsSource);
if (vs == 0 || fs == 0)
{
glDeleteShader(fs);
glDeleteShader(vs);
glDeleteProgram(program);
return 0;
}
glAttachShader(program, vs);
glDeleteShader(vs);
glAttachShader(program, fs);
glDeleteShader(fs);
glLinkProgram(program);
GLint linkStatus;
glGetProgramiv(program, GL_LINK_STATUS, &linkStatus);
if (linkStatus == 0)
{
GLint infoLogLength;
glGetProgramiv(program, GL_INFO_LOG_LENGTH, &infoLogLength);
std::vector<GLchar> infoLog(infoLogLength);
glGetProgramInfoLog(program, infoLog.size(), NULL, infoLog.data());
std::cerr << "program link failed: " << infoLog.data();
glDeleteProgram(program);
return 0;
}
return program;
}
//
// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
#ifndef SAMPLE_UTIL_SHADER_UTILS_H
#define SAMPLE_UTIL_SHADER_UTILS_H
#define GL_GLEXT_PROTOTYPES
#include <GLES3/gl3.h>
#include <GLES3/gl3ext.h>
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
#include <EGL/egl.h>
#include <EGL/eglext.h>
#include <string>
#define SHADER_SOURCE(...) #__VA_ARGS__
GLuint CompileShader(GLenum type, const std::string &source);
GLuint CompileProgram(const std::string &vsSource, const std::string &fsSource);
#endif // SAMPLE_UTIL_SHADER_UTILS_H
//
// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
#include "tga_utils.h"
#include <iostream>
#include <fstream>
#include <string>
#include <cstdint>
TGAImage::TGAImage()
: data(0), width(0), height(0)
{
}
struct TGAHeader
{
uint8_t idSize;
uint8_t mapType;
uint8_t imageType;
uint16_t paletteStart;
uint16_t paletteSize;
uint8_t paletteEntryDepth;
uint16_t x;
uint16_t y;
uint16_t width;
uint16_t height;
uint8_t colorDepth;
uint8_t descriptor;
};
#define INVERTED_BIT (1 << 5)
template <typename dataType>
void readBinary(std::ifstream &stream, dataType &item)
{
stream.read(reinterpret_cast<char *>(&item), sizeof(dataType));
}
template <typename dataType>
void readBinary(std::ifstream &stream, std::vector<dataType> &items)
{
stream.read(reinterpret_cast<char *>(items.data()), sizeof(dataType) * items.size());
}
bool LoadTGAImageFromFile(const std::string &path, TGAImage *image)
{
std::ifstream stream(path, std::ios::binary);
if (!stream)
{
std::cerr << "error opening tga file " << path << " for reading.\n";
return false;
}
TGAHeader header;
readBinary(stream, header.idSize);
readBinary(stream, header.mapType);
readBinary(stream, header.imageType);
readBinary(stream, header.paletteStart);
readBinary(stream, header.paletteSize);
readBinary(stream, header.paletteEntryDepth);
readBinary(stream, header.x);
readBinary(stream, header.y);
readBinary(stream, header.width);
readBinary(stream, header.height);
readBinary(stream, header.colorDepth);
readBinary(stream, header.descriptor);
image->width = header.width;
image->height = header.height;
size_t pixelComponentCount = header.colorDepth / CHAR_BIT;
std::vector<unsigned char> buffer(header.width * header.height * pixelComponentCount);
readBinary(stream, buffer);
image->data.reserve(header.width * header.height);
for (size_t y = 0; y < header.height; y++)
{
size_t rowIdx = ((header.descriptor & INVERTED_BIT) ? (header.height - 1 - y) : y) * header.width * pixelComponentCount;
for (size_t x = 0; x < header.width; x++)
{
size_t pixelIdx = rowIdx + x * pixelComponentCount;
Byte4 pixel;
pixel[0] = (pixelComponentCount > 2) ? buffer[pixelIdx + 2] : 0;
pixel[2] = (pixelComponentCount > 0) ? buffer[pixelIdx + 0] : 0;
pixel[1] = (pixelComponentCount > 1) ? buffer[pixelIdx + 1] : 0;
pixel[3] = (pixelComponentCount > 3) ? buffer[pixelIdx + 3] : 255;
image->data.push_back(pixel);
}
}
std::cout << "loaded image " << path << ".\n";
return true;
}
GLuint LoadTextureFromTGAImage(const TGAImage &image)
{
if (image.width > 0 && image.height > 0)
{
GLuint texture;
glGenTextures(1, &texture);
glBindTexture(GL_TEXTURE_2D, texture);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, static_cast<GLsizei>(image.width), static_cast<GLsizei>(image.height), 0,
GL_RGBA, GL_UNSIGNED_BYTE, image.data.data());
glGenerateMipmap(GL_TEXTURE_2D);
return texture;
}
else
{
return 0;
}
}
//
// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
#ifndef SAMPLE_UTIL_TGA_UTILS_HPP
#define SAMPLE_UTIL_TGA_UTILS_HPP
#include <GLES2/gl2.h>
#include <array>
#include <vector>
typedef std::array<unsigned char, 4> Byte4;
struct TGAImage
{
size_t width;
size_t height;
std::vector<Byte4> data;
TGAImage();
};
bool LoadTGAImageFromFile(const std::string &path, TGAImage *image);
GLuint LoadTextureFromTGAImage(const TGAImage &image);
#endif // SAMPLE_UTIL_TGA_UTILS_HPP
//
// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
#include "win32/Win32Timer.h"
Win32Timer::Win32Timer()
: mRunning(0),
mStartTime(0),
mStopTime(0)
{
}
void Win32Timer::start()
{
LARGE_INTEGER frequency;
QueryPerformanceFrequency(&frequency);
mFrequency = frequency.QuadPart;
LARGE_INTEGER curTime;
QueryPerformanceCounter(&curTime);
mStartTime = curTime.QuadPart;
mRunning = true;
}
void Win32Timer::stop()
{
LARGE_INTEGER curTime;
QueryPerformanceCounter(&curTime);
mStopTime = curTime.QuadPart;
mRunning = false;
}
double Win32Timer::getElapsedTime() const
{
LONGLONG endTime;
if (mRunning)
{
LARGE_INTEGER curTime;
QueryPerformanceCounter(&curTime);
endTime = curTime.QuadPart;
}
else
{
endTime = mStopTime;
}
return static_cast<double>(endTime - mStartTime) / mFrequency;
}
//
// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
#ifndef SAMPLE_UTIL_WIN32_TIMER_H
#define SAMPLE_UTIL_WIN32_TIMER_H
#include "Timer.h"
#include <windows.h>
class Win32Timer : public Timer
{
public:
Win32Timer();
void start();
void stop();
double getElapsedTime() const ;
private:
bool mRunning;
LONGLONG mStartTime;
LONGLONG mStopTime;
LONGLONG mFrequency;
};
#endif // SAMPLE_UTIL_WIN32_TIMER_H
//
// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
#ifndef SAMPLE_UTIL_WIN32_WINDOW_H
#define SAMPLE_UTIL_WIN32_WINDOW_H
#include "Window.h"
#include <string>
#include <windows.h>
class Win32Window : public Window
{
public:
Win32Window();
~Win32Window();
bool initialize(const std::string &name, size_t width, size_t height);
void destroy();
EGLDisplay getDisplay() const;
EGLNativeWindowType getNativeWindow() const;
EGLNativeDisplayType getNativeDisplay() const;
void messageLoop();
bool popEvent(Event *event);
void pushEvent(Event event);
void setMousePosition(int x, int y);
private:
std::string mClassName;
EGLDisplay mDisplay;
EGLNativeWindowType mNativeWindow;
EGLNativeDisplayType mNativeDisplay;
};
#endif // SAMPLE_UTIL_WINDOW_H
//
// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
#include "path_utils.h"
#include <array>
#include <windows.h>
std::string GetExecutablePath()
{
std::array<char, MAX_PATH> executableFileBuf;
DWORD executablePathLen = GetModuleFileNameA(NULL, executableFileBuf.data(), executableFileBuf.size());
return (executablePathLen > 0 ? std::string(executableFileBuf.data()) : "");
}
std::string GetExecutableDirectory()
{
std::string executablePath = GetExecutablePath();
size_t lastPathSepLoc = executablePath.find_last_of("\\/");
return (lastPathSepLoc != std::string::npos) ? executablePath.substr(0, lastPathSepLoc) : "";
}
...@@ -71,6 +71,35 @@ ...@@ -71,6 +71,35 @@
}, },
{ {
'target_name': 'sample_util',
'type': 'static_library',
'dependencies':
[
'../src/angle.gyp:libEGL',
'../src/angle.gyp:libGLESv2',
],
'include_dirs':
[
'../include',
'angle/sample_util',
],
'sources':
[
'<!@(python <(angle_path)/enumerate_files.py angle/sample_util -types *.cpp *.h)'
],
'msvs_disabled_warnings': [ 4201 ],
'direct_dependent_settings':
{
'msvs_disabled_warnings': [ 4201 ],
'include_dirs':
[
'../include',
'angle/sample_util',
],
},
},
{
'target_name': 'hello_triangle', 'target_name': 'hello_triangle',
'type': 'executable', 'type': 'executable',
'dependencies': [ 'es_util' ], 'dependencies': [ 'es_util' ],
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment