本文整理汇总了C++中GLES_RenderData::glDisableClientState方法的典型用法代码示例。如果您正苦于以下问题:C++ GLES_RenderData::glDisableClientState方法的具体用法?C++ GLES_RenderData::glDisableClientState怎么用?C++ GLES_RenderData::glDisableClientState使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GLES_RenderData
的用法示例。
在下文中一共展示了GLES_RenderData::glDisableClientState方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
static int
GLES_RenderDrawLines(SDL_Renderer * renderer, const SDL_Point * points,
int count)
{
GLES_RenderData *data = (GLES_RenderData *) renderer->driverdata;
int i;
GLshort *vertices;
GLES_SetBlendMode(data, renderer->blendMode, 1);
data->glColor4f((GLfloat) renderer->r * inv255f,
(GLfloat) renderer->g * inv255f,
(GLfloat) renderer->b * inv255f,
(GLfloat) renderer->a * inv255f);
vertices = SDL_stack_alloc(GLshort, count*2);
for (i = 0; i < count; ++i) {
vertices[2*i+0] = (GLshort)points[i].x;
vertices[2*i+1] = (GLshort)points[i].y;
}
data->glVertexPointer(2, GL_SHORT, 0, vertices);
data->glEnableClientState(GL_VERTEX_ARRAY);
if (count > 2 &&
points[0].x == points[count-1].x && points[0].y == points[count-1].y) {
/* GL_LINE_LOOP takes care of the final segment */
--count;
data->glDrawArrays(GL_LINE_LOOP, 0, count);
} else {
data->glDrawArrays(GL_LINE_STRIP, 0, count);
}
data->glDisableClientState(GL_VERTEX_ARRAY);
SDL_stack_free(vertices);
return 0;
}
示例2:
/* This is called if we need to invalidate all of the SDL OpenGL state */
static void
GLES_ResetState(SDL_Renderer *renderer)
{
GLES_RenderData *data = (GLES_RenderData *) renderer->driverdata;
if (SDL_CurrentContext == data->context) {
GLES_UpdateViewport(renderer);
} else {
GLES_ActivateRenderer(renderer);
}
data->current.color = 0xffffffff;
data->current.blendMode = SDL_BLENDMODE_INVALID;
data->current.tex_coords = SDL_FALSE;
data->glDisable(GL_DEPTH_TEST);
data->glDisable(GL_CULL_FACE);
data->glMatrixMode(GL_MODELVIEW);
data->glLoadIdentity();
data->glEnableClientState(GL_VERTEX_ARRAY);
data->glDisableClientState(GL_TEXTURE_COORD_ARRAY);
}
示例3: SetupTextureUpdate
//.........这里部分代码省略.........
texturedata->formattype, temp_buffer);
SDL_free(temp_buffer);
}
SDL_ClearDirtyRects(&texturedata->dirty);
}
data->glBindTexture(texturedata->type, texturedata->texture);
if (texture->modMode) {
data->glColor4f((GLfloat) texture->r * inv255f,
(GLfloat) texture->g * inv255f,
(GLfloat) texture->b * inv255f,
(GLfloat) texture->a * inv255f);
} else {
data->glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
}
GLES_SetBlendMode(data, texture->blendMode, 0);
switch (texture->scaleMode) {
case SDL_TEXTURESCALEMODE_NONE:
case SDL_TEXTURESCALEMODE_FAST:
data->glTexParameteri(texturedata->type, GL_TEXTURE_MIN_FILTER,
GL_NEAREST);
data->glTexParameteri(texturedata->type, GL_TEXTURE_MAG_FILTER,
GL_NEAREST);
break;
case SDL_TEXTURESCALEMODE_SLOW:
case SDL_TEXTURESCALEMODE_BEST:
data->glTexParameteri(texturedata->type, GL_TEXTURE_MIN_FILTER,
GL_LINEAR);
data->glTexParameteri(texturedata->type, GL_TEXTURE_MAG_FILTER,
GL_LINEAR);
break;
}
if (data->GL_OES_draw_texture_supported && data->useDrawTexture) {
/* this code is a little funny because the viewport is upside down vs SDL's coordinate system */
SDL_Window *window = renderer->window;
GLint cropRect[4];
cropRect[0] = srcrect->x;
cropRect[1] = srcrect->y + srcrect->h;
cropRect[2] = srcrect->w;
cropRect[3] = -srcrect->h;
data->glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_CROP_RECT_OES,
cropRect);
data->glDrawTexiOES(dstrect->x, window->h - dstrect->y - dstrect->h,
0, dstrect->w, dstrect->h);
} else {
minx = dstrect->x;
miny = dstrect->y;
maxx = dstrect->x + dstrect->w;
maxy = dstrect->y + dstrect->h;
minu = (GLfloat) srcrect->x / texture->w;
minu *= texturedata->texw;
maxu = (GLfloat) (srcrect->x + srcrect->w) / texture->w;
maxu *= texturedata->texw;
minv = (GLfloat) srcrect->y / texture->h;
minv *= texturedata->texh;
maxv = (GLfloat) (srcrect->y + srcrect->h) / texture->h;
maxv *= texturedata->texh;
GLshort vertices[8];
GLfloat texCoords[8];
vertices[0] = minx;
vertices[1] = miny;
vertices[2] = maxx;
vertices[3] = miny;
vertices[4] = minx;
vertices[5] = maxy;
vertices[6] = maxx;
vertices[7] = maxy;
texCoords[0] = minu;
texCoords[1] = minv;
texCoords[2] = maxu;
texCoords[3] = minv;
texCoords[4] = minu;
texCoords[5] = maxv;
texCoords[6] = maxu;
texCoords[7] = maxv;
data->glVertexPointer(2, GL_SHORT, 0, vertices);
data->glEnableClientState(GL_VERTEX_ARRAY);
data->glTexCoordPointer(2, GL_FLOAT, 0, texCoords);
data->glEnableClientState(GL_TEXTURE_COORD_ARRAY);
data->glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
data->glDisableClientState(GL_TEXTURE_COORD_ARRAY);
data->glDisableClientState(GL_VERTEX_ARRAY);
}
data->glDisable(GL_TEXTURE_2D);
return 0;
}