]> git.leopard-lacewing.eu Git - cgue_weave.git/commitdiff
glError moved to Graphix
authorPeter Schaefer <schaeferpm@gmail.com>
Tue, 21 Apr 2015 21:16:22 +0000 (23:16 +0200)
committerPeter Schaefer <schaeferpm@gmail.com>
Tue, 21 Apr 2015 21:16:22 +0000 (23:16 +0200)
added some commented Debugging Messages (info, getGlError)
unsigned int bug (-1) fixed
2D and CUBE Textures can be loaded
updated Skybox.dae
updated Skybox ShaderFiles
many securityChecks for bending Variables to Shader

23 files changed:
Weave/Game.cpp
Weave/Game.h
Weave/Graphix/Graphix.cpp
Weave/Graphix/Graphix.h
Weave/Graphix/Model.cpp
Weave/Graphix/Scene.cpp
Weave/Graphix/SceneObject.cpp
Weave/Graphix/SceneObject.h
Weave/Graphix/Shader.cpp
Weave/Graphix/Texture.cpp
Weave/Graphix/Texture.h
Weave/Graphix/ViewPort.cpp
Weave/Message.cpp
models/SkyBox.blend
models/SkyBox.blend1
models/SkyBox.dae
shader/skybox_FS.hlsl
shader/skybox_VS.hlsl
textures/model_player.png [deleted file]
textures/model_player_2D.png [new file with mode: 0644]
textures/model_skybox.png [deleted file]
textures/model_skybox_CUBE.png [new file with mode: 0644]
textures/skybox_CUBE.jpg [new file with mode: 0644]

index 8269c8682279938e797d0dc14605a64f8c58b3bf..2fab228ae12d652636fc1771c02db5f9198f690d 100644 (file)
@@ -35,6 +35,8 @@ using std::string;
 typedef unsigned int uint;
 
 
+
+
 Game::Game() : playing(true)
 {
        srand((int)time(NULL));
@@ -42,12 +44,30 @@ Game::Game() : playing(true)
        Scene* tmp_Scene = new Scene(0, 0, Graphix::getWindowWidth(), Graphix::getWindowHeight(), 45, 0.1f, 15, vec3(0.0f, 0.0f, 0.f));
        layer[0] = tmp_Scene;
 
+
+       //SKYBOX! ---------------------------
+                               //      tmp_Scene->addObject(new SceneObject(shaderSky, glm::mat4(1.0f), "SkyBox.dae", "skybox.jpg"));
+                               //Message::info("Error from before?");
+                               //Graphix::getGlError();
+                       //skybox = new Shader("skybox_VS.hlsl", "skybox_FS.hlsl");
+                               //Message::info("Creating SkyBox Shader");
+                               //Graphix::getGlError();
+                       //SkyBox = new SceneObject(skybox, mat4(1.f), "SkyBox.dae", "skybox_CUBE.jpg");
+                               //Message::info("Creating SkyBox SceneObject"); rotate((float)M_PI_2, vec3(1.f, 0.f, 0.f))
+                               //Graphix::getGlError();
+                               //Message::info("Done");
+
+                               //tmp_Scene->addObject(new SceneObject(shader1, rotate((float)M_PI_2,vec3(1.f,0.f,0.f)), "SkyBox.dae", "skybox.jpg"));
+
+                       //tmp_Scene->addObject(SkyBox);
+       //SKYBOX! ----------------------------
+
        //Allg Shader
        Shader* shader1 = new Shader("basicTexture_VS.hlsl", "lightingTexture_FS.hlsl");
-       Shader* shaderSky = new Shader("skybox_VS.hlsl", "skybox_FS.hlsl");
+//     Shader* shaderSky = new Shader("skybox_VS.hlsl", "skybox_FS.hlsl");
 
        //Player
-       SceneObject* tmp_playerObject = new SceneObject(shader1, translate(vec3(1.f, 0.f, 1.f)), "Player.dae", "model_player.png");
+       SceneObject* tmp_playerObject = new SceneObject(shader1, translate(vec3(1.f, 0.f, 1.f)), "Player.dae", "model_player_2D.png");
 
        //tmp_playerObject->setIntelligenz(new PlayerI(tmp_playerObject));
        tmp_Scene->addObject(tmp_playerObject);
@@ -83,7 +103,7 @@ Game::Game() : playing(true)
        //      //cout << ((float)(rand() % (size*steps * 2)) / steps - size) << ((float)(rand() % (size*steps * 2)) / steps - size) << ((float)(rand() % (size*steps * 2)) / steps - size) << endl;
        //}
        //ein Gegner
-       tmp_Scene->addObject(new SceneObject(shader1, glm::mat4(1.0f), "Player.dae", "model_player.png"));
+       //tmp_Scene->addObject(new SceneObject(shader1, glm::mat4(1.0f), "Player.dae", "model_player.png"));
        //tmp_Scene->addObject(new SceneObject(shader1, translate(vec3(-1.f, 2.f, -2.f)), "../models/box/box.dae", "../Textures/sky_withstars.png"));
        //tmp_Scene->addObject(new SceneObject(shader1, translate(vec3(1.f, 3.f, -2.f)), "../models/cow/cow.dae", "../models/cow/texture.jpg"));
 
@@ -92,7 +112,8 @@ Game::Game() : playing(true)
 
        //import("level_test.dae", tmp_Scene, shader1);
 
-       //tmp_Scene->addObject(new SceneObject(shaderSky, glm::mat4(1.0f), "SkyBox.dae", "model_skybox.png"));
+
+       
 
 }
 
