am b26d94c5: Merge "opengles Translator: DrawTex impl - don\'t draw if no textures enabled."
* commit 'b26d94c5a0c8398331d9d5bda43b22b724638201': opengles Translator: DrawTex impl - don't draw if no textures enabled.
This commit is contained in:
@@ -1946,6 +1946,7 @@ void glDrawTexOES (T x, T y, T z, T width, T height) {
|
|||||||
x+width, y+height, z,
|
x+width, y+height, z,
|
||||||
x+width, y, z};
|
x+width, y, z};
|
||||||
GLfloat texels[ctx->getMaxTexUnits()][4*2];
|
GLfloat texels[ctx->getMaxTexUnits()][4*2];
|
||||||
|
memset((void*)texels, 0, ctx->getMaxTexUnits()*4*2*sizeof(GLfloat));
|
||||||
|
|
||||||
ctx->dispatcher().glPushClientAttrib(GL_CLIENT_VERTEX_ARRAY_BIT);
|
ctx->dispatcher().glPushClientAttrib(GL_CLIENT_VERTEX_ARRAY_BIT);
|
||||||
ctx->dispatcher().glPushAttrib(GL_TRANSFORM_BIT);
|
ctx->dispatcher().glPushAttrib(GL_TRANSFORM_BIT);
|
||||||
@@ -1976,6 +1977,7 @@ void glDrawTexOES (T x, T y, T z, T width, T height) {
|
|||||||
for (int i=0;i<numClipPlanes;++i)
|
for (int i=0;i<numClipPlanes;++i)
|
||||||
ctx->dispatcher().glDisable(GL_CLIP_PLANE0+i);
|
ctx->dispatcher().glDisable(GL_CLIP_PLANE0+i);
|
||||||
|
|
||||||
|
int nTexPtrs = 0;
|
||||||
for (int i=0;i<ctx->getMaxTexUnits();++i) {
|
for (int i=0;i<ctx->getMaxTexUnits();++i) {
|
||||||
if (ctx->isTextureUnitEnabled(GL_TEXTURE0+i)) {
|
if (ctx->isTextureUnitEnabled(GL_TEXTURE0+i)) {
|
||||||
TextureData * texData = NULL;
|
TextureData * texData = NULL;
|
||||||
@@ -1998,15 +2000,18 @@ void glDrawTexOES (T x, T y, T z, T width, T height) {
|
|||||||
texels[i][7] = (float)(texData->crop_rect[1])/(float)(texData->height);
|
texels[i][7] = (float)(texData->crop_rect[1])/(float)(texData->height);
|
||||||
|
|
||||||
ctx->dispatcher().glTexCoordPointer(2,GL_FLOAT,0,texels[i]);
|
ctx->dispatcher().glTexCoordPointer(2,GL_FLOAT,0,texels[i]);
|
||||||
|
nTexPtrs++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//draw rectangle
|
if (nTexPtrs>0) {
|
||||||
ctx->dispatcher().glEnableClientState(GL_VERTEX_ARRAY);
|
//draw rectangle - only if we have some textures enabled & ready
|
||||||
ctx->dispatcher().glVertexPointer(3,TypeName,0,vertices);
|
ctx->dispatcher().glEnableClientState(GL_VERTEX_ARRAY);
|
||||||
ctx->dispatcher().glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
ctx->dispatcher().glVertexPointer(3,TypeName,0,vertices);
|
||||||
ctx->dispatcher().glDrawArrays(GL_TRIANGLE_FAN,0,4);
|
ctx->dispatcher().glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||||
|
ctx->dispatcher().glDrawArrays(GL_TRIANGLE_FAN,0,4);
|
||||||
|
}
|
||||||
|
|
||||||
//restore vbo's
|
//restore vbo's
|
||||||
ctx->dispatcher().glBindBuffer(GL_ARRAY_BUFFER,array_buffer);
|
ctx->dispatcher().glBindBuffer(GL_ARRAY_BUFFER,array_buffer);
|
||||||
|
|||||||
Reference in New Issue
Block a user