From 54ceaa3042e0fe4527d49980a732e687fec61498 Mon Sep 17 00:00:00 2001 From: Sergio Valor Date: Thu, 2 Oct 2025 21:40:12 +0200 Subject: [PATCH] =?UTF-8?q?debug:=20A=C3=B1adir=20logs=20en=20inicializaci?= =?UTF-8?q?=C3=B3n=20de=20shaders?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Para debuggear problema de pantalla negra en RPi al iniciar con shaders activos. Logs muestran tamaños de ventana/textura y configuración de uniforms. --- source/rendering/opengl/opengl_shader.cpp | 7 +++++++ source/screen.cpp | 8 ++------ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/source/rendering/opengl/opengl_shader.cpp b/source/rendering/opengl/opengl_shader.cpp index 184e64e..3c296c2 100644 --- a/source/rendering/opengl/opengl_shader.cpp +++ b/source/rendering/opengl/opengl_shader.cpp @@ -232,6 +232,10 @@ bool OpenGLShader::init(SDL_Window* window, SDL_GetWindowSize(window_, &window_width_, &window_height_); SDL_GetTextureSize(back_buffer_, &texture_width_, &texture_height_); + SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, + "Inicializando shaders: ventana=%dx%d, textura=%.0fx%.0f", + window_width_, window_height_, texture_width_, texture_height_); + // Verificar que es OpenGL const char* renderer_name = SDL_GetRendererName(renderer_); if (!renderer_name || strncmp(renderer_name, "opengl", 6) != 0) { @@ -287,6 +291,9 @@ bool OpenGLShader::init(SDL_Window* window, glUseProgram(program_id_); texture_size_location_ = glGetUniformLocation(program_id_, "TextureSize"); if (texture_size_location_ != -1) { + SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, + "Configurando TextureSize uniform: %.0fx%.0f", + texture_width_, texture_height_); glUniform2f(texture_size_location_, texture_width_, texture_height_); checkGLError("glUniform2f(TextureSize)"); } else { diff --git a/source/screen.cpp b/source/screen.cpp index 1a5b89a..299274a 100644 --- a/source/screen.cpp +++ b/source/screen.cpp @@ -55,12 +55,8 @@ Screen::Screen() setDebugInfoEnabled(true); #endif - // Inicializa los shaders (solo en plataformas no-macOS por ahora) -#ifndef __APPLE__ - loadShaders(); - shader_backend_ = std::make_unique(); - shader_backend_->init(window_, game_canvas_, vertex_shader_source_, fragment_shader_source_); -#endif + // Inicializa los shaders si están activos en opciones + initShaders(); } // Destructor