}
void draw(){
- glActiveTexture(GL_TEXTURE0);
- glBindTexture(GL_TEXTURE_2D, colorIndex);
- glUseProgram(shaderProgram);
- glUniform1i(glGetUniformLocation(shaderProgram, "sampler"), 0);
- glEnable(GL_TEXTURE_2D);
+ //glEnable(GL_TEXTURE_2D);
glColor3ub(255,255,255);
glBegin(GL_QUADS);
glTexCoord2f(.25*index.x, .125*index.y); glVertex2i(loc.x, loc.y);
glTexCoord2f(.25*index.x, .125*index.y); glVertex2i(loc.x + width, loc.y + height);
glTexCoord2f(.25*index.x, .125*index.y); glVertex2i(loc.x, loc.y + width);
glEnd();
- glDisable(GL_TEXTURE_2D);
- glUseProgram(0);
+ //glDisable(GL_TEXTURE_2D);
+ //glUseProgram(0);
}
bool kill(float delta){
duration -= delta;
safeSetColorA( 255, 255, 255, weather == WorldWeather::Snowy ? 150 : 255 - worldShade * 4);
glBegin( GL_QUADS );
- glTexCoord2i( 0, 0 ); glVertex2i( offset.x - SCREEN_WIDTH/2-5, SCREEN_HEIGHT );
- glTexCoord2i( 1, 0 ); glVertex2i( offset.x + SCREEN_WIDTH/2+5, SCREEN_HEIGHT );
- glTexCoord2i( 1, 1 ); glVertex2i( offset.x + SCREEN_WIDTH/2+5, 0 );
- glTexCoord2i( 0, 1 ); glVertex2i( offset.x - SCREEN_WIDTH/2-5, 0 );
+ glTexCoord2i( 0, 0 ); glVertex2i( offset.x - SCREEN_WIDTH/2-5, offset.y + SCREEN_HEIGHT/2 );
+ glTexCoord2i( 1, 0 ); glVertex2i( offset.x + SCREEN_WIDTH/2+5, offset.y + SCREEN_HEIGHT/2 );
+ glTexCoord2i( 1, 1 ); glVertex2i( offset.x + SCREEN_WIDTH/2+5, offset.y - SCREEN_HEIGHT/2 );
+ glTexCoord2i( 0, 1 ); glVertex2i( offset.x - SCREEN_WIDTH/2-5, offset.y - SCREEN_HEIGHT/2 );
glEnd();
bgTex->bindNext();
safeSetColorA( 255, 255, 255, worldShade * 4);
glBegin( GL_QUADS );
- glTexCoord2i( 0, 0 ); glVertex2i( worldStart, SCREEN_HEIGHT );
- glTexCoord2i( 1, 0 ); glVertex2i( -worldStart, SCREEN_HEIGHT );
- glTexCoord2i( 1, 1 ); glVertex2i( -worldStart, 0 );
- glTexCoord2i( 0, 1 ); glVertex2i( worldStart, 0 );
+ glTexCoord2i( 0, 0 ); glVertex2i( offset.x - SCREEN_WIDTH/2-5, offset.y + SCREEN_HEIGHT/2 );
+ glTexCoord2i( 1, 0 ); glVertex2i( offset.x + SCREEN_WIDTH/2+5, offset.y + SCREEN_HEIGHT/2 );
+ glTexCoord2i( 1, 1 ); glVertex2i( offset.x + SCREEN_WIDTH/2+5, offset.y - SCREEN_HEIGHT/2 );
+ glTexCoord2i( 0, 1 ); glVertex2i( offset.x - SCREEN_WIDTH/2-5, offset.y - SCREEN_HEIGHT/2 );
glEnd();
glDisable( GL_TEXTURE_2D );
// draw particles and buildings
- std::for_each( particles.begin(), particles.end(), [](Particles part) { if ( part.behind ) part.draw(); });
+ glActiveTexture(GL_TEXTURE0);
+ glBindTexture(GL_TEXTURE_2D, colorIndex);
+
+ glUniform1i(glGetUniformLocation(shaderProgram, "sampler"), 0);
+ glUseProgram(shaderProgram);
+
+ std::for_each( particles.begin(), particles.end(), [](Particles part) { if ( part.behind ) part.draw(); });
+
+ glUseProgram(0);
for ( auto &b : build )
b->draw();
* Draw remaining entities.
*/
+
+ glActiveTexture(GL_TEXTURE0);
+ glBindTexture(GL_TEXTURE_2D, colorIndex);
+
+ glUniform1i(glGetUniformLocation(shaderProgram, "sampler"), 0);
+ glUseProgram(shaderProgram);
+
std::for_each( particles.begin(), particles.end(), [](Particles part) { if ( !part.behind ) part.draw(); });
+ glUseProgram(0);
+
for ( auto &n : npc )
n->draw();
/*
* Draw all entities.
*/
+ glActiveTexture(GL_TEXTURE0);
+ glBindTexture(GL_TEXTURE_2D, colorIndex);
- for ( auto &part : particles )
- part.draw();
+ glUniform1i(glGetUniformLocation(shaderProgram, "sampler"), 0);
+ glUseProgram(shaderProgram);
+
+ std::for_each( particles.begin(), particles.end(), [](Particles &part) { part.draw(); });
+
+ glUseProgram(0);
+
+ /*for ( auto &part : particles )
+ part.draw();*/
for ( auto &e : entity )
e->draw();
loadedRight = false;
}
} else
- abort();
+ abort();
} else if ( name == "style" ) {
tmp->setStyle(wxml->StrAttribute("folder"));
tmp->setBackground((WorldBGType)wxml->UnsignedAttribute("background"));