Help with tut 10 again, this time with code

Started by
1 comment, last by dhexb 21 years, 6 months ago
Hi This is the attempt of my basic engine on the foundation of Lesson 10. I am trying to make it multi-texturing. It was crashing before so I have rewritten the code. I keep getting tonnes of errors int LoadGLTextures() { int Status=FALSE; AUX_RGBImageRec *texture[100]; memset(texture,0,sizeof(void *)*1); char* string; FILE* TexFile; TexFile=fopen("data\\worldtex.txt", "rt"); char* path; sscanf(string, "%d\n", &NumTexture); for(int i=0;i=LoadBMP(path)) { Status=TRUE; glGenTextures(1, &texture); glBindTexture(GL_TEXTURE_2D, texture); glTexImage2D(GL_TEXTURE_2D, 0, 3, texture->sizeX, texture->sizeY, 0, GL_RGB, GL_UNSIGNED_BYTE, texture->data); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR); } if (texture) // If Texture Exists { if (texture->data) // If Texture Image Exists { free(texture->data); // Free The Texture Image Memory } free(texture); // Free The Image Structure } } fclose(TexFile); return Status; } I am getting the errors: ''glGenTextures'' : cannot convert parameter 2 from ''struct _AUX_RGBImageRec ** '' to ''unsigned int *'' Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast error C2664: ''glBindTexture'' : cannot convert parameter 2 from ''struct _AUX_RGBImageRec *'' to ''unsigned int'' This conversion requires a reinterpret_cast, a C-style cast or function-style cast Now I know this is due to the fact that the array cannot handle interger data types. However I was wondering if there was a type cast to convert the interger to an AUX_RGBImageRex. Or if someone knew a way round it. Also i was wondering if that code would actually work &#111;nce I get through this problem… all help is much appreciated DhexB </i>
DhExB
Advertisement
thats not working. you need the image data just for loading the image and building a texture out of it. So you should create it dynamically. Then you need a second array of GLuint. In this array you generate the texture. after your texture was generated you should delete your image data because then the texture is already in the video memory of your card and your image variable worthless.
ok, well, i may leave multi-texturing in tut 10 for another time. Thanks for the help anyway.
DhExB

This topic is closed to new replies.

Advertisement