summaryrefslogtreecommitdiffstats
path: root/chromium/third_party/angle/samples/gles2_book/PostSubBuffer
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/third_party/angle/samples/gles2_book/PostSubBuffer')
-rw-r--r--chromium/third_party/angle/samples/gles2_book/PostSubBuffer/PostSubBuffer.c204
-rw-r--r--chromium/third_party/angle/samples/gles2_book/PostSubBuffer/PostSubBuffer.vcxproj105
2 files changed, 0 insertions, 309 deletions
diff --git a/chromium/third_party/angle/samples/gles2_book/PostSubBuffer/PostSubBuffer.c b/chromium/third_party/angle/samples/gles2_book/PostSubBuffer/PostSubBuffer.c
deleted file mode 100644
index 0096ec31b03..00000000000
--- a/chromium/third_party/angle/samples/gles2_book/PostSubBuffer/PostSubBuffer.c
+++ /dev/null
@@ -1,204 +0,0 @@
-// Based on a sample from:
-//
-// Book: OpenGL(R) ES 2.0 Programming Guide
-// Authors: Aaftab Munshi, Dan Ginsburg, Dave Shreiner
-// ISBN-10: 0321502795
-// ISBN-13: 9780321502797
-// Publisher: Addison-Wesley Professional
-// URLs: http://safari.informit.com/9780321563835
-// http://www.opengles-book.com
-//
-
-// PostSubBuffer.c
-//
-// This is a simple example that draws a rotating cube in perspective
-// using a vertex shader to transform the object, posting only a subrectangle
-// to the window surface.
-//
-#include <stdlib.h>
-#include "esUtil.h"
-
-#define WINDOW_WIDTH 320
-#define WINDOW_HEIGHT 240
-
-typedef struct
-{
- // Handle to a program object
- GLuint programObject;
-
- // Attribute locations
- GLint positionLoc;
-
- // Uniform locations
- GLint mvpLoc;
-
- // Vertex daata
- GLfloat *vertices;
- GLushort *indices;
- int numIndices;
-
- // Rotation angle
- GLfloat angle;
-
- // MVP matrix
- ESMatrix mvpMatrix;
-} UserData;
-
-///
-// Initialize the shader and program object
-//
-int Init ( ESContext *esContext )
-{
- UserData *userData = esContext->userData;
- GLbyte vShaderStr[] =
- "uniform mat4 u_mvpMatrix; \n"
- "attribute vec4 a_position; \n"
- "void main() \n"
- "{ \n"
- " gl_Position = u_mvpMatrix * a_position; \n"
- "} \n";
-
- GLbyte fShaderStr[] =
- "precision mediump float; \n"
- "void main() \n"
- "{ \n"
- " gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 ); \n"
- "} \n";
-
- // Load the shaders and get a linked program object
- userData->programObject = esLoadProgram ( vShaderStr, fShaderStr );
-
- // Get the attribute locations
- userData->positionLoc = glGetAttribLocation ( userData->programObject, "a_position" );
-
- // Get the uniform locations
- userData->mvpLoc = glGetUniformLocation( userData->programObject, "u_mvpMatrix" );
-
- // Generate the vertex data
- userData->numIndices = esGenCube( 1.0, &userData->vertices,
- NULL, NULL, &userData->indices );
-
- // Starting rotation angle for the cube
- userData->angle = 45.0f;
-
- // Clear the whole window surface.
- glClearColor ( 0.0f, 0.0f, 1.0f, 0.0f );
- glClear ( GL_COLOR_BUFFER_BIT );
- eglSwapBuffers ( esContext->eglDisplay, esContext->eglSurface );
-
- glClearColor ( 0.0f, 0.0f, 0.0f, 0.0f );
- return TRUE;
-}
-
-
-///
-// Update MVP matrix based on time
-//
-void Update ( ESContext *esContext, float deltaTime )
-{
- UserData *userData = (UserData*) esContext->userData;
- ESMatrix perspective;
- ESMatrix modelview;
- float aspect;
-
- // Compute a rotation angle based on time to rotate the cube
- userData->angle += ( deltaTime * 40.0f );
- if( userData->angle >= 360.0f )
- userData->angle -= 360.0f;
-
- // Compute the window aspect ratio
- aspect = (GLfloat) esContext->width / (GLfloat) esContext->height;
-
- // Generate a perspective matrix with a 60 degree FOV
- esMatrixLoadIdentity( &perspective );
- esPerspective( &perspective, 60.0f, aspect, 1.0f, 20.0f );
-
- // Generate a model view matrix to rotate/translate the cube
- esMatrixLoadIdentity( &modelview );
-
- // Translate away from the viewer
- esTranslate( &modelview, 0.0, 0.0, -2.0 );
-
- // Rotate the cube
- esRotate( &modelview, userData->angle, 1.0, 0.0, 1.0 );
-
- // Compute the final MVP by multiplying the
- // modevleiw and perspective matrices together
- esMatrixMultiply( &userData->mvpMatrix, &modelview, &perspective );
-}
-
-///
-// Draw a triangle using the shader pair created in Init()
-//
-void Draw ( ESContext *esContext )
-{
- UserData *userData = esContext->userData;
-
- // Set the viewport
- glViewport ( 0, 0, esContext->width, esContext->height );
-
-
- // Clear the color buffer
- glClear ( GL_COLOR_BUFFER_BIT );
-
- // Use the program object
- glUseProgram ( userData->programObject );
-
- // Load the vertex position
- glVertexAttribPointer ( userData->positionLoc, 3, GL_FLOAT,
- GL_FALSE, 3 * sizeof(GLfloat), userData->vertices );
-
- glEnableVertexAttribArray ( userData->positionLoc );
-
-
- // Load the MVP matrix
- glUniformMatrix4fv( userData->mvpLoc, 1, GL_FALSE, (GLfloat*) &userData->mvpMatrix.m[0][0] );
-
- // Draw the cube
- glDrawElements ( GL_TRIANGLES, userData->numIndices, GL_UNSIGNED_SHORT, userData->indices );
-
- eglPostSubBufferNV ( esContext->eglDisplay, esContext->eglSurface, 60, 60, WINDOW_WIDTH - 120, WINDOW_HEIGHT - 120 );
-}
-
-///
-// Cleanup
-//
-void ShutDown ( ESContext *esContext )
-{
- UserData *userData = esContext->userData;
-
- if ( userData->vertices != NULL )
- {
- free ( userData->vertices );
- }
-
- if ( userData->indices != NULL )
- {
- free ( userData->indices );
- }
-
- // Delete program object
- glDeleteProgram ( userData->programObject );
-}
-
-
-int main ( int argc, char *argv[] )
-{
- ESContext esContext;
- UserData userData;
-
- esInitContext ( &esContext );
- esContext.userData = &userData;
-
- esCreateWindow ( &esContext, TEXT("Simple Vertex Shader"), WINDOW_WIDTH, WINDOW_HEIGHT, ES_WINDOW_RGB | ES_WINDOW_POST_SUB_BUFFER_SUPPORTED );
-
- if ( !Init ( &esContext ) )
- return 0;
-
- esRegisterDrawFunc ( &esContext, Draw );
- esRegisterUpdateFunc ( &esContext, Update );
-
- esMainLoop ( &esContext );
-
- ShutDown ( &esContext );
-}
diff --git a/chromium/third_party/angle/samples/gles2_book/PostSubBuffer/PostSubBuffer.vcxproj b/chromium/third_party/angle/samples/gles2_book/PostSubBuffer/PostSubBuffer.vcxproj
deleted file mode 100644
index 875d16322ef..00000000000
--- a/chromium/third_party/angle/samples/gles2_book/PostSubBuffer/PostSubBuffer.vcxproj
+++ /dev/null
@@ -1,105 +0,0 @@
-<?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>{667CE95F-5DD8-4495-8C18-5CA8A175B12D}</ProjectGuid>
- <RootNamespace>Simple_VertexShader</RootNamespace>
- <Keyword>Win32Proj</Keyword>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <CharacterSet>NotSet</CharacterSet>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <CharacterSet>NotSet</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" />
- </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" />
- </ImportGroup>
- <PropertyGroup Label="UserMacros" />
- <PropertyGroup>
- <_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)\</IntDir>
- <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
- <EmbedManifest Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</EmbedManifest>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\</IntDir>
- <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <ClCompile>
- <Optimization>Disabled</Optimization>
- <AdditionalIncludeDirectories>../Common;../../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE;NOMINMAX;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <MinimalRebuild>true</MinimalRebuild>
- <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
- <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
- <PrecompiledHeader>
- </PrecompiledHeader>
- <WarningLevel>Level3</WarningLevel>
- <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
- </ClCompile>
- <Link>
- <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <SubSystem>Console</SubSystem>
- <RandomizedBaseAddress>false</RandomizedBaseAddress>
- <DataExecutionPrevention>
- </DataExecutionPrevention>
- <TargetMachine>MachineX86</TargetMachine>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <ClCompile>
- <AdditionalIncludeDirectories>../Common;../../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE;NOMINMAX;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
- <PrecompiledHeader>
- </PrecompiledHeader>
- <WarningLevel>Level3</WarningLevel>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- </ClCompile>
- <Link>
- <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <SubSystem>Console</SubSystem>
- <OptimizeReferences>true</OptimizeReferences>
- <EnableCOMDATFolding>true</EnableCOMDATFolding>
- <RandomizedBaseAddress>false</RandomizedBaseAddress>
- <DataExecutionPrevention>
- </DataExecutionPrevention>
- <TargetMachine>MachineX86</TargetMachine>
- </Link>
- </ItemDefinitionGroup>
- <ItemGroup>
- <ClCompile Include="PostSubBuffer.c" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\Common\esUtil.vcxproj">
- <Project>{47c93f52-ab4e-4ff9-8d4f-b38cd60a183f}</Project>
- <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
- </ProjectReference>
- </ItemGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
- <ImportGroup Label="ExtensionTargets">
- </ImportGroup>
-</Project> \ No newline at end of file