mirror of
https://github.com/MichaelFisher1997/opengl-cpp.git
synced 2025-04-27 06:03:10 +00:00
pre opengl
This commit is contained in:
parent
71968a3b42
commit
18298f046a
14
src/sdl.cpp
14
src/sdl.cpp
@ -7,13 +7,13 @@ SdlWindow::SdlWindow(const char* title, int width, int height)
|
||||
m_isRunning(false),
|
||||
m_isFullscreen(false),
|
||||
m_width(width),
|
||||
m_height(height)
|
||||
m_height(height),
|
||||
m_glContect(nullptr)
|
||||
{
|
||||
// 1. Initialize SDL
|
||||
if (SDL_Init(SDL_INIT_VIDEO) < 0) {
|
||||
std::cerr << "Failed to init SDL2: " << SDL_GetError() << std::endl;
|
||||
return;
|
||||
}
|
||||
// 1. Set attributes
|
||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3);
|
||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 3);
|
||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE);
|
||||
|
||||
// 2. Create the window
|
||||
m_window = SDL_CreateWindow(
|
||||
@ -22,7 +22,7 @@ SdlWindow::SdlWindow(const char* title, int width, int height)
|
||||
SDL_WINDOWPOS_CENTERED,
|
||||
width,
|
||||
height,
|
||||
SDL_WINDOW_SHOWN
|
||||
SDL_WINDOW_SHOWN | SDL_WINDOW_RESIZABLE
|
||||
);
|
||||
if (!m_window) {
|
||||
std::cerr << "Failed to create window: " << SDL_GetError() << std::endl;
|
||||
|
Loading…
x
Reference in New Issue
Block a user