@@ -130,29 +151,9 @@ void Game::play()
 
                Graphix::swap();
 
-               GLenum error = glGetError();
-
-               if (error != GL_NO_ERROR) {
-                       switch (error) {
-                       case GL_INVALID_ENUM:
-                               Message::error((string)"GL: enum argument out of range.");
-                               break;
-                       case GL_INVALID_VALUE:
-                               Message::error((string)"GL: Numeric argument out of range.");
-                               break;
-                       case GL_INVALID_OPERATION:
-                               Message::error((string)"GL: Operation illegal in current state.");
-                               break;
-                       case GL_INVALID_FRAMEBUFFER_OPERATION:
-                               Message::error((string)"GL: Framebuffer object is not complete.");
-                               break;
-                       case GL_OUT_OF_MEMORY:
-                               Message::error((string)"GL: Not enough memory left to execute command.");
-                               break;
-                       default:
-                               Message::error((string)"GL: Unknown error.");
-                       }
-               }
+               Graphix::getGlError();
+
+//             system("pause");
        }
 }
 
@@ -171,6 +172,10 @@ void Game::update(float deltaT)
 void Game::draw() const
 {
        if (playing){
+
+               //viewPort->bindView(*i, lookat->getPosition() + vec3(0.0f, 1.0f, 0.0f));
+               //SkyBox->draw();
+
                for (auto i = layer.begin(); i != layer.end(); ++i){
                        (*i).second->draw();
                }
index ee6b8c52ce4487f2fda4c118685d64604cdf3be6..ba641f0153df34445e182689fff4cb49e6ab15f5 100644 (file)
@@ -37,5 +37,8 @@ private:
        void draw() const;
        //bool import(const string &path, Scene *scene, Shader* shader);
 
+       Shader* skybox;
+       SceneObject* SkyBox;
+
 };
 
index b3b2d871342a32823fa4183457783a383379d0cf..90046a44fafe2747b31524a964de3ecd845dd907 100644 (file)
@@ -63,6 +63,7 @@ void Graphix::init()
        //SDL_SetWindowGrab(sdl_window, SDL_TRUE);
        //SDL_ShowCursor(SDL_DISABLE);
        glEnable(GL_COLOR_MATERIAL);
+       glEnable(GL_TEXTURE_CUBE_MAP);
        glEnable(GL_LIGHTING);
        glEnable(GL_LIGHT0);
        glEnable(GL_CULL_FACE);
@@ -100,6 +101,34 @@ void Graphix::cleanup()
        SDL_Quit();
 }
 
