I took the code from Lesson 6 of the OpenGL tutorials found on NeHe and made a few alterations to a particular function so that I could load multiple textures (6) and then use them as sides to the cube created later on in the program. Basically, I took the LoadGLTextures function and changed it to run through a for loop and load each of the bitmaps. I made sure to change the TextureImage array to the number of bitmaps I would be loading. I then ran the function through a for loop and had it go through a switch statement to change the filename. Below is my code:

After getting these errors when I try to link it, I now find a new folder in the "File View" of my program called "External Dependencies", with the header file "basetsd.h" in it. I''m awfully bewildered here. I''m really not sure what my problem is when I try to link it. Any advice or replies are more than welcome. Thanks!

Just noticed in the documentation on NeHe, and have changed it to a "win32 application". it gets by the linking now, no problem. but now i have to deal with an illegal operation error when the window tries to load up. =P

You''ll notice on the first post, I had left out int i for the last 3 of the calls to TextureImage. I corrected this, but am still recieving an "Access Violation" error by the debugger for this line of code. Any thoughts? I''ll be working on it. Thanks!

I may be wrong but I don''t think you can do it this way.The access violation comes from the fact that you have just written one texture to memory and then you try and overwrite that same texture.you can only call glGenTextures onceand you need to make space for all six textures not just for one that you overwirte each time.why not try assigning a different value for each texture and then in the draw routine bind the texture to the correct planeso we getGLuint texture[6]; (space for all 6 textures)load each of the six textures to a different numberafter making an array for them AUX_RGBImageRec textures[6]; //not sure if you can do this (I just had a different Aux_RGBIMAGEREC for each texture)the do glGenTextures(6,texture)then do the build texture part with different numbers for each textureglBindTexture(GL_TEXTURE_2D, texture[0]);glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR_MIPMAP_NEAREST); gluBuild2DMipmaps(GL_TEXTURE_2D, 3, textures[1]->sizeX, textures[1]->sizeY, GL_RGB, GL_UNSIGNED_BYTE, textures[1]->data);

first you declare TextureImage as a array of pointers...Thereby TextureImage becomes a pointer to the area where those six pointers are, but then you set (via memset ) TextureImage to NULL....Then upon access of TextureImage[ number ] you actually access memory at address 0....

PS. glGenTextures can be called as many times as you want ( it works for me )

You''re right on the money with memset. I contacted Jeff Molofee, and he worked on the code for me. I can now see where I''ve made my mistakes. Memset now clears space for all 6 textures.I run the LoadBMP function for each image seperately, and use them in an if statement for error checking, then run GenTextures with the parameters (6, &texture[0]). I''m a little lost why it''s &texture[0] and not &texture, but it''s no big deal, probably just an oversight by me. Then I run through a for loop and bind the textures, set the height, width and data, and all is well! Thanks immensely to Jeff Molofee for his help, and to everyone that''s replied to this post!