Initial commit after setting up Gitea. At this point a 3D Cube is using the mpu6050 data being converted by the stm32f446to quaternions to be moved. It works, bare minimum
This commit is contained in:
55
visualization.cpp
Normal file
55
visualization.cpp
Normal file
@@ -0,0 +1,55 @@
|
||||
#include "include/glad/glad.h"
|
||||
#include "include/glfw/glfw3.h"
|
||||
|
||||
#include <iostream>
|
||||
#include "visualization.hpp"
|
||||
|
||||
|
||||
GLFWwindow* initWindow() {
|
||||
// return nullptr because of GLFWwindow datatype
|
||||
// set to openGL 3 atleast
|
||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
|
||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
|
||||
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
|
||||
|
||||
// initialize glfw, check for success
|
||||
if (!glfwInit()) {
|
||||
std::cerr << "GLFW initialization failed" << std::endl;
|
||||
return nullptr;
|
||||
} else {
|
||||
std::cerr << "GLFW initialization SUCCESS" << std::endl;
|
||||
}
|
||||
|
||||
// create the window
|
||||
GLFWwindow* window = glfwCreateWindow(1280, 720, "Body Tracking Visualizer", NULL, NULL);
|
||||
if (!window){
|
||||
std::cerr << "GLFW window creation failed" << std::endl;
|
||||
glfwTerminate();
|
||||
return nullptr;
|
||||
} else {
|
||||
std::cerr << "GLFW window creation SUCCESS" << std::endl;
|
||||
}
|
||||
|
||||
// set the window context current
|
||||
glfwMakeContextCurrent(window);
|
||||
|
||||
// initialize GLAD
|
||||
if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress)){
|
||||
std::cerr << "GLAD initialization failed" << std::endl;
|
||||
return nullptr;
|
||||
} else {
|
||||
std::cerr << "GLAD initialization SUCCESS" << std::endl;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// glViewport could be added here to make the display area smaller than the actual windowsize
|
||||
// with callbacks to automatically adjust if the user changes size
|
||||
|
||||
|
||||
|
||||
// vsync
|
||||
glfwSwapInterval(1);
|
||||
|
||||
return window;
|
||||
}
|
||||
Reference in New Issue
Block a user