+unsigned int Graphix::getGlError()
+{
+       GLenum error = glGetError();
+
+       if (error != GL_NO_ERROR) {
+               switch (error) {
+               case GL_INVALID_ENUM:
+                       Message::error((string)"GL: enum argument out of range.");
+                       break;
+               case GL_INVALID_VALUE:
+                       Message::error((string)"GL: Numeric argument out of range.");
+                       break;
+               case GL_INVALID_OPERATION:
+                       Message::error((string)"GL: Operation illegal in current state.");
+                       break;
+               case GL_INVALID_FRAMEBUFFER_OPERATION:
+                       Message::error((string)"GL: Framebuffer object is not complete.");
+                       break;
+               case GL_OUT_OF_MEMORY:
+                       Message::error((string)"GL: Not enough memory left to execute command.");
+                       break;
+               default:
+                       Message::error((string)"GL: Unknown error.");
+               }
+       }
+       return error;
+}
+
 unsigned int Graphix::width = 1024;
 unsigned int Graphix::height = 768;
 
index a1cebb8c45b28e2f302b74e99f34e502145473e9..38f3e39ec4da67fcba05190ec10786c7480a5086 100644 (file)
@@ -28,6 +28,8 @@ public:
        static void cleanup();
        static void clear();
 
+       static unsigned int getGlError();
+
 private:
        static unsigned int width;
        static unsigned int height;
index b237e91e1a8e01de8108b2f8aca2998c405f3de7..c810e5979623c8a2a5d4f7fc7512aef833305939 100644 (file)
@@ -9,6 +9,8 @@
 #include "Texture.h"
 #include "../Message.h"
 
+#include "Graphix.h"
+
 typedef unsigned int uint;
 
 
@@ -109,6 +111,7 @@ Model::~Model()
 
 void Model::useModel(Shader* _shader) const
 {
+       _shader->useShader();
        uint vao = -1;
        auto i = shader_map.find(*_shader);
        if (i == shader_map.end())
@@ -117,7 +120,7 @@ void Model::useModel(Shader* _shader) const
                vao = i->second;
 
        glBindVertexArray(vao);
-       _shader->useShader();
+       
 
 }
 
@@ -125,24 +128,41 @@ void Model::useTexture(Texture* _texture, Shader* _shader) const
 {
        if (_texture != nullptr)
        {
+               auto tmp = _shader->getUniformLocation("uColorTexture");
+               if (tmp < 0){
+                       return;
+               }
                int unit = 0;
                _texture->bind(unit);
-               glUniform1i(_shader->getUniformLocation("uColorTexture"), unit);
+               glUniform1i(tmp, unit);
        }
 }
 
 void Model::useMMatrix(const mat4& _model, Shader* _shader) const
 {
-       glUniformMatrix4fv(_shader->getUniformLocation("uModel"), 1, GL_FALSE, value_ptr(_model));
+       int tmp = _shader->getUniformLocation("uModel");
+       if (tmp >= 0)
+               glUniformMatrix4fv(tmp, 1, GL_FALSE, value_ptr(_model));
 }
 
 void Model::drawModel(Shader* _shader, Texture* _texture, const mat4& _model) const
 {
+       //Message::info("Error from before?");
+       //Graphix::getGlError();
        useModel(_shader);
+       //Message::info("Model loading Coordinates");
+       //Graphix::getGlError();
        useTexture(_texture, _shader);
+       //Message::info("Model loading Texture");
+       //Graphix::getGlError();
        useMMatrix(_model, _shader);
+       //Message::info("Model loading MMatrix");
+       //Graphix::getGlError();
        glDrawElements(GL_TRIANGLES, numfaces * 3, GL_UNSIGNED_INT, 0);
+       //Message::info("Model drawing Elements");
+       //Graphix::getGlError();
        glBindVertexArray(0);
+       //system("pause");
 }
 
 void Model::drawModel() const
@@ -153,15 +173,29 @@ void Model::drawModel() const
 
 unsigned int Model::bindShader(Shader* _shader)
 {
+       //Message::info("bindShader");
+       //Graphix::getGlError();
+       //Message::info("Do Stuff");
        uint vao;
        glGenVertexArrays(1, &vao);
        glBindVertexArray(vao);
 
+       //Message::info("bindVAO");
+       //Graphix::getGlError();
+
        bindBuffer(vertexBuffer, _shader->getAttribLocation("aPosition"));
+       //Message::info("aPosition");
+       //Graphix::getGlError();
        bindBuffer(uvBuffer, _shader->getAttribLocation("aUV"), 2);
+       //Message::info("aUV");
+       //Graphix::getGlError();
        bindBuffer(normalBuffer, _shader->getAttribLocation("aNormal"));
+       //Message::info("aNormal");
+       //Graphix::getGlError();
 
        glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, indexBuffer);
