Game Development Reference
In-Depth Information
glGenTextures(1, &selScene->gltextures[i].texID);
glBindTexture (GL_TEXTURE_2D, selScene->gltextures[i].
texID);
glPixelStorei (GL_UNPACK_ALIGNMENT, 1);
if (selScene->gltextures[i].wrapS){
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S,
GL_REPEAT);
}else{
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S,
GL_CLAMP);
}
if (selScene->gltextures[i].wrapT){
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T,
GL_REPEAT);
}else{
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T,
GL_CLAMP);
}
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER,
GL_NEAREST);
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
GL_NEAREST);
glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE,
GL_MODULATE);
if (selScene->m_mipmaps){
gluBuild2DMipmaps (GL_TEXTURE_2D, GL_RGB,
pic.GetWidth(), pic.GetHeight(),
GL_BGR_EXT, GL_UNSIGNED_BYTE, pic.GetBitsAddress());
}else{
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB,
pic.GetWidth(), pic.GetHeight(), 0,
GL_BGR_EXT, GL_UNSIGNED_BYTE, pic.GetBitsAddress());
}
}
}
//Now that textures have been created set the actual texture ID
//for all surfaces
obj = selScene->objList.next;
while (obj){
for (j=0; j<obj->oi.numsurfaces; j++){
tex = obj->oi.srfs[j].tex;
Search Nedrilad ::




Custom Search