mirror of
https://github.com/Relintai/sdl2_frt.git
synced 2025-04-07 23:41:48 +02:00
opengles2: Fixed several incorrect things.
This commit is contained in:
parent
6ecd0b2c35
commit
eedf2c965d
@ -878,8 +878,7 @@ GLES2_QueueCopyEx(SDL_Renderer * renderer, SDL_RenderCommand *cmd, SDL_Texture *
|
|||||||
if (flip & SDL_FLIP_HORIZONTAL) {
|
if (flip & SDL_FLIP_HORIZONTAL) {
|
||||||
minx = dstrect->x + dstrect->w;
|
minx = dstrect->x + dstrect->w;
|
||||||
maxx = dstrect->x;
|
maxx = dstrect->x;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
minx = dstrect->x;
|
minx = dstrect->x;
|
||||||
maxx = dstrect->x + dstrect->w;
|
maxx = dstrect->x + dstrect->w;
|
||||||
}
|
}
|
||||||
@ -887,16 +886,16 @@ GLES2_QueueCopyEx(SDL_Renderer * renderer, SDL_RenderCommand *cmd, SDL_Texture *
|
|||||||
if (flip & SDL_FLIP_VERTICAL) {
|
if (flip & SDL_FLIP_VERTICAL) {
|
||||||
miny = dstrect->y + dstrect->h;
|
miny = dstrect->y + dstrect->h;
|
||||||
maxy = dstrect->y;
|
maxy = dstrect->y;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
miny = dstrect->y;
|
miny = dstrect->y;
|
||||||
maxy = dstrect->y + dstrect->h;
|
maxy = dstrect->y + dstrect->h;
|
||||||
}
|
}
|
||||||
|
|
||||||
minu = (GLfloat) (srcquad->x / texture->w);
|
minu = ((GLfloat) srcquad->x) / ((GLfloat) texture->w);
|
||||||
maxu = (GLfloat) ((srcquad->x + srcquad->w) / texture->w);
|
maxu = ((GLfloat) (srcquad->x + srcquad->w)) / ((GLfloat) texture->w);
|
||||||
minv = (GLfloat) (srcquad->y / texture->h);
|
minv = ((GLfloat) srcquad->y) / ((GLfloat) texture->h);
|
||||||
maxv = (GLfloat) ((srcquad->y + srcquad->h) / texture->h);
|
maxv = ((GLfloat) (srcquad->y + srcquad->h)) / ((GLfloat) texture->h);
|
||||||
|
|
||||||
|
|
||||||
cmd->data.draw.count = 1;
|
cmd->data.draw.count = 1;
|
||||||
|
|
||||||
@ -988,7 +987,6 @@ SetDrawState(GLES2_RenderData *data, const SDL_RenderCommand *cmd, const GLES2_I
|
|||||||
data->drawstate.texturing = SDL_FALSE;
|
data->drawstate.texturing = SDL_FALSE;
|
||||||
} else {
|
} else {
|
||||||
data->glEnableVertexAttribArray((GLenum) GLES2_ATTRIBUTE_TEXCOORD);
|
data->glEnableVertexAttribArray((GLenum) GLES2_ATTRIBUTE_TEXCOORD);
|
||||||
data->glVertexAttribPointer(GLES2_ATTRIBUTE_TEXCOORD, 2, GL_FLOAT, GL_FALSE, 0, (const GLvoid *) (cmd->data.draw.first + (sizeof (GLfloat) * 8)));
|
|
||||||
data->drawstate.texturing = SDL_TRUE;
|
data->drawstate.texturing = SDL_TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1015,6 +1013,10 @@ SetDrawState(GLES2_RenderData *data, const SDL_RenderCommand *cmd, const GLES2_I
|
|||||||
data->drawstate.texture = texture;
|
data->drawstate.texture = texture;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (texture) {
|
||||||
|
data->glVertexAttribPointer(GLES2_ATTRIBUTE_TEXCOORD, 2, GL_FLOAT, GL_FALSE, 0, (const GLvoid *) (cmd->data.draw.first + (sizeof (GLfloat) * 8)));
|
||||||
|
}
|
||||||
|
|
||||||
if (GLES2_SelectProgram(data, imgsrc, texture ? texture->w : 0, texture ? texture->h : 0) < 0) {
|
if (GLES2_SelectProgram(data, imgsrc, texture ? texture->w : 0, texture ? texture->h : 0) < 0) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -1061,8 +1063,6 @@ SetDrawState(GLES2_RenderData *data, const SDL_RenderCommand *cmd, const GLES2_I
|
|||||||
if (is_copy_ex) {
|
if (is_copy_ex) {
|
||||||
data->glEnableVertexAttribArray((GLenum) GLES2_ATTRIBUTE_ANGLE);
|
data->glEnableVertexAttribArray((GLenum) GLES2_ATTRIBUTE_ANGLE);
|
||||||
data->glEnableVertexAttribArray((GLenum) GLES2_ATTRIBUTE_CENTER);
|
data->glEnableVertexAttribArray((GLenum) GLES2_ATTRIBUTE_CENTER);
|
||||||
data->glVertexAttribPointer(GLES2_ATTRIBUTE_ANGLE, 2, GL_FLOAT, GL_FALSE, 0, (const GLvoid *) (cmd->data.draw.first + (sizeof (GLfloat) * 16)));
|
|
||||||
data->glVertexAttribPointer(GLES2_ATTRIBUTE_CENTER, 2, GL_FLOAT, GL_FALSE, 0, (const GLvoid *) (cmd->data.draw.first + (sizeof (GLfloat) * 24)));
|
|
||||||
} else {
|
} else {
|
||||||
data->glDisableVertexAttribArray((GLenum) GLES2_ATTRIBUTE_ANGLE);
|
data->glDisableVertexAttribArray((GLenum) GLES2_ATTRIBUTE_ANGLE);
|
||||||
data->glDisableVertexAttribArray((GLenum) GLES2_ATTRIBUTE_CENTER);
|
data->glDisableVertexAttribArray((GLenum) GLES2_ATTRIBUTE_CENTER);
|
||||||
@ -1070,6 +1070,11 @@ SetDrawState(GLES2_RenderData *data, const SDL_RenderCommand *cmd, const GLES2_I
|
|||||||
data->drawstate.is_copy_ex = is_copy_ex;
|
data->drawstate.is_copy_ex = is_copy_ex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (is_copy_ex) {
|
||||||
|
data->glVertexAttribPointer(GLES2_ATTRIBUTE_ANGLE, 2, GL_FLOAT, GL_FALSE, 0, (const GLvoid *) (cmd->data.draw.first + (sizeof (GLfloat) * 16)));
|
||||||
|
data->glVertexAttribPointer(GLES2_ATTRIBUTE_CENTER, 2, GL_FLOAT, GL_FALSE, 0, (const GLvoid *) (cmd->data.draw.first + (sizeof (GLfloat) * 24)));
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user