45 lines
963 B
C++
45 lines
963 B
C++
#ifndef GRAPHICS_HPP
|
|
#define GRAPHICS_HPP
|
|
#define GL_GLEXT_PROTOTYPES
|
|
|
|
// Includes
|
|
#include "imgui.h"
|
|
#include "imgui_impl_sdl3.h"
|
|
#include "imgui_impl_opengl3.h"
|
|
#include <SDL3/SDL_opengl.h>
|
|
#include "window.hpp"
|
|
|
|
// Constants
|
|
const int open_gl_major_version = 3;
|
|
const int open_gl_minor_version = 3;
|
|
const int enable_vsync = 1;
|
|
|
|
// Variables
|
|
extern Uint32 last_time;
|
|
extern Uint32 current_time;
|
|
extern float frame_time;
|
|
extern float fps;
|
|
extern float frame_time_graph[100];
|
|
extern SDL_GLContext gl_context;
|
|
|
|
extern ImGuiIO& io;
|
|
extern ImGuiStyle& style;
|
|
|
|
// Functions
|
|
int initialize_opengl();
|
|
void cleanup_opengl();
|
|
|
|
// ImGui
|
|
int initialize_imgui();
|
|
void cleanup_imgui();
|
|
void new_frame_imgui();
|
|
void frame_time_ui();
|
|
|
|
// Frame time calculation
|
|
void calc_frame_time();
|
|
|
|
// Shader management
|
|
unsigned int compile_shader(const char* shader_source, GLenum shader_type);
|
|
unsigned int create_program(unsigned int vertex_shader, unsigned int fragment_shader);
|
|
|
|
#endif |