diff options
Diffstat (limited to 'main.cpp')
-rw-r--r-- | main.cpp | 21 |
1 files changed, 5 insertions, 16 deletions
@@ -344,7 +344,7 @@ int main(/*int argc, char *argv[]*/){ fragShader = glCreateShader(GL_FRAGMENT_SHADER); - std::string shaderFileContents = readFile("shader.frag"); + std::string shaderFileContents = readFile("test.frag"); const GLchar *shaderSource = shaderFileContents.c_str(); GLint bufferln = GL_FALSE; @@ -571,10 +571,7 @@ void render(){ glOrtho((offset.x-SCREEN_WIDTH/2),(offset.x+SCREEN_WIDTH/2),offset.y-SCREEN_HEIGHT/2,offset.y+SCREEN_HEIGHT/2,-1,1); glMatrixMode(GL_MODELVIEW); glPushMatrix(); - glLoadIdentity(); - glEnable(GL_STENCIL_TEST); - glPushMatrix(); - + glLoadIdentity(); /* * glPushAttrib This passes attributes to the renderer so it knows what it can * render. In our case, GL_DEPTH_BUFFER_BIT allows the renderer to @@ -597,6 +594,7 @@ void render(){ * Call the world's draw function, drawing the player, the world, the background, and entities. Also * draw the player's inventory if it exists. */ + glUseProgramObjectARB(shaderProgram); player->near=true; // Draw the player's name @@ -606,17 +604,6 @@ void render(){ * Apply shaders if desired. */ - #ifdef SHADERS - glUseProgramObjectARB(shaderProgram); - glUniform2f(glGetUniformLocation(shaderProgram, "lightLocation"), 640,100); - glUniform3f(glGetUniformLocation(shaderProgram, "lightColor"), 1,1,1); - glUniform1f(glGetUniformLocation(shaderProgram, "lightStrength"), 100 + (1000-(shade*10))); - //std::cout << 100 + (1000-(shade*10)) << std::endl; - glColor4ub(0,0,0,200); - glRectf(offset.x-SCREEN_WIDTH/2,0,offset.x+SCREEN_WIDTH/2,SCREEN_HEIGHT); - glUseProgramObjectARB(0); - #endif //SHADERS - handAngle = atan((ui::mouse.y - (player->loc.y + player->height/2)) / (ui::mouse.x - player->loc.x + player->width/2))*180/PI; if(ui::mouse.x < player->loc.x){ if(handAngle <= 0) @@ -693,6 +680,8 @@ void render(){ /* * Here we draw a black overlay if it's been requested. */ + glUseProgramObjectARB(0); + if(fadeIntensity){ if(fadeWhite) |