本文整理汇总了C++中TextureLoader::loadFile方法的典型用法代码示例。如果您正苦于以下问题:C++ TextureLoader::loadFile方法的具体用法?C++ TextureLoader::loadFile怎么用?C++ TextureLoader::loadFile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TextureLoader
的用法示例。
在下文中一共展示了TextureLoader::loadFile方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: init
void GameContextDemo::init() {
angle = 0;
camera = new Camera(0,0,-200,0);
// reset model position
TextureLoader loader;
loader.loadFile("images/man.jpg");
unsigned char * rawData = loader.getData();
glEnable(GL_TEXTURE_2D);
glEnable(GL_BLEND);
glBlendFunc(GL_ONE, GL_SRC_COLOR);
glBindTexture(GL_TEXTURE_2D, texture);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 512, 512, 0, GL_RGB, GL_UNSIGNED_BYTE, rawData);
texCoords = new GLfloat[8];
texCoords[0] = 0.0;
texCoords[1] = 1.0;
texCoords[2] = 1.0;
texCoords[3] = 1.0;
texCoords[4] = 0.0;
texCoords[5] = 0.0;
texCoords[6] = 1.0;
texCoords[7] = 0.0;
mVertices = new signed short[12];
mVertices[0] = -80;
mVertices[1] = -80;
mVertices[2] = 0;
mVertices[3] = 80;
mVertices[4] = -80;
mVertices[5] = 0;
mVertices[6] = -80;
mVertices[7] = 80;
mVertices[8] = 0;
mVertices[9] = 80;
mVertices[10] = 80;
mVertices[11] = 0;
glEnableClientState(GL_VERTEX_ARRAY);
glVertexPointer(3, GL_SHORT, 0, mVertices);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glPointSize(4);
}