From 3795d6ac28e1df73522717a53fc57ac7316dae8d Mon Sep 17 00:00:00 2001 From: Dale Stammen Date: Thu, 23 Oct 2014 07:33:14 -0700 Subject: [PATCH] removed old files --- .../HelloTriangleRenderer.cpp | 161 ------------------ .../cpp-tests.Shared/HelloTriangleRenderer.h | 17 -- .../cpp-tests.Shared/OpenGLES.cpp | 153 ----------------- .../cpp-tests.Shared/OpenGLES.h | 23 --- .../cpp-tests.Shared/pch.cpp | 1 - .../cpp-tests.Shared/pch.h | 27 --- 6 files changed, 382 deletions(-) delete mode 100644 tests/cpp-tests/proj.win8.1-universal/cpp-tests.Shared/HelloTriangleRenderer.cpp delete mode 100644 tests/cpp-tests/proj.win8.1-universal/cpp-tests.Shared/HelloTriangleRenderer.h delete mode 100644 tests/cpp-tests/proj.win8.1-universal/cpp-tests.Shared/OpenGLES.cpp delete mode 100644 tests/cpp-tests/proj.win8.1-universal/cpp-tests.Shared/OpenGLES.h delete mode 100644 tests/cpp-tests/proj.win8.1-universal/cpp-tests.Shared/pch.cpp delete mode 100644 tests/cpp-tests/proj.win8.1-universal/cpp-tests.Shared/pch.h diff --git a/tests/cpp-tests/proj.win8.1-universal/cpp-tests.Shared/HelloTriangleRenderer.cpp b/tests/cpp-tests/proj.win8.1-universal/cpp-tests.Shared/HelloTriangleRenderer.cpp deleted file mode 100644 index 2e6700d0bc..0000000000 --- a/tests/cpp-tests/proj.win8.1-universal/cpp-tests.Shared/HelloTriangleRenderer.cpp +++ /dev/null @@ -1,161 +0,0 @@ -// Based on Hello_Triangle.c 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 - -// -// This file is used by the template to render a basic scene using GL. -// - -#include "pch.h" -#include "HelloTriangleRenderer.h" - -// These are used by the shader compilation methods. -#include -#include -#include - -using namespace Platform; - -using namespace cpp_tests; - -#define STRING(s) #s - -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 infoLog(infoLogLength); - glGetShaderInfoLog(shader, (GLsizei)infoLog.size(), NULL, infoLog.data()); - - std::wstring errorMessage = std::wstring(L"Shader compilation failed: "); - errorMessage += std::wstring(infoLog.begin(), infoLog.end()); - - throw Exception::CreateException(E_FAIL, ref new Platform::String(errorMessage.c_str())); - } - - return shader; -} - -GLuint CompileProgram(const std::string &vsSource, const std::string &fsSource) -{ - GLuint program = glCreateProgram(); - - if (program == 0) - { - throw Exception::CreateException(E_FAIL, L"Program creation failed"); - } - - 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 infoLog(infoLogLength); - glGetProgramInfoLog(program, (GLsizei)infoLog.size(), NULL, infoLog.data()); - - std::wstring errorMessage = std::wstring(L"Program link failed: "); - errorMessage += std::wstring(infoLog.begin(), infoLog.end()); - - throw Exception::CreateException(E_FAIL, ref new Platform::String(errorMessage.c_str())); - } - - return program; -} - -HelloTriangleRenderer::HelloTriangleRenderer() : - mProgram(0) -{ - // Vertex Shader source - const std::string vs = STRING - ( - attribute vec4 vPosition; - void main() - { - gl_Position = vPosition; - } - ); - - // Fragment Shader source - const std::string fs = STRING - ( - precision mediump float; - void main() - { - gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0); - } - ); - - // CompileProgram will throw if it fails, so we don't need to check for success. - mProgram = CompileProgram(vs, fs); -} - -HelloTriangleRenderer::~HelloTriangleRenderer() -{ - if (mProgram != 0) - { - glDeleteProgram(mProgram); - mProgram = 0; - } -} - -// Draws a basic triangle -void HelloTriangleRenderer::Draw(GLsizei width, GLsizei height) -{ - glViewport(0, 0, width, height); - - GLfloat vertices[] = - { - 0.0f, 0.5f, 0.0f, - -0.5f, -0.5f, 0.0f, - 0.5f, -0.5f, 0.0f, - }; - - glClear(GL_COLOR_BUFFER_BIT); - - glUseProgram(mProgram); - - glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, vertices); - glEnableVertexAttribArray(0); - - glDrawArrays(GL_TRIANGLES, 0, 3); -} - diff --git a/tests/cpp-tests/proj.win8.1-universal/cpp-tests.Shared/HelloTriangleRenderer.h b/tests/cpp-tests/proj.win8.1-universal/cpp-tests.Shared/HelloTriangleRenderer.h deleted file mode 100644 index 410f5a2a54..0000000000 --- a/tests/cpp-tests/proj.win8.1-universal/cpp-tests.Shared/HelloTriangleRenderer.h +++ /dev/null @@ -1,17 +0,0 @@ -#pragma once - -#include "pch.h" - -namespace cpp_tests -{ - class HelloTriangleRenderer - { - public: - HelloTriangleRenderer(); - ~HelloTriangleRenderer(); - void Draw(GLsizei width, GLsizei height); - - private: - GLuint mProgram; - }; -} \ No newline at end of file diff --git a/tests/cpp-tests/proj.win8.1-universal/cpp-tests.Shared/OpenGLES.cpp b/tests/cpp-tests/proj.win8.1-universal/cpp-tests.Shared/OpenGLES.cpp deleted file mode 100644 index 793b91d83f..0000000000 --- a/tests/cpp-tests/proj.win8.1-universal/cpp-tests.Shared/OpenGLES.cpp +++ /dev/null @@ -1,153 +0,0 @@ -#include "pch.h" - -using namespace Platform; -using namespace Windows::UI::Xaml::Controls; -using namespace Windows::Foundation; -using namespace Windows::Foundation::Collections; - -OpenGLES::OpenGLES() : - mEglConfig(nullptr), - mEglDisplay(EGL_NO_DISPLAY), - mEglContext(EGL_NO_CONTEXT) -{ - Initialize(); -} - -OpenGLES::~OpenGLES() -{ - Cleanup(); -} - -void OpenGLES::Initialize() -{ - const EGLint configAttributes[] = - { - EGL_RED_SIZE, 8, - EGL_GREEN_SIZE, 8, - EGL_BLUE_SIZE, 8, - EGL_ALPHA_SIZE, 8, - EGL_DEPTH_SIZE, 8, - EGL_STENCIL_SIZE, 8, - EGL_NONE - }; - - const EGLint displayAttributes[] = - { - // This can be used to configure D3D11. For example, EGL_PLATFORM_ANGLE_TYPE_D3D11_FL9_3_ANGLE could be used. - // This would ask the graphics card to use D3D11 Feature Level 9_3 instead of Feature Level 11_0+. - // On Windows Phone, this would allow the Phone Emulator to act more like the GPUs that are available on real Phone devices. - EGL_PLATFORM_ANGLE_TYPE_ANGLE, EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE, - EGL_NONE, - }; - - const EGLint contextAttributes[] = - { - EGL_CONTEXT_CLIENT_VERSION, 2, - EGL_NONE - }; - - // eglGetPlatformDisplayEXT is an alternative to eglGetDisplay. It allows us to pass in 'displayAttributes' to configure D3D11. - PFNEGLGETPLATFORMDISPLAYEXTPROC eglGetPlatformDisplayEXT = reinterpret_cast(eglGetProcAddress("eglGetPlatformDisplayEXT")); - if (!eglGetPlatformDisplayEXT) - { - throw Exception::CreateException(E_FAIL, L"Failed to get function eglGetPlatformDisplayEXT"); - } - - mEglDisplay = eglGetPlatformDisplayEXT(EGL_PLATFORM_ANGLE_ANGLE, EGL_DEFAULT_DISPLAY, displayAttributes); - if (mEglDisplay == EGL_NO_DISPLAY) - { - throw Exception::CreateException(E_FAIL, L"Failed to get default EGL display"); - } - - if (eglInitialize(mEglDisplay, NULL, NULL) == EGL_FALSE) - { - throw Exception::CreateException(E_FAIL, L"Failed to initialize EGL"); - } - - EGLint numConfigs = 0; - if (eglGetConfigs(mEglDisplay, NULL, 0, &numConfigs) == EGL_FALSE) - { - throw Exception::CreateException(E_FAIL, L"Failed to get EGLConfig count"); - } - - if (eglChooseConfig(mEglDisplay, configAttributes, &mEglConfig, 1, &numConfigs) == EGL_FALSE) - { - throw Exception::CreateException(E_FAIL, L"Failed to choose first EGLConfig"); - } - - mEglContext = eglCreateContext(mEglDisplay, mEglConfig, EGL_NO_CONTEXT, contextAttributes); - if (mEglContext == EGL_NO_CONTEXT) - { - throw Exception::CreateException(E_FAIL, L"Failed to create EGL context"); - } -} - -void OpenGLES::Cleanup() -{ - if (mEglDisplay != EGL_NO_DISPLAY && mEglContext != EGL_NO_CONTEXT) - { - eglDestroyContext(mEglDisplay, mEglContext); - mEglContext = EGL_NO_CONTEXT; - } - - if (mEglDisplay != EGL_NO_DISPLAY) - { - eglTerminate(mEglDisplay); - mEglDisplay = EGL_NO_DISPLAY; - } -} - -void OpenGLES::Reset() -{ - Cleanup(); - Initialize(); -} - -EGLSurface OpenGLES::CreateSurface(SwapChainPanel^ panel, const Size* renderSurfaceSize) -{ - if (!panel) - { - throw Exception::CreateException(E_INVALIDARG, L"SwapChainPanel parameter is invalid"); - } - - EGLSurface surface = EGL_NO_SURFACE; - - // Create a PropertySet and initialize with the EGLNativeWindowType. - PropertySet^ surfaceCreationProperties = ref new PropertySet(); - surfaceCreationProperties->Insert(ref new String(EGLNativeWindowTypeProperty), panel); - - // If a render surface size is specified, add it to the surface creation properties - if (renderSurfaceSize != nullptr) - { - surfaceCreationProperties->Insert(ref new String(EGLRenderSurfaceSizeProperty), PropertyValue::CreateSize(*renderSurfaceSize)); - } - - surface = eglCreateWindowSurface(mEglDisplay, mEglConfig, reinterpret_cast(surfaceCreationProperties), NULL); - if (surface == EGL_NO_SURFACE) - { - throw Exception::CreateException(E_FAIL, L"Failed to create EGL surface"); - } - - return surface; -} - -void OpenGLES::DestroySurface(const EGLSurface surface) -{ - if (mEglDisplay != EGL_NO_DISPLAY && surface != EGL_NO_SURFACE) - { - eglDestroySurface(mEglDisplay, surface); - } -} - -void OpenGLES::MakeCurrent(const EGLSurface surface) -{ - if (eglMakeCurrent(mEglDisplay, surface, surface, mEglContext) == EGL_FALSE) - { - throw Exception::CreateException(E_FAIL, L"Failed to make EGLSurface current"); - } -} - -EGLBoolean OpenGLES::SwapBuffers(const EGLSurface surface) -{ - return (eglSwapBuffers(mEglDisplay, surface)); -} diff --git a/tests/cpp-tests/proj.win8.1-universal/cpp-tests.Shared/OpenGLES.h b/tests/cpp-tests/proj.win8.1-universal/cpp-tests.Shared/OpenGLES.h deleted file mode 100644 index 2190e23c57..0000000000 --- a/tests/cpp-tests/proj.win8.1-universal/cpp-tests.Shared/OpenGLES.h +++ /dev/null @@ -1,23 +0,0 @@ -#pragma once - -class OpenGLES -{ -public: - OpenGLES(); - ~OpenGLES(); - - EGLSurface CreateSurface(Windows::UI::Xaml::Controls::SwapChainPanel^ panel, const Windows::Foundation::Size* renderSurfaceSize); - void DestroySurface(const EGLSurface surface); - void MakeCurrent(const EGLSurface surface); - EGLBoolean SwapBuffers(const EGLSurface surface); - void Reset(); - -private: - void Initialize(); - void Cleanup(); - -private: - EGLDisplay mEglDisplay; - EGLContext mEglContext; - EGLConfig mEglConfig; -}; diff --git a/tests/cpp-tests/proj.win8.1-universal/cpp-tests.Shared/pch.cpp b/tests/cpp-tests/proj.win8.1-universal/cpp-tests.Shared/pch.cpp deleted file mode 100644 index bcb5590be1..0000000000 --- a/tests/cpp-tests/proj.win8.1-universal/cpp-tests.Shared/pch.cpp +++ /dev/null @@ -1 +0,0 @@ -#include "pch.h" diff --git a/tests/cpp-tests/proj.win8.1-universal/cpp-tests.Shared/pch.h b/tests/cpp-tests/proj.win8.1-universal/cpp-tests.Shared/pch.h deleted file mode 100644 index 4bdade37c9..0000000000 --- a/tests/cpp-tests/proj.win8.1-universal/cpp-tests.Shared/pch.h +++ /dev/null @@ -1,27 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include -#include -#include - -// OpenGL ES includes -#include -#include - -// EGL includes -#include -#include -#include -#include - -#include "OpenGLES.h" -#include "HelloTriangleRenderer.h" -#include "App.xaml.h" - -#include "cocos2d.h" -#include "cocos-ext.h" \ No newline at end of file