Update render.cpp

This commit is contained in:
2024-01-24 21:47:43 -05:00
parent 81e37f6930
commit fff327b55d

View File

@@ -40,16 +40,19 @@ void Render::render() {
glLoadIdentity();
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST_MIPMAP_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST_MIPMAP_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
//TODO: *Always* render the camera first.
glCullFace(GL_BACK);
for (auto& e : engine->world->GetChildren()) {
if (e->draw)
e->render();
}
if (engine->glError != GL_NO_ERROR)
std::cerr << "OpenGL: " << glGetError() << std::endl;
engine->glError = glGetError();
if (engine->glError != GL_NO_ERROR) {
std::cerr << "OpenGL: " << gluErrorString(engine->glError) << std::endl;
exit(0);
}
}
void Render::post_render() {
@@ -57,8 +60,8 @@ void Render::post_render() {
e->post_render();
//Reset all the transformations for the next frame.
glPopMatrix();
glPushMatrix();
glPopMatrix();
RWindow::glSwapBuffers();
}