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);
|
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() {
|
void Screen::Draw() {
|
||||||
glBindVertexArray(quad);
|
glBindVertexArray(quad);
|
||||||
glDrawArrays(GL_TRIANGLES, 0, 6);
|
glDrawArrays(GL_TRIANGLES, 0, 6);
|
||||||
|
@ -14,7 +14,6 @@ class Screen {
|
|||||||
public:
|
public:
|
||||||
Screen();
|
Screen();
|
||||||
void Enable();
|
void Enable();
|
||||||
void Disable();
|
|
||||||
void Draw();
|
void Draw();
|
||||||
const int width = 640;
|
const int width = 640;
|
||||||
const int height = 480;
|
const int height = 480;
|
||||||
|
@ -32,6 +32,14 @@ bool Window::ShouldClose() {
|
|||||||
return glfwWindowShouldClose(glfwWindow);
|
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() {
|
void Window::Update() {
|
||||||
glfwSwapBuffers(glfwWindow);
|
glfwSwapBuffers(glfwWindow);
|
||||||
glfwPollEvents();
|
glfwPollEvents();
|
||||||
|
@ -31,19 +31,23 @@ class Window {
|
|||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
Initializes the window.
|
Initializes the window.
|
||||||
*/
|
*/
|
||||||
void Init();
|
void Init();
|
||||||
/**
|
/**
|
||||||
@returns whether or not the user tried to close the window
|
@returns whether or not the user tried to close the window
|
||||||
*/
|
*/
|
||||||
bool ShouldClose();
|
bool ShouldClose();
|
||||||
/**
|
/**
|
||||||
Close the window.
|
Begin rendering to the window
|
||||||
*/
|
*/
|
||||||
|
void Enable();
|
||||||
/**
|
/**
|
||||||
Swap the buffers and poll for events
|
Swap the buffers and poll for events
|
||||||
*/
|
*/
|
||||||
void Update();
|
void Update();
|
||||||
|
/**
|
||||||
|
Close the window.
|
||||||
|
*/
|
||||||
void Close();
|
void Close();
|
||||||
private:
|
private:
|
||||||
friend class Input;
|
friend class Input;
|
||||||
|
@ -133,13 +133,11 @@ int main() {
|
|||||||
glDepthFunc(GL_LESS);
|
glDepthFunc(GL_LESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Stop rendering to texture
|
// Render to the window
|
||||||
screen.Disable();
|
window.Enable();
|
||||||
// // Render the screen
|
|
||||||
screenShader->Use();
|
screenShader->Use();
|
||||||
screenShader->UpdateTex(screen.tex);
|
screenShader->UpdateTex(screen.tex);
|
||||||
// Ummm?
|
|
||||||
// glViewport(0, 0, width, height);
|
|
||||||
screen.Draw();
|
screen.Draw();
|
||||||
|
|
||||||
window.Update();
|
window.Update();
|
||||||
|
Loading…
Reference in New Issue
Block a user