linter: opengl_shader.cpp

This commit is contained in:
2025-10-24 17:21:17 +02:00
parent 636e4d932a
commit 3cfb65320c
2 changed files with 16 additions and 16 deletions

View File

@@ -15,7 +15,7 @@ OpenGLShader::~OpenGLShader() {
}
#ifndef __APPLE__
bool OpenGLShader::initGLExtensions() {
auto OpenGLShader::initGLExtensions() -> bool {
glCreateShader = (PFNGLCREATESHADERPROC)SDL_GL_GetProcAddress("glCreateShader");
glShaderSource = (PFNGLSHADERSOURCEPROC)SDL_GL_GetProcAddress("glShaderSource");
glCompileShader = (PFNGLCOMPILESHADERPROC)SDL_GL_GetProcAddress("glCompileShader");
@@ -62,7 +62,7 @@ void OpenGLShader::checkGLError(const char* operation) {
}
}
GLuint OpenGLShader::compileShader(const std::string& source, GLenum shader_type) {
auto OpenGLShader::compileShader(const std::string& source, GLenum shader_type) -> GLuint {
if (source.empty()) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
"ERROR: El código fuente del shader está vacío");
@@ -105,7 +105,7 @@ GLuint OpenGLShader::compileShader(const std::string& source, GLenum shader_type
return shader_id;
}
GLuint OpenGLShader::linkProgram(GLuint vertex_shader, GLuint fragment_shader) {
auto OpenGLShader::linkProgram(GLuint vertex_shader, GLuint fragment_shader) -> GLuint {
GLuint program = glCreateProgram();
if (program == 0) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
@@ -211,7 +211,7 @@ void OpenGLShader::createQuadGeometry() {
glBindVertexArray(0);
}
GLuint OpenGLShader::getTextureID(SDL_Texture* texture) {
auto OpenGLShader::getTextureID(SDL_Texture* texture) -> GLuint {
if (!texture) return 1;
SDL_PropertiesID props = SDL_GetTextureProperties(texture);
@@ -237,10 +237,10 @@ GLuint OpenGLShader::getTextureID(SDL_Texture* texture) {
return texture_id;
}
bool OpenGLShader::init(SDL_Window* window,
auto OpenGLShader::init(SDL_Window* window,
SDL_Texture* texture,
const std::string& vertex_source,
const std::string& fragment_source) {
const std::string& fragment_source) -> bool {
window_ = window;
back_buffer_ = texture;
renderer_ = SDL_GetRenderer(window);

View File

@@ -23,23 +23,23 @@ class OpenGLShader : public ShaderBackend {
OpenGLShader() = default;
~OpenGLShader() override;
bool init(SDL_Window* window,
auto init(SDL_Window* window,
SDL_Texture* texture,
const std::string& vertex_source,
const std::string& fragment_source) override;
const std::string& fragment_source) -> bool override;
void render() override;
void setTextureSize(float width, float height) override;
void cleanup() override;
bool isHardwareAccelerated() const override { return is_initialized_; }
void cleanup() override final;
[[nodiscard]] auto isHardwareAccelerated() const -> bool override { return is_initialized_; }
private:
// Funciones auxiliares
bool initGLExtensions();
GLuint compileShader(const std::string& source, GLenum shader_type);
GLuint linkProgram(GLuint vertex_shader, GLuint fragment_shader);
auto initGLExtensions() -> bool;
auto compileShader(const std::string& source, GLenum shader_type) -> GLuint;
auto linkProgram(GLuint vertex_shader, GLuint fragment_shader) -> GLuint;
void createQuadGeometry();
GLuint getTextureID(SDL_Texture* texture);
auto getTextureID(SDL_Texture* texture) -> GLuint;
void checkGLError(const char* operation);
// Estado SDL
@@ -59,8 +59,8 @@ class OpenGLShader : public ShaderBackend {
// Tamaños
int window_width_ = 0;
int window_height_ = 0;
float texture_width_ = 0.0f;
float texture_height_ = 0.0f;
float texture_width_ = 0.0F;
float texture_height_ = 0.0F;
// Estado
bool is_initialized_ = false;