aboutsummaryrefslogtreecommitdiffstats
path: root/main.cpp
diff options
context:
space:
mode:
authordrumsetmonkey <abelleisle@roadrunner.com>2015-11-02 08:52:36 -0500
committerdrumsetmonkey <abelleisle@roadrunner.com>2015-11-02 08:52:36 -0500
commit07d73ea992641198a887f000bf44b874c8e11574 (patch)
treea0d3e80548d4528ae7bf27561d5c94d3a55561f0 /main.cpp
parent822d9d5b5ef34c3ec2b5ebaded5744bdba8bade1 (diff)
parentdcefab4d5e9d9cff3bfbc65e45fae9309d426a69 (diff)
Added new project for lighting test
Diffstat (limited to 'main.cpp')
-rw-r--r--main.cpp21
1 files changed, 19 insertions, 2 deletions
diff --git a/main.cpp b/main.cpp
index 848d80f..e0d195f 100644
--- a/main.cpp
+++ b/main.cpp
@@ -199,10 +199,15 @@ vec2 offset;
* of milliseconds that have passed sine the epoch.
*
*/
+
+#ifdef __WIN32__
+#define millis() SDL_GetTicks()
+#else
unsigned int millis(void){
std::chrono::system_clock::time_point now=std::chrono::system_clock::now();
return std::chrono::duration_cast<std::chrono::milliseconds>(now.time_since_epoch()).count();
}
+#endif
typedef enum {
SUNNY = 0,
@@ -237,10 +242,10 @@ int main(int argc, char *argv[]){
// Run SDL_Quit when main returns
atexit(SDL_Quit);
- /*Untitled
+ /*
* (Attempt to) Initialize SDL_image libraries with IMG_INIT_PNG so that we can load PNG
* textures for the entities and stuff.
- * Untitled
+ *
*/
if(!(IMG_Init(IMG_INIT_PNG) & IMG_INIT_PNG)){
@@ -313,7 +318,9 @@ int main(int argc, char *argv[]){
*/
GLenum err;
+#ifndef __WIN32__
glewExperimental = GL_TRUE;
+#endif
if((err=glewInit()) != GLEW_OK){
std::cout << "GLEW was not able to initialize! Error: " << glewGetErrorString(err) << std::endl;
return -1;
@@ -724,10 +731,18 @@ void render(){
*/
player->near=true; // Draw the player's name
+
+ #ifdef SHADERS
+ glUseProgramObjectARB(shaderProgram);
+ glUniform2f(glGetUniformLocation(shaderProgram, "lightLocation"), 0,100);
+ glUniform3f(glGetUniformLocation(shaderProgram, "lightColor"), 255,255,255);
+ //glBlendFunc(GL_ONE, GL_ONE);
+ #endif //SHADERS
currentWorld->draw(player);
#ifdef SHADERS
+<<<<<<< Updated upstream
glUseProgramObjectARB(shaderProgram);
glUniform2f(glGetUniformLocation(shaderProgram, "lightLocation"), 640,100);
glUniform3f(glGetUniformLocation(shaderProgram, "lightColor"), 1,1,1);
@@ -740,6 +755,8 @@ void render(){
glRectf(offset.x-SCREEN_WIDTH/2,0,offset.x+SCREEN_WIDTH/2,SCREEN_HEIGHT);
#ifdef SHADERS
+=======
+>>>>>>> Stashed changes
glUseProgramObjectARB(0);
#endif //SHADERS