Fixes OpenGL* Clip Rect functions (by Emmanuel Gil Peyrot)
This commit is contained in:
parent
5d9de376d2
commit
7065c6467d
5 changed files with 21 additions and 7 deletions
|
@ -794,7 +794,7 @@ GL_UpdateClipRect(SDL_Renderer * renderer)
|
||||||
|
|
||||||
if (!SDL_RectEmpty(rect)) {
|
if (!SDL_RectEmpty(rect)) {
|
||||||
data->glEnable(GL_SCISSOR_TEST);
|
data->glEnable(GL_SCISSOR_TEST);
|
||||||
data->glScissor(rect->x, rect->y, rect->x + rect->w, rect->y + rect->h);
|
data->glScissor(rect->x, rect->h - rect->y, rect->x, rect->y);
|
||||||
} else {
|
} else {
|
||||||
data->glDisable(GL_SCISSOR_TEST);
|
data->glDisable(GL_SCISSOR_TEST);
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,7 @@ SDL_PROC(void, glMatrixMode, (GLenum))
|
||||||
SDL_PROC(void, glOrthof, (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat))
|
SDL_PROC(void, glOrthof, (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat))
|
||||||
SDL_PROC(void, glPixelStorei, (GLenum, GLint))
|
SDL_PROC(void, glPixelStorei, (GLenum, GLint))
|
||||||
SDL_PROC(void, glReadPixels, (GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, GLvoid*))
|
SDL_PROC(void, glReadPixels, (GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, GLvoid*))
|
||||||
|
SDL_PROC(void, glScissor, (GLint, GLint, GLsizei, GLsizei))
|
||||||
SDL_PROC(void, glTexCoordPointer, (GLint, GLenum, GLsizei, const GLvoid *))
|
SDL_PROC(void, glTexCoordPointer, (GLint, GLenum, GLsizei, const GLvoid *))
|
||||||
SDL_PROC(void, glTexEnvf, (GLenum, GLenum, GLfloat))
|
SDL_PROC(void, glTexEnvf, (GLenum, GLenum, GLfloat))
|
||||||
SDL_PROC(void, glTexImage2D, (GLenum, GLint, GLint, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *))
|
SDL_PROC(void, glTexImage2D, (GLenum, GLint, GLint, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *))
|
||||||
|
|
|
@ -635,13 +635,19 @@ GLES_UpdateViewport(SDL_Renderer * renderer)
|
||||||
static int
|
static int
|
||||||
GLES_UpdateClipRect(SDL_Renderer * renderer)
|
GLES_UpdateClipRect(SDL_Renderer * renderer)
|
||||||
{
|
{
|
||||||
|
GLES_RenderData *data = (GLES_RenderData *) renderer->driverdata;
|
||||||
const SDL_Rect *rect = &renderer->clip_rect;
|
const SDL_Rect *rect = &renderer->clip_rect;
|
||||||
|
|
||||||
|
if (SDL_CurrentContext != data->context) {
|
||||||
|
/* We'll update the clip rect after we rebind the context */
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (!SDL_RectEmpty(rect)) {
|
if (!SDL_RectEmpty(rect)) {
|
||||||
glEnable(GL_SCISSOR_TEST);
|
data->glEnable(GL_SCISSOR_TEST);
|
||||||
glScissor(rect->x, rect->y, rect->x + rect->w, rect->y + rect->h);
|
data->glScissor(rect->x, rect->h - rect->y, rect->w, rect->h);
|
||||||
} else {
|
} else {
|
||||||
glDisable(GL_SCISSOR_TEST);
|
data->glDisable(GL_SCISSOR_TEST);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,6 +30,7 @@ SDL_PROC(GLint, glGetUniformLocation, (GLuint, const char *))
|
||||||
SDL_PROC(void, glLinkProgram, (GLuint))
|
SDL_PROC(void, glLinkProgram, (GLuint))
|
||||||
SDL_PROC(void, glPixelStorei, (GLenum, GLint))
|
SDL_PROC(void, glPixelStorei, (GLenum, GLint))
|
||||||
SDL_PROC(void, glReadPixels, (GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, GLvoid*))
|
SDL_PROC(void, glReadPixels, (GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, GLvoid*))
|
||||||
|
SDL_PROC(void, glScissor, (GLint, GLint, GLsizei, GLsizei))
|
||||||
SDL_PROC(void, glShaderBinary, (GLsizei, const GLuint *, GLenum, const void *, GLsizei))
|
SDL_PROC(void, glShaderBinary, (GLsizei, const GLuint *, GLenum, const void *, GLsizei))
|
||||||
SDL_PROC(void, glShaderSource, (GLuint, GLsizei, const char **, const GLint *))
|
SDL_PROC(void, glShaderSource, (GLuint, GLsizei, const char **, const GLint *))
|
||||||
SDL_PROC(void, glTexImage2D, (GLenum, GLint, GLint, GLsizei, GLsizei, GLint, GLenum, GLenum, const void *))
|
SDL_PROC(void, glTexImage2D, (GLenum, GLint, GLint, GLsizei, GLsizei, GLint, GLenum, GLenum, const void *))
|
||||||
|
|
|
@ -278,13 +278,19 @@ GLES2_UpdateViewport(SDL_Renderer * renderer)
|
||||||
static int
|
static int
|
||||||
GLES2_UpdateClipRect(SDL_Renderer * renderer)
|
GLES2_UpdateClipRect(SDL_Renderer * renderer)
|
||||||
{
|
{
|
||||||
|
GLES2_DriverContext *rdata = (GLES2_DriverContext *)renderer->driverdata;
|
||||||
const SDL_Rect *rect = &renderer->clip_rect;
|
const SDL_Rect *rect = &renderer->clip_rect;
|
||||||
|
|
||||||
|
if (SDL_CurrentContext != rdata->context) {
|
||||||
|
/* We'll update the clip rect after we rebind the context */
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (!SDL_RectEmpty(rect)) {
|
if (!SDL_RectEmpty(rect)) {
|
||||||
glEnable(GL_SCISSOR_TEST);
|
rdata->glEnable(GL_SCISSOR_TEST);
|
||||||
glScissor(rect->x, rect->y, rect->x + rect->w, rect->y + rect->h);
|
rdata->glScissor(rect->x, rect->h - rect->y, rect->w, rect->h);
|
||||||
} else {
|
} else {
|
||||||
glDisable(GL_SCISSOR_TEST);
|
rdata->glDisable(GL_SCISSOR_TEST);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue