cat3d
A tiny OpenGL 3D engine library written in and for C++.
window.hpp
1 #pragma once
2 
3 #include <GL/glew.h>
4 #include <GLFW/glfw3.h>
5 #include <glm/glm.hpp>
6 #include <string>
7 
8 #include "cat3d/color.hpp"
9 #include "cat3d/gl/shader.hpp"
10 
11 namespace cat3d {
12 
17 class window {
18 public:
19  window(unsigned int width, unsigned int height, const char* title);
20  ~window();
21 
26  bool is_open() const;
27 
32  void clear(color clear_color);
33 
38  void flip();
39 
44  void set_transform(glm::mat4 m);
45 
50  void set_view(glm::mat4 v);
51 
56  void set_proj(glm::mat4 p);
57 
63  glm::vec2 size() const;
64 
65 private:
67  GLFWwindow* m_win;
68 
70  GLuint program();
71 
78  template <typename T>
79  void set_uniform(const char* name, T& value);
80 };
81 
82 }
cat3d::color
Base color class.
Definition: color.hpp:11
cat3d::window::is_open
bool is_open() const
Returns false if the window should close.
cat3d::window::flip
void flip()
Render drawn items to the screen.
cat3d::window
Manages internal window api / state.
Definition: window.hpp:17
cat3d::window::set_proj
void set_proj(glm::mat4 p)
set the projection matrix
cat3d::window::size
glm::vec2 size() const
get the x/y size of the window, in pixels
cat3d::window::set_view
void set_view(glm::mat4 v)
set the view matrix
cat3d::window::set_transform
void set_transform(glm::mat4 m)
set the model matrix when rendering
cat3d::window::clear
void clear(color clear_color)
Clear the window.