#169541 - GugloPWN - Tue Jul 21, 2009 11:55 pm
My goal is to modify Payk's md2 loader so that the model and texture data is local to an object. Basically I wasn't happy how with Payks loader you have a global array of models and textures.
I got the models seperated but textures are not working correctly. I think I need a better understanding of the glCommands.
I call the function like this
I am calling glGenTextures then LoadModelTexture upwards of 6 times, but it doesnt work for even the first. How does the code know where in VRAM to put the textures? I'd guess that the first call puts the texture at the beginning of bank A, does each subsequent call just pile the textures on after?
I've enabled banks A B and C for textures, will they automatically be used? glTexImage2D doesnt ask where in the VRAM it should put the textures so I have no idea where stuff is being written.
If someone can give me a good explanation of all this that'd be awesome.
I got the models seperated but textures are not working correctly. I think I need a better understanding of the glCommands.
Code: |
void LoadModelTexture(char filename[],int &Target,int &TargetPal,int* w)
{ //stuff here decodes the file into a buffer TargetPal = gluTexLoadPal( pal, 256, GL_RGB256 ); glBindTexture (0, Target); if(width==64)glTexImage2D(0, 0, GL_RGB256, TEXTURE_SIZE_64, TEXTURE_SIZE_64, 0, TEXGEN_TEXCOORD|(3<<29),(uint8*)buffer8); if(width==128)glTexImage2D(0, 0, GL_RGB256, TEXTURE_SIZE_128, TEXTURE_SIZE_128, 0, TEXGEN_TEXCOORD | GL_TEXTURE_WRAP_S | GL_TEXTURE_WRAP_T,buffer8); free(buffer8); } |
I call the function like this
Code: |
glGenTextures(1, &Texture);
LoadModelTexture(textfile,Texture,TexturePal,&textsize) ; |
I am calling glGenTextures then LoadModelTexture upwards of 6 times, but it doesnt work for even the first. How does the code know where in VRAM to put the textures? I'd guess that the first call puts the texture at the beginning of bank A, does each subsequent call just pile the textures on after?
I've enabled banks A B and C for textures, will they automatically be used? glTexImage2D doesnt ask where in the VRAM it should put the textures so I have no idea where stuff is being written.
If someone can give me a good explanation of all this that'd be awesome.