Hi,
I draw a textured cube . I have one .cpp file in which i wrote all the code(code for textures and the cube code).I want to separate the code to 2 .cpp files.
In the first the texture loader and texture declarations and in the second the draw cube code. I separate the codes but when i run this two .cpp files it shows me the error for undeclared undentifier in the draw-cube .cpp file which is logical.
How i connect this two .cpp files ?
Plz help…
the tuxture loader .cpp
GLuint loadTextureSkybox1 (Image* imageSky1) {
GLuint textureIdSky1;
glGenTextures(1, &textureIdSky1); //Make room for our texture
glBindTexture(GL_TEXTURE_2D, textureIdSky1); //Tell OpenGL which texture to edit
//Map the image to the texture
glTexImage2D(GL_TEXTURE_2D, //Always GL_TEXTURE_2D
0, //0 for now
GL_RGB, //Format OpenGL uses for image
imageSky1->width, imageSky1->height, //Width and height
0, //The border of the image
GL_RGB, //GL_RGB, because pixels are stored in RGB format
GL_UNSIGNED_BYTE, //GL_UNSIGNED_BYTE, because pixels are stored
//as unsigned numbers
imageSky1->pixels); //The actual pixel data
return textureIdSky1; //Returns the id of the texture
}
GLuint _textureIdSky1;
GLUquadric *quadSky1;
void LoadBMP()
{
quadSky1 = gluNewQuadric();
Image* imageSky1 = loadBMP("up.bmp");
_textureIdSky1 = loadTextureSkybox1(imageSky1);
delete imageSky1;
}
the draw-cube with the load-texture parameters
glBindTexture(GL_TEXTURE_2D, _textureIdSky1);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
SkyBoxT();