fix: Dejar que SDL elija OpenGL automáticamente en Linux

- Windows: opengl + 3.3 Core Profile explícito
- Linux: opengl sin atributos, SDL elige:
  * Desktop 3.3 en PC con GPU normal
  * ES 3.0 en RPi automáticamente

Resuelve problema de colores invertidos (azul->naranja) causado
por forzar opengles2.
This commit is contained in:
2025-10-02 22:05:18 +02:00
parent 8d94ed516c
commit 6dc6d8fc24

View File

@@ -349,24 +349,20 @@ auto Screen::initSDLVideo() -> bool {
} }
#else #else
// Configurar hint de render driver // Configurar hint de render driver
#ifdef _WIN32
// Windows: Usar OpenGL Desktop
if (!SDL_SetHint(SDL_HINT_RENDER_DRIVER, "opengl")) { if (!SDL_SetHint(SDL_HINT_RENDER_DRIVER, "opengl")) {
SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION, SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION,
"Warning: Failed to set OpenGL hint!"); "Warning: Failed to set OpenGL hint!");
} }
// Pedir explícitamente OpenGL 3.3 Core Profile
#ifdef _WIN32
// Windows: Pedir explícitamente OpenGL 3.3 Core Profile
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3); SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 3); SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 3);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE); SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE);
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "Solicitando OpenGL 3.3 Core Profile"); SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "Solicitando OpenGL 3.3 Core Profile");
#else #else
// Linux/RPi: Intentar OpenGL ES primero // Linux: Dejar que SDL elija (Desktop 3.3 en PC, ES 3.0 en RPi automáticamente)
if (!SDL_SetHint(SDL_HINT_RENDER_DRIVER, "opengles2,opengl")) { SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "Usando OpenGL por defecto del sistema");
SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION,
"Warning: Failed to set OpenGL ES hint!");
}
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "Solicitando OpenGL ES (fallback a OpenGL Desktop)");
#endif #endif
#endif #endif