diff options
author | drumsetmonkey <abelleisle@roadrunner.com> | 2015-11-02 08:50:39 -0500 |
---|---|---|
committer | drumsetmonkey <abelleisle@roadrunner.com> | 2015-11-02 08:50:39 -0500 |
commit | 822d9d5b5ef34c3ec2b5ebaded5744bdba8bade1 (patch) | |
tree | 856a40ce0b43d44394923181e128eca2cb6f4c1b /assets | |
parent | 59a2fce5a1149b076fdf49701ad729e9536c7eee (diff) |
Added new project for lighting test
Diffstat (limited to 'assets')
-rw-r--r-- | assets/lightTest/Makefile | 6 | ||||
-rw-r--r-- | assets/lightTest/main.cp | 0 | ||||
-rw-r--r-- | assets/lightTest/main.cpp | 67 |
3 files changed, 73 insertions, 0 deletions
diff --git a/assets/lightTest/Makefile b/assets/lightTest/Makefile new file mode 100644 index 0000000..c4d1042 --- /dev/null +++ b/assets/lightTest/Makefile @@ -0,0 +1,6 @@ +LIBS = -lGL -lGLEW -lSDL2main -lSDL2 -lfreetype -lSDL2_image -lSDL2_mixer + +FLAGS = -m32 -std=c++11 -Iinclude -Iinclude/freetype2 + +all: + @g++ $(FLAGS) -o main main.cpp $(LIBS)
\ No newline at end of file diff --git a/assets/lightTest/main.cp b/assets/lightTest/main.cp new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/assets/lightTest/main.cp diff --git a/assets/lightTest/main.cpp b/assets/lightTest/main.cpp new file mode 100644 index 0000000..4091389 --- /dev/null +++ b/assets/lightTest/main.cpp @@ -0,0 +1,67 @@ +#include <GL/glew.h> + +#include <SDL2/SDL.h> +#include <SDL2/SDL_opengl.h> +#include <SDL2/SDL_image.h> +#include <SDL2/SDL_mixer.h> +#include <iostream> + +#define SCREEN_WIDTH 1280 +#define SCREEN_HEIGHT 720 + +SDL_Window* window; +SDL_GLContext mainGLContext = NULL; + +int main(void){ + if(SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO) < 0){ + std::cout << "SDL was not able to initialize! Error: " << SDL_GetError() << std::endl; + return -1; + } + // Run SDL_Quit when main returns + atexit(SDL_Quit); + + window = SDL_CreateWindow("Ass", + SDL_WINDOWPOS_UNDEFINED, // Spawn the window at random (undefined) x and y coordinates + SDL_WINDOWPOS_UNDEFINED, // + SCREEN_WIDTH, + SCREEN_HEIGHT, + SDL_WINDOW_SHOWN | SDL_WINDOW_OPENGL +#ifdef FULLSCREEN + | SDL_WINDOW_FULLSCREEN +#endif // FULLSCREEN + ); + + if(window==NULL){ + std::cout << "The window failed to generate! SDL_Error: " << SDL_GetError() << std::endl; + return -1; + } + + if((mainGLContext = SDL_GL_CreateContext(window)) == NULL){ + std::cout << "The OpenGL context failed to initialize! SDL_Error: " << SDL_GetError() << std::endl; + return -1; + } + + + GLenum err; + glewExperimental = GL_TRUE; + if((err=glewInit()) != GLEW_OK){ + std::cout << "GLEW was not able to initialize! Error: " << glewGetErrorString(err) << std::endl; + return -1; + } + + SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); + + glViewport(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); + + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + + + bool gameRunning = true; + while(gameRunning){ + + } + SDL_GL_DeleteContext(mainGLContext); + SDL_DestroyWindow(window); + return 0; +}
\ No newline at end of file |