No more disabling buffers, just enable the next one.
This commit is contained in:
parent
2fa2082098
commit
ccd69afc2e
@ -69,13 +69,6 @@ void Screen::Enable() {
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
}
|
||||
|
||||
void Screen::Disable() {
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||
glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
}
|
||||
|
||||
void Screen::Draw() {
|
||||
glBindVertexArray(quad);
|
||||
glDrawArrays(GL_TRIANGLES, 0, 6);
|
||||
|
@ -14,7 +14,6 @@ class Screen {
|
||||
public:
|
||||
Screen();
|
||||
void Enable();
|
||||
void Disable();
|
||||
void Draw();
|
||||
const int width = 640;
|
||||
const int height = 480;
|
||||
|
@ -32,6 +32,14 @@ bool Window::ShouldClose() {
|
||||
return glfwWindowShouldClose(glfwWindow);
|
||||
}
|
||||
|
||||
void Window::Enable() {
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||
glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
glViewport(0, 0, width, height);
|
||||
}
|
||||
|
||||
void Window::Update() {
|
||||
glfwSwapBuffers(glfwWindow);
|
||||
glfwPollEvents();
|
||||
|
@ -31,19 +31,23 @@ class Window {
|
||||
public:
|
||||
/**
|
||||
Initializes the window.
|
||||
*/
|
||||
*/
|
||||
void Init();
|
||||
/**
|
||||
@returns whether or not the user tried to close the window
|
||||
*/
|
||||
*/
|
||||
bool ShouldClose();
|
||||
/**
|
||||
Close the window.
|
||||
Begin rendering to the window
|
||||
*/
|
||||
void Enable();
|
||||
/**
|
||||
Swap the buffers and poll for events
|
||||
*/
|
||||
*/
|
||||
void Update();
|
||||
/**
|
||||
Close the window.
|
||||
*/
|
||||
void Close();
|
||||
private:
|
||||
friend class Input;
|
||||
|
@ -133,13 +133,11 @@ int main() {
|
||||
glDepthFunc(GL_LESS);
|
||||
}
|
||||
|
||||
// Stop rendering to texture
|
||||
screen.Disable();
|
||||
// // Render the screen
|
||||
// Render to the window
|
||||
window.Enable();
|
||||
|
||||
screenShader->Use();
|
||||
screenShader->UpdateTex(screen.tex);
|
||||
// Ummm?
|
||||
// glViewport(0, 0, width, height);
|
||||
screen.Draw();
|
||||
|
||||
window.Update();
|
||||
|
Loading…
Reference in New Issue
Block a user