diff --git a/client/renderers/egl.c b/client/renderers/egl.c index 29c4cbe0..647e8a95 100644 --- a/client/renderers/egl.c +++ b/client/renderers/egl.c @@ -356,22 +356,6 @@ bool egl_render_startup(void * opaque, SDL_Window * window) DEBUG_INFO("Renderer: %s", glGetString(GL_RENDERER)); DEBUG_INFO("Version : %s", glGetString(GL_VERSION )); - static const GLfloat square[] = - { - -1.0f, -1.0f, 0.0f, - 1.0f, -1.0f, 0.0f, - -1.0f, 1.0f, 0.0f, - 1.0f, 1.0f, 0.0f - }; - - static const GLfloat uvs[] = - { - 0.0f, 1.0f, - 1.0f, 1.0f, - 0.0f, 0.0f, - 1.0f, 0.0f - }; - if (!egl_shader_init(&this->shaders.rgba)) return false; @@ -396,9 +380,8 @@ bool egl_render_startup(void * opaque, SDL_Window * window) if (!egl_model_init(&this->models.desktop)) return false; - egl_model_set_verticies(this->models.desktop, square , sizeof(square) / sizeof(GLfloat)); - egl_model_set_uvs (this->models.desktop, uvs , sizeof(uvs ) / sizeof(GLfloat)); - egl_model_set_texture (this->models.desktop, this->textures.desktop); + egl_model_set_default(this->models.desktop); + egl_model_set_texture(this->models.desktop, this->textures.desktop); eglSwapInterval(this->display, this->opt.vsync ? 1 : 0); diff --git a/client/renderers/egl/cursor.c b/client/renderers/egl/cursor.c index bddfdee4..f4db4b5f 100644 --- a/client/renderers/egl/cursor.c +++ b/client/renderers/egl/cursor.c @@ -181,24 +181,7 @@ bool egl_cursor_init(EGL_Cursor ** cursor) return false; } - static const GLfloat square[] = - { - -1.0f, -1.0f, 0.0f, - 1.0f, -1.0f, 0.0f, - -1.0f, 1.0f, 0.0f, - 1.0f, 1.0f, 0.0f - }; - - static const GLfloat uvs[] = - { - 0.0f, 1.0f, - 1.0f, 1.0f, - 0.0f, 0.0f, - 1.0f, 0.0f - }; - - egl_model_set_verticies((*cursor)->model, square, sizeof(square) / sizeof(GLfloat)); - egl_model_set_uvs ((*cursor)->model, uvs , sizeof(uvs ) / sizeof(GLfloat)); + egl_model_set_default((*cursor)->model); return true; } diff --git a/client/renderers/egl/fps.c b/client/renderers/egl/fps.c index 5b5c4589..018912b2 100644 --- a/client/renderers/egl/fps.c +++ b/client/renderers/egl/fps.c @@ -138,25 +138,8 @@ bool egl_fps_init(EGL_FPS ** fps, const LG_Font * font, LG_FontObj fontObj) return false; } - static const GLfloat square[] = - { - -1.0f, -1.0f, 0.0f, - 1.0f, -1.0f, 0.0f, - -1.0f, 1.0f, 0.0f, - 1.0f, 1.0f, 0.0f - }; - - static const GLfloat uvs[] = - { - 0.0f, 1.0f, - 1.0f, 1.0f, - 0.0f, 0.0f, - 1.0f, 0.0f - }; - - egl_model_set_verticies((*fps)->model, square, sizeof(square) / sizeof(GLfloat)); - egl_model_set_uvs ((*fps)->model, uvs , sizeof(uvs ) / sizeof(GLfloat)); - egl_model_set_texture ((*fps)->model, (*fps)->texture); + egl_model_set_default((*fps)->model); + egl_model_set_texture((*fps)->model, (*fps)->texture); return true; } diff --git a/client/renderers/egl/model.c b/client/renderers/egl/model.c index e55ee7f8..336bcebf 100644 --- a/client/renderers/egl/model.c +++ b/client/renderers/egl/model.c @@ -73,6 +73,28 @@ void egl_model_free(EGL_Model ** model) *model = NULL; } +void egl_model_set_default(EGL_Model * model) +{ + static const GLfloat square[] = + { + -1.0f, -1.0f, 0.0f, + 1.0f, -1.0f, 0.0f, + -1.0f, 1.0f, 0.0f, + 1.0f, 1.0f, 0.0f + }; + + static const GLfloat uvs[] = + { + 0.0f, 1.0f, + 1.0f, 1.0f, + 0.0f, 0.0f, + 1.0f, 0.0f + }; + + egl_model_set_verticies(model, square, sizeof(square) / sizeof(GLfloat)); + egl_model_set_uvs (model, uvs , sizeof(uvs ) / sizeof(GLfloat)); +} + void egl_model_set_verticies(EGL_Model * model, const GLfloat * verticies, const size_t count) { if (model->hasVertexBuffer) diff --git a/client/renderers/egl/model.h b/client/renderers/egl/model.h index a03b9baa..e3f7f0d9 100644 --- a/client/renderers/egl/model.h +++ b/client/renderers/egl/model.h @@ -30,6 +30,7 @@ typedef struct EGL_Model EGL_Model; bool egl_model_init(EGL_Model ** model); void egl_model_free(EGL_Model ** model); +void egl_model_set_default (EGL_Model * model); void egl_model_set_verticies (EGL_Model * model, const GLfloat * verticies, const size_t count); void egl_model_set_uvs (EGL_Model * model, const GLfloat * uvs , const size_t count); void egl_model_set_shader (EGL_Model * model, EGL_Shader * shader);