diff --git a/.gitignore b/.gitignore index 8acd9d4..bdc118c 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,5 @@ build* Makefile* object_script.* debug -release \ No newline at end of file +release +shaders.cpp \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index d420f23..6e1b55a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,8 +1,14 @@ project(SparrowRenderer) cmake_minimum_required(VERSION 2.8) +# choose resource files +file(GLOB RESOURCES_FILES src/*.h shaders/*.glsl) +FILE(GLOB RES_SRC_FILE shaders/*.glsl) +SET(RESOURCE_DST_FILE shaders.cpp) + # choose source file file(GLOB LIB_SRC_LIST src/*.cpp src/glew.c) +list(APPEND LIB_SRC_LIST ${RESOURCE_DST_FILE}) file(GLOB LIB_HEAD_LIST src/*.h) #set compilation option @@ -14,10 +20,6 @@ if(CMAKE_BUILD_TYPE MATCHES "Debug") add_definitions(-DRENDER_DEBUG) endif() -file(GLOB RESOURCES_FILES src/*.h shaders/*.glsl) -FILE(GLOB RES_SRC_FILE shaders/*.glsl) -SET(RESOURCE_DST_FILE shaders.cpp) - set(CMAKE_TEMPLATE_PATH "../cmaketemplate") include(${CMAKE_TEMPLATE_PATH}/template.cmake) diff --git a/src/phongmaterial.cpp b/src/phongmaterial.cpp index 6bcf66e..2faf9d2 100644 --- a/src/phongmaterial.cpp +++ b/src/phongmaterial.cpp @@ -60,7 +60,7 @@ void PhongMaterial::bindAttributes(Shader* myShader) diffuse_texture->bind(0); else { - glActiveTexture(0); + glActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D, 0); } } diff --git a/src/phongmaterial.h b/src/phongmaterial.h index 487fa91..88c9b30 100644 --- a/src/phongmaterial.h +++ b/src/phongmaterial.h @@ -8,12 +8,13 @@ class Texture; class PhongMaterial : public Material { -private: +public: // TODO add setters for this glm::vec3 ambient; glm::vec3 diffuse; glm::vec3 specular; float shininess; bool castShadow; +private: Texture* ambient_texture; Texture* diffuse_texture; Texture* specular_texture; diff --git a/src/pipeline.cpp b/src/pipeline.cpp index 04340f3..4693d62 100644 --- a/src/pipeline.cpp +++ b/src/pipeline.cpp @@ -19,7 +19,7 @@ SimplePipeline::SimplePipeline(ShaderSource *forwardSource) glEnable(GL_CULL_FACE); glEnable(GL_TEXTURE_2D); - m_isCrappy = forwardSource != NULL && SparrowRenderer::isModernOpenGLAvailable(); + m_isCrappy = !(forwardSource != NULL && SparrowRenderer::isModernOpenGLAvailable()); if(!m_isCrappy) { ForwardModule *forward = new ForwardModule();