本文整理汇总了C++中qglBindTexture函数的典型用法代码示例。如果您正苦于以下问题:C++ qglBindTexture函数的具体用法?C++ qglBindTexture怎么用?C++ qglBindTexture使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了qglBindTexture函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: GL_Bind
/*
** GL_Bind
*/
void GL_Bind( image_t *image ) {
int texnum;
if ( !image ) {
ri.Printf( PRINT_WARNING, "GL_Bind: NULL image\n" );
texnum = tr.defaultImage->texnum;
} else {
texnum = image->texnum;
}
if ( r_nobind->integer && tr.dlightImage ) { // performance evaluation option
texnum = tr.dlightImage->texnum;
}
if ( glState.currenttextures[glState.currenttmu] != texnum ) {
if ( image ) {
image->frameUsed = tr.frameCount;
}
glState.currenttextures[glState.currenttmu] = texnum;
if (image && image->flags & IMGFLAG_CUBEMAP)
qglBindTexture( GL_TEXTURE_CUBE_MAP, texnum );
else
qglBindTexture( GL_TEXTURE_2D, texnum );
}
}
开发者ID:Thehsvdude,项目名称:ioq3,代码行数:28,代码来源:tr_backend.c
示例2: Gui_SetScreenTexture
bool Gui_SetScreenTexture(void *data, int w, int h, int bpp)
{
GLenum texture_format;
GLuint color_depth;
if(bpp == 32) // Contains an alpha channel
{
texture_format = GL_RGBA;
color_depth = GL_RGBA;
}
else if(bpp == 24) // No alpha channel
{
texture_format = GL_RGB;
color_depth = GL_RGB;
}
else
{
return false;
}
// Bind the texture object
qglBindTexture(GL_TEXTURE_2D, load_screen_tex);
// Set the texture's stretching properties
qglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
qglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
// Edit the texture object's image data using the information SDL_Surface gives us
qglTexImage2D(GL_TEXTURE_2D, 0, color_depth, w, h, 0,
texture_format, GL_UNSIGNED_BYTE, data);
qglBindTexture(GL_TEXTURE_2D, 0);
return true;
}
开发者ID:teacoffee2017,项目名称:OpenTomb,代码行数:34,代码来源:gui.cpp
示例3: GL_BindMultitexture
/*
** GL_BindMultitexture
*/
void
GL_BindMultitexture(Img *image0, GLuint env0, Img *image1, GLuint env1)
{
int texnum0, texnum1;
texnum0 = image0->texnum;
texnum1 = image1->texnum;
if(r_nobind->integer && tr.dlightImage){ /* performance evaluation option */
texnum0 = texnum1 = tr.dlightImage->texnum;
}
if(glState.currenttextures[1] != texnum1){
GL_SelectTexture(1);
image1->frameUsed = tr.frameCount;
glState.currenttextures[1] = texnum1;
qglBindTexture(GL_TEXTURE_2D, texnum1);
}
if(glState.currenttextures[0] != texnum0){
GL_SelectTexture(0);
image0->frameUsed = tr.frameCount;
glState.currenttextures[0] = texnum0;
qglBindTexture(GL_TEXTURE_2D, texnum0);
}
}
开发者ID:icanhas,项目名称:yantar,代码行数:28,代码来源:backend.c
示例4: RB_BloomDownSample
static void RB_BloomDownSample( void ) {
GLenum target;
int width, height;
GLint loc;
GL_SelectTexture(0);
qglDisable(GL_TEXTURE_2D);
qglEnable(GL_TEXTURE_RECTANGLE_ARB);
target = GL_TEXTURE_RECTANGLE_ARB;
width = glConfig.vidWidth;
height = glConfig.vidHeight;
qglBindTexture(target, tr.backBufferTexture);
qglCopyTexSubImage2D(target, 0, 0, 0, 0, 0, glConfig.vidWidth, glConfig.vidHeight);
GL_SelectTexture(1);
qglDisable(GL_TEXTURE_2D);
qglEnable(GL_TEXTURE_RECTANGLE_ARB);
qglBindTexture(target, tr.bloomTexture);
qglUseProgramObjectARB(tr.downSample1Sp);
loc = qglGetUniformLocationARB(tr.downSample1Sp, "backBufferTex");
if (loc < 0) {
Com_Error(ERR_DROP, "%s() couldn't get backBufferTex", __FUNCTION__);
}
qglUniform1iARB(loc, 0);
//qglDisable(GL_BLEND);
qglBegin(GL_QUADS);
qglMultiTexCoord2iARB(GL_TEXTURE0_ARB, 0, 0);
qglMultiTexCoord2iARB(GL_TEXTURE1_ARB, 0, 0);
qglVertex2i(0, tr.bloomHeight);
qglMultiTexCoord2iARB(GL_TEXTURE0_ARB, width, 0);
qglMultiTexCoord2iARB(GL_TEXTURE1_ARB, width, 0);
qglVertex2i(tr.bloomWidth, tr.bloomHeight);
qglMultiTexCoord2iARB(GL_TEXTURE0_ARB, width, height);
qglMultiTexCoord2iARB(GL_TEXTURE1_ARB, width, height);
qglVertex2i(tr.bloomWidth, 0);
qglMultiTexCoord2iARB(GL_TEXTURE0_ARB, 0, height);
qglMultiTexCoord2iARB(GL_TEXTURE1_ARB, 0, height);
qglVertex2i(0, 0);
qglEnd();
qglUseProgramObjectARB(0);
qglDisable(GL_TEXTURE_RECTANGLE_ARB);
qglDisable(GL_TEXTURE_2D);
GL_SelectTexture(0);
qglDisable(GL_TEXTURE_RECTANGLE_ARB);
qglEnable(GL_TEXTURE_2D);
}
开发者ID:themuffinator,项目名称:fnq3,代码行数:60,代码来源:tr_glsl.c
示例5: gld_BindFlat
void gld_BindFlat(GLTexture *gltexture, unsigned int flags)
{
const unsigned char *flat;
unsigned char *buffer;
int w, h;
if (!gltexture || gltexture->textype != GLDT_FLAT)
{
qglBindTexture(GL_TEXTURE_2D, 0);
last_glTexID = NULL;
return;
}
#ifdef HAVE_LIBSDL_IMAGE
if (gld_LoadHiresTex(gltexture, CR_DEFAULT))
{
gld_SetTexClamp(gltexture, flags);
last_glTexID = gltexture->texid_p;
return;
}
#endif
gld_GetTextureTexID(gltexture, CR_DEFAULT);
if (last_glTexID == gltexture->texid_p)
{
gld_SetTexClamp(gltexture, flags);
return;
}
last_glTexID = gltexture->texid_p;
if (*gltexture->texid_p != 0)
{
qglBindTexture(GL_TEXTURE_2D, *gltexture->texid_p);
gld_SetTexClamp(gltexture, flags);
return;
}
flat=W_CacheLumpNum(gltexture->index);
buffer=(unsigned char*)Z_Malloc(gltexture->buffer_size,PU_STATIC,0);
if (!(gltexture->flags & GLTEXTURE_MIPMAP) && gl_paletted_texture)
memset(buffer,transparent_pal_index,gltexture->buffer_size);
else
memset(buffer,0,gltexture->buffer_size);
gld_AddFlatToTexture(gltexture, buffer, flat, !(gltexture->flags & GLTEXTURE_MIPMAP) && gl_paletted_texture);
if (*gltexture->texid_p == 0)
qglGenTextures(1, gltexture->texid_p);
qglBindTexture(GL_TEXTURE_2D, *gltexture->texid_p);
buffer = gld_HQResize(gltexture, buffer, gltexture->buffer_width, gltexture->buffer_height, &w, &h);
gld_BuildTexture(gltexture, buffer, false, w, h);
gld_SetTexClamp(gltexture, flags);
W_UnlockLumpNum(gltexture->index);
}
开发者ID:Krazygamr,项目名称:D-Touch,代码行数:58,代码来源:gl_texture.c
示例6: gld_wipe_doMelt
int gld_wipe_doMelt(int ticks, int *y_lookup)
{
int i;
int total_w, total_h;
float fU1, fU2, fV1, fV2;
total_w = gld_GetTexDimension(SCREENWIDTH);
total_h = gld_GetTexDimension(SCREENHEIGHT);
fU1 = 0.0f;
fV1 = (float)SCREENHEIGHT / (float)total_h;
fU2 = (float)SCREENWIDTH / (float)total_w;
fV2 = 0.0f;
gld_EnableTexture2D(GL_TEXTURE0_ARB, true);
qglBindTexture(GL_TEXTURE_2D, wipe_scr_end_tex);
qglColor3f(1.0f, 1.0f, 1.0f);
qglBegin(GL_TRIANGLE_STRIP);
{
qglTexCoord2f(fU1, fV1); qglVertex2f(0.0f, 0.0f);
qglTexCoord2f(fU1, fV2); qglVertex2f(0.0f, (float)SCREENHEIGHT);
qglTexCoord2f(fU2, fV1); qglVertex2f((float)SCREENWIDTH, 0.0f);
qglTexCoord2f(fU2, fV2); qglVertex2f((float)SCREENWIDTH, (float)SCREENHEIGHT);
}
qglEnd();
qglBindTexture(GL_TEXTURE_2D, wipe_scr_start_tex);
qglColor3f(1.0f, 1.0f, 1.0f);
qglBegin(GL_QUAD_STRIP);
for (i=0; i <= SCREENWIDTH; i++)
{
int yoffs = MAX(0, y_lookup[i]);
float tx = (float) i / total_w;
float sx = (float) i;
float sy = (float) yoffs;
qglTexCoord2f(tx, fV1); qglVertex2f(sx, sy);
qglTexCoord2f(tx, fV2); qglVertex2f(sx, sy + (float)SCREENHEIGHT);
}
qglEnd();
return 0;
}
开发者ID:SHMAUS-Carter,项目名称:OpenGames,代码行数:49,代码来源:gl_wipe.c
示例7: CreateDSTTex_ARB
/*
===============
CreateDSTTex_ARB
Create the texture which warps texture shaders
===============
*/
void CreateDSTTex_ARB (void)
{
unsigned char dist[DST_SIZE][DST_SIZE][4];
int x,y;
srand(GetTickCount());
for (x=0; x<DST_SIZE; x++)
for (y=0; y<DST_SIZE; y++) {
dist[x][y][0] = rand()%255;
dist[x][y][1] = rand()%255;
dist[x][y][2] = rand()%48;
dist[x][y][3] = rand()%48;
}
qglGenTextures(1,&dst_texture_ARB);
qglBindTexture(GL_TEXTURE_2D, dst_texture_ARB);
qglTexImage2D (GL_TEXTURE_2D, 0, 4, DST_SIZE, DST_SIZE, 0, GL_RGBA, GL_UNSIGNED_BYTE, dist);
qglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
qglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
qglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
qglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
qglHint(GL_GENERATE_MIPMAP_HINT_SGIS, GL_NICEST);
qglTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP_SGIS, GL_TRUE);
}
开发者ID:Kiln707,项目名称:KMQuake2,代码行数:32,代码来源:r_warp.c
示例8: R_BindAnimatedImage
/*
=================
R_BindAnimatedImage
=================
*/
static void R_BindAnimatedImage( textureBundle_t *bundle ) {
int index;
if ( bundle->isVideoMap ) {
ri.CIN_RunCinematic(bundle->videoMapHandle);
ri.CIN_UploadCinematic(bundle->videoMapHandle);
return;
}
if ( bundle->isRenderTarget ) {
qglBindTexture (GL_TEXTURE_2D, bundle->renderTarget);
return;
}
if ( bundle->numImageAnimations <= 1 ) {
GL_Bind( bundle->image[0] );
return;
}
// it is necessary to do this messy calc to make sure animations line up
// exactly with waveforms of the same frequency
index = myftol( tess.shaderTime * bundle->imageAnimationSpeed * FUNCTABLE_SIZE );
index >>= FUNCTABLE_SIZE2;
if ( index < 0 ) {
index = 0; // may happen with shader time offsets
}
index %= bundle->numImageAnimations;
GL_Bind( bundle->image[ index ] );
}
开发者ID:redrumrobot,项目名称:quakeconstruct,代码行数:37,代码来源:tr_shade.c
示例9: Terrain_DrawFace
void Terrain_DrawFace( brush_t *brush, terrainFace_t *terraface ) {
terrainMesh_t *pm;
terravert_t a0;
terravert_t a1;
terravert_t a2;
pm = brush->pTerrain;
Terrain_GetTriangle( pm, terraface->index, &a0, &a1, &a2 );
qglBindTexture( GL_TEXTURE_2D, terraface->texture->texture_number );
qglBegin( GL_TRIANGLES );
// first tri
qglColor4fv( a0.rgba );
qglTexCoord2fv( a0.tc );
qglVertex3fv( a0.xyz );
qglColor4fv( a1.rgba );
qglTexCoord2fv( a1.tc );
qglVertex3fv( a1.xyz );
qglColor4fv( a2.rgba );
qglTexCoord2fv( a2.tc );
qglVertex3fv( a2.xyz );
qglEnd ();
}
开发者ID:AeonGames,项目名称:AeonQuakeEngine,代码行数:28,代码来源:terrain.cpp
示例10: CaptureScreenAsTexID
GLuint CaptureScreenAsTexID(void)
{
GLuint id;
gld_EnableTexture2D(GL_TEXTURE0_ARB, true);
qglGenTextures(1, &id);
qglBindTexture(GL_TEXTURE_2D, id);
qglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
qglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
qglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
qglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
#ifdef ANDROID
qglTexImage2D(GL_TEXTURE_2D, 0, GL_RGB,
#else
qglTexImage2D(GL_TEXTURE_2D, 0, 3,
#endif
gld_GetTexDimension(SCREENWIDTH), gld_GetTexDimension(SCREENHEIGHT),
0, GL_RGB, GL_UNSIGNED_BYTE, 0);
qglCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, SCREENWIDTH, SCREENHEIGHT);
return id;
}
开发者ID:SHMAUS-Carter,项目名称:OpenGames,代码行数:26,代码来源:gl_wipe.c
示例11: RB_BindImage
/*
* RB_BindImage
*/
void RB_BindImage( int tmu, const image_t *tex )
{
GLuint texnum;
assert( tex != NULL );
assert( tex->texnum != 0 );
if( tex->missing ) {
tex = rsh.noTexture;
} else if( !tex->loaded ) {
// not yet loaded from disk
tex = tex->flags & IT_CUBEMAP ? rsh.whiteCubemapTexture : rsh.whiteTexture;
} else if( rsh.noTexture && ( r_nobind->integer && tex->texnum != 0 ) ) {
// performance evaluation option
tex = rsh.noTexture;
}
if( rb.gl.flushTextures ) {
rb.gl.flushTextures = false;
memset( rb.gl.currentTextures, 0, sizeof( rb.gl.currentTextures ) );
}
texnum = tex->texnum;
if( rb.gl.currentTextures[tmu] == texnum )
return;
rb.gl.currentTextures[tmu] = texnum;
RB_SelectTextureUnit( tmu );
qglBindTexture( R_TextureTarget( tex->flags, NULL ), tex->texnum );
rb.stats.c_totalBinds++;
}
开发者ID:DenMSC,项目名称:qfusion,代码行数:37,代码来源:r_backend.c
示例12: gld_GetTextureBuffer
unsigned char* gld_GetTextureBuffer(GLuint texid, int miplevel, int *width, int *height)
{
int w, h;
static unsigned char *buf = NULL;
static int buf_size = 512 * 256 * 4;
if (!buf)
{
buf = malloc(buf_size);
}
if (texid)
{
qglBindTexture(GL_TEXTURE_2D, texid);
}
qglGetTexLevelParameteriv(GL_TEXTURE_2D, miplevel, GL_TEXTURE_WIDTH, &w);
qglGetTexLevelParameteriv(GL_TEXTURE_2D, miplevel, GL_TEXTURE_HEIGHT, &h);
if (w * h * 4 > buf_size)
{
free(buf);
buf_size = w * h * 4;
buf = malloc(buf_size);
}
qglGetTexImage(GL_TEXTURE_2D, miplevel, GL_RGBA, GL_UNSIGNED_BYTE, buf);
if (width)
*width = w;
if (height)
*height = h;
return buf;
}
开发者ID:Krazygamr,项目名称:D-Touch,代码行数:33,代码来源:gl_texture.c
示例13: GL_Bind
/**
* @brief GL_Bind
* @param[in,out] image
*/
void GL_Bind(image_t *image)
{
int texnum;
if (!image)
{
Ren_Warning("GL_Bind: NULL image\n");
texnum = tr.defaultImage->texnum;
}
else
{
texnum = image->texnum;
}
if (r_noBind->integer && tr.dlightImage) // performance evaluation option
{
texnum = tr.dlightImage->texnum;
}
if (glState.currenttextures[glState.currenttmu] != texnum)
{
if (image)
{
image->frameUsed = tr.frameCount;
}
glState.currenttextures[glState.currenttmu] = texnum;
qglBindTexture(GL_TEXTURE_2D, texnum);
}
}
开发者ID:etlegacy,项目名称:etlegacy,代码行数:34,代码来源:tr_backend.c
示例14: RB_ExecuteBackEndCommands
void RB_ExecuteBackEndCommands( const emptyCommand_t *cmds ) {
// r_debugRenderToTexture
int c_draw3d = 0, c_draw2d = 0, c_setBuffers = 0, c_swapBuffers = 0, c_copyRenders = 0;
if ( cmds->commandId == RC_NOP && !cmds->next ) {
return;
}
backEndStartTime = Sys_Milliseconds();
// needed for editor rendering
RB_SetDefaultGLState();
// upload any image loads that have completed
globalImages->CompleteBackgroundImageLoads();
for ( ; cmds ; cmds = (const emptyCommand_t *)cmds->next ) {
switch ( cmds->commandId ) {
case RC_NOP:
break;
case RC_DRAW_VIEW:
RB_DrawView( cmds );
if ( ((const drawSurfsCommand_t *)cmds)->viewDef->viewEntitys ) {
c_draw3d++;
}
else {
c_draw2d++;
}
break;
case RC_SET_BUFFER:
RB_SetBuffer( cmds );
c_setBuffers++;
break;
case RC_SWAP_BUFFERS:
RB_SwapBuffers( cmds );
c_swapBuffers++;
break;
case RC_COPY_RENDER:
RB_CopyRender( cmds );
c_copyRenders++;
break;
default:
common->Error( "RB_ExecuteBackEndCommands: bad commandId" );
break;
}
}
// go back to the default texture so the editor doesn't mess up a bound image
qglBindTexture( GL_TEXTURE_2D, 0 );
backEnd.glState.tmu[0].current2DMap = -1;
// stop rendering on this thread
backEndFinishTime = Sys_Milliseconds();
backEnd.pc.msec = backEndFinishTime - backEndStartTime;
if ( r_debugRenderToTexture.GetInteger() == 1 ) {
common->Printf( "3d: %i, 2d: %i, SetBuf: %i, SwpBuf: %i, CpyRenders: %i, CpyFrameBuf: %i\n", c_draw3d, c_draw2d, c_setBuffers, c_swapBuffers, c_copyRenders, backEnd.c_copyFrameBuffer );
backEnd.c_copyFrameBuffer = 0;
}
}
开发者ID:albertz,项目名称:iodoom3,代码行数:60,代码来源:tr_backend.cpp
示例15: GL_BindNullTextures
void GL_BindNullTextures()
{
int i;
if (glRefConfig.directStateAccess)
{
for (i = 0; i < NUM_TEXTURE_BUNDLES; i++)
{
qglBindMultiTexture(GL_TEXTURE0_ARB + i, GL_TEXTURE_2D, 0);
glDsaState.textures[i] = 0;
}
}
else
{
for (i = 0; i < NUM_TEXTURE_BUNDLES; i++)
{
qglActiveTextureARB(GL_TEXTURE0_ARB + i);
qglBindTexture(GL_TEXTURE_2D, 0);
glDsaState.textures[i] = 0;
}
qglActiveTextureARB(GL_TEXTURE0_ARB);
glDsaState.texunit = GL_TEXTURE0_ARB;
}
}
开发者ID:Hasimir,项目名称:ioq3,代码行数:25,代码来源:tr_dsa.c
示例16: GLRB_RestoreTextureState
void GLRB_RestoreTextureState( void )
{
// Flush textures; reset texture state
Com_Memset( glState.currenttextures, 0, sizeof( glState.currenttextures ) );
if ( qglBindTexture ) {
if ( qglActiveTextureARB ) {
GL_SelectTexture( 1 );
qglBindTexture( GL_TEXTURE_2D, 0 );
GL_SelectTexture( 0 );
qglBindTexture( GL_TEXTURE_2D, 0 );
} else {
qglBindTexture( GL_TEXTURE_2D, 0 );
}
}
GL_SetDefaultState();
}
开发者ID:Avatarchik,项目名称:Quake-III-Arena-D3D11,代码行数:17,代码来源:gl_driver.c
示例17: GL_BindMultitexture
/*
** GL_BindMultitexture
*/
void GL_BindMultitexture( image_t *image0, GLuint env0, image_t *image1, GLuint env1 ) {
int texnum0, texnum1;
texnum0 = image0->texnum;
texnum1 = image1->texnum;
if ( glState.currenttextures[1] != texnum1 ) {
GL_SelectTexture( 1 );
image1->frameUsed = tr.frameCount;
glState.currenttextures[1] = texnum1;
qglBindTexture( GL_TEXTURE_2D, texnum1 );
}
if ( glState.currenttextures[0] != texnum0 ) {
GL_SelectTexture( 0 );
image0->frameUsed = tr.frameCount;
glState.currenttextures[0] = texnum0;
qglBindTexture( GL_TEXTURE_2D, texnum0 );
}
}
开发者ID:entdark,项目名称:q3mme,代码行数:22,代码来源:tr_backend.c
示例18: GLDSA_BindMultiTexture
GLvoid APIENTRY GLDSA_BindMultiTexture(GLenum texunit, GLenum target, GLuint texture)
{
if (glDsaState.texunit != texunit)
{
qglActiveTextureARB(texunit);
glDsaState.texunit = texunit;
}
qglBindTexture(target, texture);
}
开发者ID:Hasimir,项目名称:ioq3,代码行数:10,代码来源:tr_dsa.c
示例19: GL_Bind
void GL_Bind (int texnum)
{
extern image_t *draw_chars;
if (gl_nobind->value && draw_chars) // performance evaluation option
texnum = draw_chars->texnum;
if ( gl_state.currenttextures[gl_state.currenttmu] == texnum)
return;
gl_state.currenttextures[gl_state.currenttmu] = texnum;
qglBindTexture (GL_TEXTURE_2D, texnum);
}
开发者ID:mattx86,项目名称:myq2,代码行数:11,代码来源:gl_image.c
示例20: Draw_Pic
/*
* ============= Draw_Pic =============
*/
void
Draw_Pic(int x, int y, char *pic, float alpha)
{
image_t *gl;
gl = Draw_FindPic(pic);
if (!gl) {
ri.Con_Printf(PRINT_ALL, "Can't find pic: %s\n", pic);
return;
}
if (scrap_dirty)
Scrap_Upload();
if (((gl_config.renderer == GL_RENDERER_MCD) || (gl_config.renderer & GL_RENDERER_RENDITION)) && !gl->has_alpha)
qglDisable(GL_ALPHA_TEST);
/* add alpha support */
{
qglDisable(GL_ALPHA_TEST);
qglBindTexture(GL_TEXTURE_2D, gl->texnum);
GL_TexEnv(GL_MODULATE);
qglColor4f(1, 1, 1, 0.999); /* need <1 for trans to work */
qglEnable(GL_BLEND);
qglDepthMask(false);
}
GL_Bind(gl->texnum);
qglBegin(GL_QUADS);
qglTexCoord2f(gl->sl, gl->tl);
qglVertex2f(x, y);
qglTexCoord2f(gl->sh, gl->tl);
qglVertex2f(x + gl->width, y);
qglTexCoord2f(gl->sh, gl->th);
qglVertex2f(x + gl->width, y + gl->height);
qglTexCoord2f(gl->sl, gl->th);
qglVertex2f(x, y + gl->height);
qglEnd();
/* add alpha support */
{
qglDepthMask(true);
GL_TexEnv(GL_REPLACE);
qglDisable(GL_BLEND);
qglColor4f(1, 1, 1, 1);
qglEnable(GL_ALPHA_TEST);
}
if (((gl_config.renderer == GL_RENDERER_MCD) || (gl_config.renderer & GL_RENDERER_RENDITION)) && !gl->has_alpha)
qglEnable(GL_ALPHA_TEST);
}
开发者ID:ZwS,项目名称:qudos,代码行数:56,代码来源:gl_draw.c
注:本文中的qglBindTexture函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论