Refactor Engine::getGLVersion()

This commit is contained in:
2023-12-14 21:36:25 -06:00
parent 97e6b1f7df
commit b77f758aae
4 changed files with 5 additions and 7 deletions

View File

@@ -34,8 +34,6 @@ add_library(SDL3D SHARED ${SOURCES}
# Why god???
set_target_properties(SDL3D PROPERTIES LINKER_LANGUAGE CXX)
CPMAddPackage(
NAME glm
GITHUB_REPOSITORY g-truc/glm
@@ -52,5 +50,5 @@ find_package(OpenGL REQUIRED)
include_directories({$OPENGL_INCLUDE_DIRS})
find_package(glm REQUIRED)
target_link_libraries(SDL3D PUBLIC glm::glm SDL2::SDL2 ${OPENGL_LIBRARIES})
add_executable(SDL3D_Demo "demo/main.cpp")
add_executable(SDL3D_Demo "include/demo/main.cpp")
target_link_libraries(SDL3D_Demo PUBLIC SDL3D)

1
include/engine/maths.h Normal file
View File

@@ -0,0 +1 @@
#pragma once

View File

@@ -11,9 +11,9 @@ void Engine::quit() const {
float Engine::getGLVersion()
{
std::string str = reinterpret_cast<const char *>(glGetString(GL_VERSION));
str.erase(str.begin()+3,str.end());
return std::stof(str);
const std::string full_gl_ver = reinterpret_cast<const char *>(glGetString(GL_VERSION));
const std::string gl_major = full_gl_ver.substr(0, 3);
return std::stof(gl_major);
}
void Engine::initGL()
@@ -47,7 +47,6 @@ void Engine::initGL()
void Engine::initVideo()
{
Uint32 sdl_initializer_flags = SDL_INIT_VIDEO;// | SDL_INIT_AUDIO;
// Start SDL, check for errors