+       //Message::info("bindIndexBuffer");
+       //Graphix::getGlError();
 
        glBindVertexArray(0);
 
@@ -170,6 +204,10 @@ unsigned int Model::bindShader(Shader* _shader)
 
        shader_map[*_shader] = vao;
 
+       //Message::info("cleanUp");
+       //Graphix::getGlError();
+       //Message::info("Done");
+
        return vao;
 }
 
@@ -183,6 +221,13 @@ void Model::genBuffer(uint &buffer, uint size, void* value)
 
 void Model::bindBuffer(const uint &buffer, const uint index, const uint dim)
 {
+       //Falls index nicht gefunden werden konnte
+       if (index == (uint)-1)
+       {
+               Message::info("Model: BindBuffer wird ausgelassen da index fehlerhaft ist.");
+               return;
+       }
+               
        glBindBuffer(GL_ARRAY_BUFFER, buffer);
        glEnableVertexAttribArray(index);
        glVertexAttribPointer(index, dim, GL_FLOAT, GL_FALSE, 0, 0);
index b90e3339f77ff81a842148398d59009c452f0c83..684301adadc09ab11190a1d118c1b67ee3d816eb 100644 (file)
@@ -158,20 +158,22 @@ void Scene::draw() const
        for (auto i = ShaderSet->cbegin(); i != ShaderSet->cend(); ++i)
        {
                viewPort->bindView(*i,lookat->getPosition()+vec3(0.0f,1.0f,0.0f));
+
+               //don't know if this is really the right place to set the lighting
+               //add ambient light
+               GLfloat ambientcolor[] = { 0.5f, 0.5f, 0.5f, 1.0f };
+               glLightModelfv(GL_LIGHT_MODEL_AMBIENT, ambientcolor);
+
+               //add positioned light
+               GLfloat lightcolor0[] = { 1.5f, 1.5f, 1.5f, 1.0f };
+               GLfloat lightposition0[] = { 1.0f, 1.0f, 1.0f, 1.0f };
+               glLightfv(GL_LIGHT0, GL_DIFFUSE, lightcolor0);
+               glLightfv(GL_LIGHT0, GL_POSITION, lightposition0);
        }
        
 
+       
 
-       //don't know if this is really the right place to set the lighting
-       //add ambient light
-       GLfloat ambientcolor[] = { 0.5f, 0.5f, 0.5f, 1.0f };
-       glLightModelfv(GL_LIGHT_MODEL_AMBIENT, ambientcolor);
-
-       //add positioned light
-       GLfloat lightcolor0[] = { 1.5f, 1.5f, 1.5f, 1.0f };
-       GLfloat lightposition0[] = { 1.0f, 1.0f, 1.0f, 1.0f };
-       glLightfv(GL_LIGHT0, GL_DIFFUSE, lightcolor0);
-       glLightfv(GL_LIGHT0, GL_POSITION, lightposition0);
 
 
 
index 43c499d54744d0ef190d6bd19b63cc23c76b4c6e..f14cf3458860ee27bad33f020a2eaceae3fa2231 100644 (file)
@@ -12,9 +12,7 @@
 #include "Scene.h"
 #include "Texture.h"
 
-#define MODEL_contractionspeed 8.f
-#define MassSpeed_relation 3.f
-#define BOX_size 6
+#include "Graphix.h"
 
 using std::string;
 
@@ -29,12 +27,22 @@ mainScene(NULL),
 collision_ignore(false),
 texture(nullptr)
 {
+       //Message::info("Error from befor?");
+       //Graphix::getGlError();
        new MetaModel(_modelpath);
-       modelID = _shader->getUniformLocation("model");
+       //Message::info("Creating Model");
+       //Graphix::getGlError();
+       //modelID = _shader->getUniformLocation("model");
        if (texturepath!="")
                texture = new Texture(texturepath);
-
+       //Message::info("Creating SkyBox Shader");
+       //Graphix::getGlError();
+       
        bindShader(shader);
+       //Message::info("Binding Shader");
+       //Graphix::getGlError();
+       //Message::info("Done");
+
 }
 
 //SceneObject::SceneObject(Shader* _shader, mat4& _model, Model* model_obj, string texturepath) :
index 6f80285facdd2592ae95005957cacf92880aa95e..439c0dd96dcaeeaa289044340bc70b50b3533a43 100644 (file)
@@ -59,8 +59,8 @@ protected:
        void setMatter(float);
 
        mat4 model;
-       __declspec(deprecated)
-       unsigned int modelID;
+       //__declspec(deprecated)
+       //unsigned int modelID;
 
        Shader* shader;
 
index dff77f4c35fc33226eaea422753cd43d2a596721..6caf78902c93771b3a7545d88bf152e79c1f67e2 100644 (file)
@@ -32,7 +32,7 @@ void Shader::useShader() const
 
 GLuint Shader::getAttribLocation(const string& name) const
 {
-       GLuint ind = glGetAttribLocation(handle, name.c_str());
+       int ind = glGetAttribLocation(handle, name.c_str());
        if (ind < 0)
                Message::info("GL_GetAttLoc: Kann '" + name + "' nicht finden.");
 
@@ -41,7 +41,7 @@ GLuint Shader::getAttribLocation(const string& name) const
 
 GLuint Shader::getUniformLocation(const string& name) const
 {
-       GLuint ind = glGetUniformLocation(handle, name.c_str());
+       int ind = glGetUniformLocation(handle, name.c_str());
        if (ind < 0)
                Message::info("GL_GetUniLoc: Kann '" + name + "' nicht finden.");
 
@@ -64,6 +64,7 @@ GLuint Shader::loadShader(string& _shaderPath)
        GLuint handle=-1;
        auto type = _shaderPath.substr(_shaderPath.find_last_of('_') + 1);
        GLenum shaderType;
+
        if (type == "VS.hlsl"){
                shaderType = GL_VERTEX_SHADER;
        }
index 69ba6312aaca5cd70a822e1ae41c848e91fea1f7..788de1fe238c6481144ef07e6a961aec70a72f99 100644 (file)
@@ -3,14 +3,18 @@
 #include "FreeImage.h"
 #include <iostream>
 
-using std::string;
-using std::cout;
-using std::endl;
+#include "../Message.h"
+#include "Graphix.h"
 
+using std::string;
 
-Texture::Texture(const string& _path) : path(_path), handle(-1)
+Texture::Texture(const string& _path) : path(_path), handle(-1), TEXTURE_TYPE(-1)
 {
 
+       //Message::info("Error from before?");
+       //Graphix::getGlError();
+       //Message::info("Do some Stuff");
+
        auto i = texture_map.find(_path);
        if (i != texture_map.end())
        {
@@ -20,31 +24,40 @@ Texture::Texture(const string& _path) : path(_path), handle(-1)
 
        glGenTextures(1, &handle);
 
-       glActiveTexture(GL_TEXTURE0);
-       glBindTexture(GL_TEXTURE_2D, handle);
+       auto path_type = path.substr(path.find_last_of("_")+1);
+       path_type = path_type.substr(0, path_type.find_first_of("."));
+
+       if (path_type == "CUBE")
+       {
+               TEXTURE_TYPE = GL_TEXTURE_CUBE_MAP;
+       }
+       else if (path_type == "2D")
+       {
+               TEXTURE_TYPE = GL_TEXTURE_2D;
+       }
+       else
+       {
+               Message::info("Texture : Undefined Type, was set to default (2D)");
+               TEXTURE_TYPE = GL_TEXTURE_2D;
+       }
+       glBindTexture(TEXTURE_TYPE, handle);
 
        FREE_IMAGE_FORMAT format = FreeImage_GetFileType(("../textures/" + path).c_str());//Automatocally detects the format
        if (format == FIF_UNKNOWN)
        {
-               cout << "Couldn't detect texture file format." << endl;
-               system("pause");
-               exit(-1);
+               Message::error("Texture: Couldn't detect texture file format.");
        }
        FIBITMAP* data = FreeImage_Load(format, ("../textures/" + path).c_str());
        if (!data)
        {
-               cout << "Couldn't read texture file." << endl;
-               system("pause");
-               exit(-1);
+               Message::error("Texture: Couldn't read texture file.");
        }
 
        //FIBITMAP* temp = data;
        data = FreeImage_ConvertTo32Bits(data);
        if (!data)
        {
-               cout << "Couldn't convert texture file to bit format." << endl;
-               system("pause");
-               exit(-1);
+               Message::error("Texture: Couldn't convert texture file to bit format."); 
        }
        //FreeImage_Unload(temp);
 
@@ -54,14 +67,31 @@ Texture::Texture(const string& _path) : path(_path), handle(-1)
        //unsigned int width, height;
 
        //FIBITMAP *data = FreeImage_Load(FIF_PNG, path.c_str(), PNG_DEFAULT);
+       //Graphix::getGlError();
+//     if (TEXTURE_TYPE == GL_TEXTURE_2D)
+       {
+               glTexImage2D(TEXTURE_TYPE, 0, GL_RGBA8, width, height, 0, GL_BGRA, GL_UNSIGNED_BYTE, (GLvoid*)FreeImage_GetBits(data));
+               //Message::info("TexImage");
+               //Graphix::getGlError();
+               //Message::info("Other Stuff");
+               glGenerateMipmap(TEXTURE_TYPE);
+       }
+//     else if (TEXTURE_TYPE == GL_TEXTURE_CUBE_MAP)
+               
 
-       glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, width, height, 0, GL_BGRA, GL_UNSIGNED_BYTE, (GLvoid*)FreeImage_GetBits(data));
-       glGenerateMipmap(GL_TEXTURE_2D);
-
-       glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
-       glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+       glTexParameteri(TEXTURE_TYPE, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
+       glTexParameteri(TEXTURE_TYPE, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+       if (TEXTURE_TYPE == -1)
+       {
+               glTexParameteri(TEXTURE_TYPE, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
+               glTexParameteri(TEXTURE_TYPE, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
+               glTexParameteri(TEXTURE_TYPE, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);
+       }
 
        texture_map[_path] = handle;
+       //Graphix::getGlError();
+       //Message::info("Done");
+       
 }
 
 Texture::~Texture()
@@ -72,7 +102,7 @@ Texture::~Texture()
 void Texture::bind(int unit)
 {
        glActiveTexture(GL_TEXTURE0 + unit);
-       glBindTexture(GL_TEXTURE_2D, handle);
+       glBindTexture(TEXTURE_TYPE, handle);
 }
 
 Texture::operator string() const
index 85043e41a2208869a907b122dfbc4ed491cead42..36ec0a0261ad1f7fe16ebd4627020717b27e307d 100644 (file)
@@ -24,6 +24,7 @@ public:
 private:
        unsigned int handle;
        string path;
+       unsigned int TEXTURE_TYPE;
 
        static str2int_map texture_map;
 };
\ No newline at end of file
index 418c1d8f0e227d515b3ef9298a488dc609eaaefa..45984119a295817f2bdef78fba213e9470c007b9 100644 (file)
@@ -41,8 +41,14 @@ void ViewPort::bindView(Shader* shader) const{
 
 void ViewPort::bindView(Shader* shader, vec3 pos) const{
        shader->useShader();
-       glUniformMatrix4fv(shader->getUniformLocation("uProjection"), 1, false, value_ptr(projection));
-       glUniformMatrix4fv(shader->getUniformLocation("uView"), 1, false, value_ptr(translate(view,-pos)));
+       int tmp = -1;
+
+       tmp = shader->getUniformLocation("uProjection");
+       if (tmp>=0)
+               glUniformMatrix4fv(tmp, 1, false, value_ptr(projection));
+       tmp = shader->getUniformLocation("uView");
+       if (tmp >= 0)
+       glUniformMatrix4fv(tmp, 1, false, value_ptr(translate(view,-pos)));
 }
 
 void ViewPort::rotateView(float angle_x, float angle_y){
index 1d1d0204ad928e10e30a5d26e30919f01bb7ebdb..dce4bd13175ede106cac49a8e2d738e662fd704e 100644 (file)
@@ -18,7 +18,7 @@ Message::~Message()
 void Message::error(string _msg)
 {
        cerr << currentDateTime() << " E " << _msg << endl;
-       system("pause");
+//     system("pause");
 //     exit(-1);
 }
 
index c549e10b468a235d87b21a3bda2db72e33947bfb..3a63f80f5aae006492131e082828afe7984ebd40 100644 (file)
Binary files a/models/SkyBox.blend and b/models/SkyBox.blend differ
index 55de0ed72f8afa17e1be6b69e35fc6502739ab3e..c549e10b468a235d87b21a3bda2db72e33947bfb 100644 (file)
Binary files a/models/SkyBox.blend1 and b/models/SkyBox.blend1 differ
index a98e0987f68a9bf2dff9fb78a1739c649f4ba6ac..6b679296578dfdda7cbb6990404a7270ebcf6273 100644 (file)
@@ -5,8 +5,8 @@
       <author>Blender User</author>
       <authoring_tool>Blender 2.73.0 commit date:2015-01-20, commit time:18:16, hash:bbf09d9</authoring_tool>
     </contributor>
-    <created>2015-04-16T10:05:45</created>
-    <modified>2015-04-16T10:05:45</modified>
+    <created>2015-04-21T11:48:56</created>
+    <modified>2015-04-21T11:48:56</modified>
     <unit name="meter" meter="1"/>
     <up_axis>Z_UP</up_axis>
   </asset>
@@ -60,7 +60,7 @@
   <library_visual_scenes>
     <visual_scene id="Scene" name="Scene">
       <node id="Plane" name="Plane" type="NODE">
-        <matrix sid="transform">2 0 0 0 0 2 0 0 0 0 2 0 0 0 0 1</matrix>
+        <matrix sid="transform">2 0 0 0 0 -8.74228e-8 -2 0 0 2 -8.74228e-8 0 0 0 0 1</matrix>
         <instance_geometry url="#Plane-mesh"/>
       </node>
     </visual_scene>
index 1e1c0cc49b5cfd81f224da2f9950e7550603c225..8198ee869bf04bee8c1818e230d8ca6b1b6778ca 100644 (file)
@@ -7,4 +7,5 @@ out vec4 FragmentColor;
  
 void main(){
        FragmentColor = texture(uColorTexture, eyeDirection);
+       //FragmentColor = vec4(eyeDirection, 0.5);
 }
index 9c2cf3c64d8f3d0cf715d39427bd8639da5c73ee..a64443debec704ceef3ce5c7a1c3689734782107 100644 (file)
@@ -1,18 +1,21 @@
 //Vertex Shader
 #version 330
 
-in vec3 position;
-uniform mat4 projection;
-uniform mat4 model;
-uniform mat4 view;
+in vec3 aPosition;
+
+uniform mat4 uProjection;
+uniform mat4 uModel;
+uniform mat4 uView;
 
 smooth out vec3 eyeDirection;
 
 void main() {
-       mat4 invProjection = inverse(projection);
-       mat3 invModelview = mat3(1);// transpose(mat3(model));
-       vec3 unprojected = (invProjection * vec4(position, 1)).xyz;
+       mat4 invProjection = inverse(uProjection);
+       mat3 invModelview = transpose(mat3(uView));
+       vec3 unprojected = (invProjection * vec4(aPosition, 1)).xyz;
        eyeDirection = invModelview * unprojected;
+       //eyeDirection = unprojected;
+       //eyeDirection = aPosition;
 
-       gl_Position = vec4(position,1);
+       gl_Position = vec4(aPosition,1);
 }
\ No newline at end of file
diff --git a/textures/model_player.png b/textures/model_player.png
deleted file mode 100644 (file)
index 19601c1..0000000
Binary files a/textures/model_player.png and /dev/null differ
diff --git a/textures/model_player_2D.png b/textures/model_player_2D.png
new file mode 100644 (file)
index 0000000..19601c1
Binary files /dev/null and b/textures/model_player_2D.png differ
diff --git a/textures/model_skybox.png b/textures/model_skybox.png
deleted file mode 100644 (file)
index beb0696..0000000
Binary files a/textures/model_skybox.png and /dev/null differ
diff --git a/textures/model_skybox_CUBE.png b/textures/model_skybox_CUBE.png
new file mode 100644 (file)
index 0000000..beb0696
Binary files /dev/null and b/textures/model_skybox_CUBE.png differ
diff --git a/textures/skybox_CUBE.jpg b/textures/skybox_CUBE.jpg
new file mode 100644 (file)
index 0000000..dfbc845
Binary files /dev/null and b/textures/skybox_CUBE.jpg differ