synchronzie laptop and pc

This commit is contained in:
Krzysztof Rudnicki 2022-09-07 18:34:50 +02:00
parent 1860ab5848
commit 0f293adb96
4 changed files with 33 additions and 28 deletions

View File

@ -8,7 +8,8 @@
#include "constants.hpp"
#include "misc.hpp"
void configureGLFW(const int GLFWMajorVersion, const int GLFWMinorVersion) {
void configureGLFW(const int GLFWMajorVersion, const int GLFWMinorVersion)
{
// first argument tells us what option to configure
// second is to what we set the value of this option
// see: https://www.glfw.org/docs/latest/window.html#window_hints
@ -24,17 +25,19 @@ void configureGLFW(const int GLFWMajorVersion, const int GLFWMinorVersion) {
#endif
}
void instantiateGLFWwindow() {
void instantiateGLFWwindow()
{
// Initialize GLFW
glfwInit();
configureGLFW(constants::GLFW_MAJOR_VERSION, constants::GLFW_MINOR_VERSION);
}
const GLFWwindow* createWindowObject() {
GLFWwindow *createWindowObject()
{
// First two arguments are width and height
// Third is the name of the window
// We ignore last two
const GLFWwindow* window = glfwCreateWindow(constants::MAIN_WINDOW_WIDTH, constants::MAIN_WINDOW_HEIGHT, constants::MAIN_WINDOW_NAME, NULL, NULL);
GLFWwindow *window = glfwCreateWindow(constants::MAIN_WINDOW_WIDTH, constants::MAIN_WINDOW_HEIGHT, constants::MAIN_WINDOW_NAME, NULL, NULL);
return window;
}
@ -84,7 +87,8 @@ GLFWwindow* prepareForRender()
// we make context of this window main context of current thread
glfwMakeContextCurrent(window);
if(initializeGLAD() == -1) return NULL;
if (initializeGLAD() == -1)
return NULL;
viewPort(window);
return window;
}

View File

@ -4,7 +4,7 @@
void configureGLFW(const int GLFWMajorVersion, const int GLFWMinorVersion);
void instantiateGLFWwindow();
const GLFWwindow* createWindowObject();
GLFWwindow *createWindowObject();
int initializeGLAD();
void framebuffer_size_callback(GLFWwindow *window, int width, int height);
void viewPort(GLFWwindow *window);

Binary file not shown.

View File

@ -17,7 +17,8 @@ int main()
{
// changed in glfwWindowShouldClose
GLFWwindow *window = prepareForRender();
if(window == NULL) return -1;
if (window == NULL)
return -1;
renderLoop(window);
// clean GLFW resources