feat: added FPS counter to terminal
This commit is contained in:
14
main.cpp
14
main.cpp
@@ -1,7 +1,9 @@
|
||||
#include "FullScreenQuad.hpp"
|
||||
#include "PerformanceAnalyser.hpp"
|
||||
#include <GL/glew.h>
|
||||
#include <GLFW/glfw3.h>
|
||||
#include <cstdio>
|
||||
#include <iostream>
|
||||
|
||||
const char *vertexShaderSource =
|
||||
#include "fsq.glsl"
|
||||
@@ -75,6 +77,8 @@ void framebuffer_size_callback(GLFWwindow *window, int width, int height) {
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
std::cout << "test";
|
||||
std::cout << std::flush;
|
||||
|
||||
GLFWwindow *window;
|
||||
|
||||
@@ -104,7 +108,15 @@ int main(int argc, char **argv) {
|
||||
|
||||
FullScreenQuad fsq{};
|
||||
|
||||
PerformanceAnalyser perf{};
|
||||
|
||||
double time = glfwGetTime();
|
||||
|
||||
while (!glfwWindowShouldClose(window)) {
|
||||
|
||||
time = glfwGetTime();
|
||||
perf.update(time);
|
||||
|
||||
processInput(window);
|
||||
/* Render here */
|
||||
|
||||
@@ -116,7 +128,7 @@ int main(int argc, char **argv) {
|
||||
int aspectLocation = glGetUniformLocation(shaderProgram, "aspect");
|
||||
glUniform1f(aspectLocation, aspect);
|
||||
int timeLocation = glGetUniformLocation(shaderProgram, "t");
|
||||
glUniform1f(timeLocation, 2. * glfwGetTime());
|
||||
glUniform1f(timeLocation, 2. * time);
|
||||
|
||||
glBindVertexArray(fsq.getVAO());
|
||||
glDrawArrays(GL_TRIANGLES, 0, 6);
|
||||
|
||||
Reference in New Issue
Block a user