mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-25 23:07:18 +00:00
[opengl] render alerts and fps on wait screen
This commit is contained in:
parent
b5ec4dd305
commit
34de213926
@ -190,6 +190,12 @@ void opengl_deinitialize(void * opaque)
|
|||||||
if (!this)
|
if (!this)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (this->preConfigured)
|
||||||
|
{
|
||||||
|
glDeleteLists(this->fpsList , 1);
|
||||||
|
glDeleteLists(this->alertList, 1);
|
||||||
|
}
|
||||||
|
|
||||||
deconfigure(this);
|
deconfigure(this);
|
||||||
if (this->mouseData)
|
if (this->mouseData)
|
||||||
free(this->mouseData);
|
free(this->mouseData);
|
||||||
@ -426,21 +432,22 @@ bool opengl_render(void * opaque, SDL_Window * window)
|
|||||||
this->resizeWindow = false;
|
this->resizeWindow = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool wait = false;
|
||||||
if (!configure(this, window))
|
if (!configure(this, window))
|
||||||
{
|
{
|
||||||
render_wait(this);
|
render_wait(this);
|
||||||
SDL_GL_SwapWindow(window);
|
wait = true;
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
if (!draw_frame(this))
|
if (!draw_frame(this))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!this->texReady)
|
if (!this->texReady)
|
||||||
{
|
{
|
||||||
render_wait(this);
|
render_wait(this);
|
||||||
SDL_GL_SwapWindow(window);
|
wait = true;
|
||||||
return true;
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this->params.showFPS && this->renderTime > 1e9)
|
if (this->params.showFPS && this->renderTime > 1e9)
|
||||||
@ -501,6 +508,8 @@ bool opengl_render(void * opaque, SDL_Window * window)
|
|||||||
glEndList();
|
glEndList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!wait)
|
||||||
|
{
|
||||||
bool newShape;
|
bool newShape;
|
||||||
update_mouse_shape(this, &newShape);
|
update_mouse_shape(this, &newShape);
|
||||||
|
|
||||||
@ -508,6 +517,8 @@ bool opengl_render(void * opaque, SDL_Window * window)
|
|||||||
glClear(GL_COLOR_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT);
|
||||||
glCallList(this->texList + this->texIndex);
|
glCallList(this->texList + this->texIndex);
|
||||||
draw_mouse(this);
|
draw_mouse(this);
|
||||||
|
}
|
||||||
|
|
||||||
if (this->fpsTexture)
|
if (this->fpsTexture)
|
||||||
glCallList(this->fpsList);
|
glCallList(this->fpsList);
|
||||||
|
|
||||||
@ -786,8 +797,24 @@ static bool pre_configure(struct Inst * this, SDL_Window *window)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
glEnable(GL_TEXTURE_2D);
|
||||||
|
glEnable(GL_COLOR_MATERIAL);
|
||||||
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
|
glBlendEquation(GL_FUNC_ADD);
|
||||||
glEnable(GL_MULTISAMPLE);
|
glEnable(GL_MULTISAMPLE);
|
||||||
|
|
||||||
|
this->fpsList = glGenLists(1);
|
||||||
|
this->alertList = glGenLists(1);
|
||||||
|
|
||||||
|
// create the overlay textures
|
||||||
|
glGenTextures(TEXTURE_COUNT, this->textures);
|
||||||
|
if (check_gl_error("glGenTextures"))
|
||||||
|
{
|
||||||
|
LG_UNLOCK(this->formatLock);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
this->hasTextures = true;
|
||||||
|
|
||||||
SDL_GL_SetSwapInterval(this->opt.vsync ? 1 : 0);
|
SDL_GL_SetSwapInterval(this->opt.vsync ? 1 : 0);
|
||||||
this->preConfigured = true;
|
this->preConfigured = true;
|
||||||
return true;
|
return true;
|
||||||
@ -859,9 +886,7 @@ static bool configure(struct Inst * this, SDL_Window *window)
|
|||||||
|
|
||||||
// generate lists for drawing
|
// generate lists for drawing
|
||||||
this->texList = glGenLists(BUFFER_COUNT);
|
this->texList = glGenLists(BUFFER_COUNT);
|
||||||
this->fpsList = glGenLists(1);
|
|
||||||
this->mouseList = glGenLists(1);
|
this->mouseList = glGenLists(1);
|
||||||
this->alertList = glGenLists(1);
|
|
||||||
|
|
||||||
// generate the pixel unpack buffers if the decoder isn't going to do it for us
|
// generate the pixel unpack buffers if the decoder isn't going to do it for us
|
||||||
if (!this->decoder->has_gl)
|
if (!this->decoder->has_gl)
|
||||||
@ -932,15 +957,6 @@ static bool configure(struct Inst * this, SDL_Window *window)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// create the overlay textures
|
|
||||||
glGenTextures(TEXTURE_COUNT, this->textures);
|
|
||||||
if (check_gl_error("glGenTextures"))
|
|
||||||
{
|
|
||||||
LG_UNLOCK(this->formatLock);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
this->hasTextures = true;
|
|
||||||
|
|
||||||
// create the frame textures
|
// create the frame textures
|
||||||
glGenTextures(BUFFER_COUNT, this->frames);
|
glGenTextures(BUFFER_COUNT, this->frames);
|
||||||
if (check_gl_error("glGenTextures"))
|
if (check_gl_error("glGenTextures"))
|
||||||
@ -1014,11 +1030,6 @@ static bool configure(struct Inst * this, SDL_Window *window)
|
|||||||
glBindTexture(GL_TEXTURE_2D, 0);
|
glBindTexture(GL_TEXTURE_2D, 0);
|
||||||
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0);
|
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0);
|
||||||
|
|
||||||
glEnable(GL_TEXTURE_2D);
|
|
||||||
glEnable(GL_COLOR_MATERIAL);
|
|
||||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
|
||||||
glBlendEquation(GL_FUNC_ADD);
|
|
||||||
|
|
||||||
this->resizeWindow = true;
|
this->resizeWindow = true;
|
||||||
this->drawStart = nanotime();
|
this->drawStart = nanotime();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user