本文整理汇总了C++中TextureLoader::LoadTextureResource方法的典型用法代码示例。如果您正苦于以下问题:C++ TextureLoader::LoadTextureResource方法的具体用法?C++ TextureLoader::LoadTextureResource怎么用?C++ TextureLoader::LoadTextureResource使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TextureLoader
的用法示例。
在下文中一共展示了TextureLoader::LoadTextureResource方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Apply
void LayerNode::Apply(IRenderingView *rv) {
glMatrixMode(GL_PROJECTION); // Select Projection
glPushMatrix(); // Push The Matrix
glLoadIdentity(); // Reset The Matrix
glOrtho( 0, w , h , 0, -1, 1 ); // Select Ortho Mode
glMatrixMode(GL_MODELVIEW); // Select Modelview Matrix
glPushMatrix(); // Push The Matrix
glLoadIdentity(); // Reset The Matrix
// Render HUD
glEnable(GL_TEXTURE_2D);
glEnable(GL_BLEND);
GLboolean l = glIsEnabled(GL_LIGHTING);
glDisable(GL_LIGHTING);
glDisable(GL_DEPTH_TEST);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
for(std::list<Layer>::iterator itr = layers.begin();
itr != layers.end();
itr++) {
ITextureResourcePtr texr = itr->texr;
float width = texr->GetWidth();
float height = texr->GetHeight();
float x = itr->origin[0];
float y = itr->origin[1];
if (texr != NULL) {
if (texr->GetID() == 0) {
TextureLoader* tl = new TextureLoader();
tl->LoadTextureResource(texr);
}
glBindTexture(GL_TEXTURE_2D, texr->GetID());
} else {
glBindTexture(GL_TEXTURE_2D, 0);
}
glColor3f(1,1,1);
glBegin(GL_QUADS);
glTexCoord2f(0,0);
glVertex3f(x,y,0);
glTexCoord2f(0,1);
glVertex3f(x,y+height,0);
glTexCoord2f(1,1);
glVertex3f(x+width,y+height,0);
glTexCoord2f(1,0);
glVertex3f(x+width,y,0);
glEnd();
}
glDisable(GL_TEXTURE_2D);
glDisable(GL_BLEND);
glEnable(GL_DEPTH_TEST);
if (l)
glEnable(GL_LIGHTING);
// Reset state
glMatrixMode( GL_PROJECTION ); // Select Projection
glPopMatrix(); // Pop The Matrix
glMatrixMode( GL_MODELVIEW ); // Select Modelview
glPopMatrix(); // Pop The Matrix
}