texture mapping - where is the mistake?

hi,
i created solar system using SolidSphere and everything works as I wanted to, but now I have to replace spheres with textured cubes. I have created just 3 simple planes to see if the texture is applied and they are not… where is the mistake in the code? as You can see i haven’t deleted spheres so far so the code is quite a mess, sorry about that.

#include <stdlib.h>
#include <windows.h>
#include <glut.h>
#include <GL/gl.h>
#include <GL/glu.h>
#include <math.h>
#include <stdio.h>
#include <glaux.h>
#define _CRT_SECURE_NO_DEPRECATE

GLuint texture[8]; // Storage For The Textures We Are Useing 6 Textures You Would Make It 6
GLuint loop; // Generic Loop Variable

AUX_RGBImageRec *LoadBMP(char *Filename) // Loads A Bitmap Image
{
FILE *File=NULL; // File Handle

if (!Filename)										// Make Sure A Filename Was Given
{
	return NULL;									// If Not Return NULL
}

File=fopen(Filename,"r");							// Check To See If The File Exists

if (File)											// Does The File Exist?
{
	fclose(File);									// Close The Handle
	return auxDIBImageLoadA(Filename);				// Load The Bitmap And Return A Pointer
}

return NULL;										// If Load Failed Return NULL

}

int LoadGLTextures() // Load Bitmaps And Convert To Textures
{
int Status=FALSE; // Status Indicator
AUX_RGBImageRec *TextureImage[8]; // Create Storage Space For The Textures
memset(TextureImage,0,sizeof(void *)*8); // Set The Pointer To NULL

    if ((TextureImage[0]=LoadBMP("red_brick.bmp")) &&	// Textre 0
		(TextureImage[1]=LoadBMP("red_brick.bmp")) &&	// Textre 1
		(TextureImage[2]=LoadBMP("red_brick.bmp")) &&	// Textre 2
		(TextureImage[3]=LoadBMP("red_brick.bmp")) &&	// Textre 3
		(TextureImage[4]=LoadBMP("red_brick.bmp")) &&	// Textre 4
		(TextureImage[5]=LoadBMP("red_brick.bmp")) &&	// Textre 5
		(TextureImage[6]=LoadBMP("red_brick.bmp")) &&	// Textre 6
		(TextureImage[7]=LoadBMP("red_brick.bmp")))	    // Textre 7
        
	{
            Status=TRUE;                            // Set The Status To TRUE
            glGenTextures(8, &texture[0]);          // Create Five Textures

			for (loop=0; loop&lt;8; loop++)			// Loop Through All 8 Textures
			{
                glBindTexture(GL_TEXTURE_2D, texture[loop]);
		        glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
			    glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
				glTexImage2D(GL_TEXTURE_2D, 0, 3, TextureImage[loop]-&gt;sizeX, TextureImage[loop]-&gt;sizeY, 0, GL_RGB, GL_UNSIGNED_BYTE, TextureImage[loop]-&gt;data);
			}
    }
	for (loop=0; loop&lt;8; loop++)						// Loop Through All 8 Textures
	{
        if (TextureImage[loop])							// If Texture Exists
	    {
		        if (TextureImage[loop]-&gt;data)			// If Texture Image Exists
			    {
				        free(TextureImage[loop]-&gt;data);	// Free The Texture Image Memory
				}
				free(TextureImage[loop]);				// Free The Image Structure
		}
	}
    return Status;                                  // Return The Status

}

// velocity factor
int v=1;

// angular velocities of planets, moons and Saturn and Uranus rings
#define MercuryRotation v0.1
#define VenusRotation v
0.07
#define EarthRotation v0.04
#define MarsRotation v
0.02
#define JupiterRotation v0.015
#define SaturnRotation v
0.012
#define UranusRotation v0.009
#define NeptuneRotation v
0.005

#define EarthMoonRotation v*-0.3

#define SaturnRingRotation v*-0.035
#define UranusRingRotation v*0.05

// angular velocities of sidereal rotations of planets

#define MercurySelfRotation 0.1
#define VenusSelfRotation 0.1
#define EarthSelfRotation 0.1
#define MarsSelfRotation 0.1
#define JupiterSelfRotation 0.1
#define SaturnSelfRotation 0.1
#define UranusSelfRotation 0.1
#define NeptuneSelfRotation 0.1

// constants

GLfloat Mercury_Rotation =0.0;
GLfloat Venus_Rotation =0.0;
GLfloat Earth_Rotation= 0.0;
GLfloat Mars_Rotation =0.0;
GLfloat Jupiter_Rotation= 0.0;
GLfloat Saturn_Rotation= 0.0;
GLfloat Uranus_Rotation =0.0;
GLfloat Neptune_Rotation= 0.0;

GLfloat EarthMoon_Rotation= 0.0;

GLfloat SaturnRing_Rotation = 0.0;
GLfloat UranusRing_Rotation = 0.0;

GLfloat MercurySelf_Rotation =0;
GLfloat VenusSelf_Rotation =0;
GLfloat EarthSelf_Rotation =0;
GLfloat MarsSelf_Rotation =0;
GLfloat JupiterSelf_Rotation =0;
GLfloat SaturnSelf_Rotation =0;
GLfloat UranusSelf_Rotation =0;
GLfloat NeptuneSelf_Rotation =0;

//light properties
GLfloat ambientLight[] = {0.1, 0.1, 0.1, 1.0};
GLfloat lightAmbient[] = {0.3, 0.3, 0.3, 1.0};
GLfloat lightDiffuse[] = {0.6, 0.6, 0.6, 1.0};
GLfloat lightSpecular[] = {1.0, 1.0, 0.9, 1.0};

//view constants
GLdouble eyey=40;
GLdouble eyex=0;
GLdouble eyez=160;

int lastMouseButton, lastX, lastY;
int viewAngle = 15;
int viewPosition = 0;

//light position
float lightPosition[] = {0, 0, 0, 1}; // - center of solar system = sun position

// materials
GLfloat material_Df[]={1,1,1,1.00};
GLfloat material_Lines[]={0.1,0.1,0.1,0.1};
GLfloat material_Diffuse_Lines[]={0.1,0.1,0.1,0.1};
GLfloat material_Lines2[]={0.05,0.05,0.05,1};

GLfloat material_Sun[]={1,1,0,1.00};

GLfloat material_Mercury[]={0.3,0.3,0.3,1.00};
GLfloat material_Venus[]={1,0.4,0,1.00};
GLfloat material_Earth[]={0,0,1,1.00};
GLfloat material_Earth_Moon[]={0.8,0.7,0.6,1.00};
GLfloat material_Mars[]={1,0,0,1.00};
GLfloat material_Jupiter[]={1,0.2,0,1.00};
GLfloat material_Saturn[]={1,1,0.2,1.00};
GLfloat material_Uranus[]={0.2,0.8,0.2,1.00};
GLfloat material_Neptune[]={0.2,0.4,0.9,1.00};

// function drawing scene from the observer position
void DrawScene(void)
{
// preparing modelling matrices
glPushMatrix();

// drawing sun
glPushMatrix();
glRotatef(-90.0, 1, 0, 0);
glScalef(5.0, 5.0, 5.0);
GLfloat emissive[] = {1.0, 1.0, 0.1, 1.0};
glMaterialfv(GL_FRONT, GL_EMISSION, emissive);
glutSolidSphere(1.0, 20, 20);
glPopMatrix();

//switching off emmision parameter
GLfloat emissive2[] = {0, 0, 0, 1.0};
glMaterialfv(GL_FRONT, GL_EMISSION, emissive2);

// Drawing mercury
glRotatef(Mercury_Rotation, 0, 1, 0);
glTranslatef(0.0, 0.0, 10.0);
glPushMatrix();
glRotatef(MercurySelf_Rotation, 0, 1, 0);
glRotatef(-90.0, 1, 0, 0);
glScalef(1.0, 1.0, 1.0);
glMaterialfv(GL_FRONT,GL_AMBIENT,material_Mercury);
glMaterialfv(GL_FRONT,GL_DIFFUSE,material_Df);

glutSolidSphere(0.5, 20, 20);
glPopMatrix();

	glEnable(GL_TEXTURE_2D);

// cubesssssssssss
glBindTexture(GL_TEXTURE_2D, texture[0]); // Texture 0

glBegin(GL_QUADS);

    // Front Face Of Cube
	glTexCoord2f(0.0f, 0.0f); glVertex3f(-1.0f, -1.0f,  1.0f);
	glTexCoord2f(1.0f, 0.0f); glVertex3f( 1.0f, -1.0f,  1.0f);
	glTexCoord2f(1.0f, 1.0f); glVertex3f( 1.0f,  1.0f,  1.0f);
	glTexCoord2f(0.0f, 1.0f); glVertex3f(-1.0f,  1.0f,  1.0f);

glEnd();


// Drawing venus

glLoadIdentity();
glRotatef(Venus_Rotation, 0, 1, 0);
glTranslatef(0.0, 0.0, 13.0);
glPushMatrix();
glRotatef(VenusSelf_Rotation, 0, 1, 0);
glRotatef(-90.0, 1, 0, 0);
glScalef(1.0, 1.0, 1.0);
glMaterialfv(GL_FRONT,GL_AMBIENT,material_Venus);
glMaterialfv(GL_FRONT,GL_DIFFUSE,material_Df);
glutSolidSphere(1.2, 20, 20);
glPopMatrix();

// Drawing earth
glLoadIdentity();
glRotatef(Earth_Rotation, 0, 1, 0);
glTranslatef(0.0, 0.0, 18.0);
glPushMatrix();
glRotatef(EarthSelf_Rotation, 0, 1, 0);
glRotatef(-90.0, 1, 0, 0);
glScalef(1.0, 1.0, 1.0);
glMaterialfv(GL_FRONT,GL_AMBIENT,material_Earth);
glMaterialfv(GL_FRONT,GL_DIFFUSE,material_Df);
glutSolidSphere(1.2, 20, 20);
glPopMatrix();

// Drawing earth’s moon
glColor3f(0.8, 0.7, 0.6);
glRotatef(EarthMoon_Rotation, 0, 1, 0);
//drawing moon’s orbit
glMaterialfv(GL_FRONT,GL_AMBIENT,material_Lines2);
glMaterialfv(GL_FRONT,GL_DIFFUSE,material_Lines2);
glBegin(GL_LINE_LOOP);
for (int j=0; j<40; j++)
{
glVertex3f(sin(3.142j/40) * 2, 0,
cos(3.142j/40) * 2);
}
glEnd();
//drawing moon
glRotatef(-90.0, 1, 0, 0);
glTranslatef(2.0, 0.0, 0.0);
glScalef(0.5, 0.5, 0.5);
glMaterialfv(GL_FRONT,GL_AMBIENT,material_Earth_Moon);
glMaterialfv(GL_FRONT,GL_DIFFUSE,material_Df);
glutSolidSphere(0.4, 20, 20);

// Drawing Mars
glLoadIdentity();
glRotatef(Mars_Rotation, 0, 1, 0);
glTranslatef(0.0, 0.0, 23.0);
glPushMatrix();
glRotatef(MarsSelf_Rotation, 0, 1, 0);
glRotatef(-90.0, 1, 0, 0);
glScalef(1.0, 1.0, 1.0);
glMaterialfv(GL_FRONT,GL_AMBIENT,material_Mars);
glMaterialfv(GL_FRONT,GL_DIFFUSE,material_Df);
glutSolidSphere(0.8, 20, 20);
glPopMatrix();

// Drawing Jupiter
glLoadIdentity();
glRotatef(Jupiter_Rotation, 0, 1, 0);
glTranslatef(0.0, 0.0, 33.0);
glPushMatrix();
glRotatef(JupiterSelf_Rotation, 0, 1, 0);
glRotatef(-90.0, 1, 0, 0);
glScalef(1.0, 1.0, 1.0);
glMaterialfv(GL_FRONT,GL_AMBIENT,material_Jupiter);
glMaterialfv(GL_FRONT,GL_DIFFUSE,material_Df);
glutSolidSphere(3, 20, 20);
glPopMatrix();

//Drawing Jupiter’s 4 moons
// 1st moon
glColor3f(0.0, 0.0, 1.0);
glRotatef(EarthMoon_Rotation, 0, 1, 0);
glRotatef(-90.0, 1, 0, 0);
//drawing moon’s orbit
glMaterialfv(GL_FRONT,GL_AMBIENT,material_Lines2);
glMaterialfv(GL_FRONT,GL_DIFFUSE,material_Lines2);
glBegin(GL_LINE_LOOP);
for (int j=0; j<40; j++)
{
glVertex3f(sin(3.142j/40) * 4, 0,
cos(3.142j/40) * 4);
}
glEnd();

glTranslatef(4.0, 0.0, 0.0);
glScalef(0.5, 0.5, 0.5);
glMaterialfv(GL_FRONT,GL_AMBIENT,material_Earth_Moon);
glMaterialfv(GL_FRONT,GL_DIFFUSE,material_Df);
glutSolidSphere(0.8, 20, 20);

//2nd moon
glLoadIdentity();
glRotatef(Jupiter_Rotation, 0, 1, 0);
glTranslatef(0.0, 0.0, 33.0);
glPushMatrix();
glColor3f(0.0, 0.0, 1.0);
glRotatef(EarthMoon_Rotation, 0, 0, 1);
glRotatef(-90.0, 1, 0, 0);
glMaterialfv(GL_FRONT,GL_AMBIENT,material_Lines2);
glMaterialfv(GL_FRONT,GL_DIFFUSE,material_Lines2);
glBegin(GL_LINE_LOOP);
for (int j=0; j<40; j++)
{
glVertex3f(sin(3.142j/40) * 5.2, 0,
cos(3.142j/40) * 5.2);
}
glEnd();
glTranslatef(5.2, 0.0, 0.0);
glScalef(0.5, 0.5, 0.5);
glMaterialfv(GL_FRONT,GL_AMBIENT,material_Earth_Moon);
glMaterialfv(GL_FRONT,GL_DIFFUSE,material_Df);
glutSolidSphere(0.8, 20, 20);
glPopMatrix();

//3rd moon
glLoadIdentity();
glRotatef(Jupiter_Rotation, 0, 1, 0);
glTranslatef(0.0, 0.0, 33.0);
glPushMatrix();
glColor3f(0.0, 0.0, 1.0);
glRotatef(EarthMoon_Rotation, 0, 1, 1);
glRotatef(-90.0, 1, 0, 0);
glMaterialfv(GL_FRONT,GL_AMBIENT,material_Lines2);
glMaterialfv(GL_FRONT,GL_DIFFUSE,material_Lines2);
glBegin(GL_LINE_LOOP);
for (int j=0; j<40; j++)
{
glVertex3f(sin(3.142j/40) * 6, 0,
cos(3.142j/40) * 6);
}
glEnd();
glTranslatef(6, 0.0, 0.0);
glScalef(0.5, 0.5, 0.5);
glMaterialfv(GL_FRONT,GL_AMBIENT,material_Earth_Moon);
glMaterialfv(GL_FRONT,GL_DIFFUSE,material_Df);
glutSolidSphere(0.8, 20, 20);
glPopMatrix();

//4th moon
glLoadIdentity();
glRotatef(Jupiter_Rotation, 0, 1, 0);
glTranslatef(0.0, 0.0, 33.0);
glPushMatrix();
glColor3f(0.0, 0.0, 1.0);
glRotatef(EarthMoon_Rotation, 0, 1, 0);
glMaterialfv(GL_FRONT,GL_AMBIENT,material_Lines2);
glMaterialfv(GL_FRONT,GL_DIFFUSE,material_Lines2);
glBegin(GL_LINE_LOOP);
for (int j=0; j<40; j++)
{
glVertex3f(sin(3.142j/40) * 6.9, 0,
cos(3.142j/40) * 6.9);
}
glEnd();
glRotatef(-90.0, 1, 0, 0);

glTranslatef(6.9, 0.0, 0.0);
glScalef(0.5, 0.5, 0.5);
glMaterialfv(GL_FRONT,GL_AMBIENT,material_Earth_Moon);
glMaterialfv(GL_FRONT,GL_DIFFUSE,material_Df);
glutSolidSphere(0.8, 20, 20);

glPopMatrix();

// Drawing Saturn
glLoadIdentity();
glRotatef(Saturn_Rotation, 0, 1, 0);
glTranslatef(0.0, 0.0, 45.0);
glPushMatrix();
glRotatef(SaturnSelf_Rotation, 0, 0, 1);
glRotatef(-90.0, 1, 0, 0);
glScalef(1.0, 1.0, 1.0);
glMaterialfv(GL_FRONT,GL_AMBIENT,material_Saturn);
glMaterialfv(GL_FRONT,GL_DIFFUSE,material_Df);
glutSolidSphere(2, 20, 20);
// Drawing Saturn’s ring
glLoadIdentity();
glRotatef(Saturn_Rotation, 0, 1, 0);
glTranslatef(0.0, 0.0, 45.0);
glPushMatrix();
glRotatef(SaturnRing_Rotation, 0, 0, 1);
glColor3f(0.0, 0.0, 1.0);
glRotatef(EarthMoon_Rotation, 0, 1, 0);
glRotatef(-90.0, 1, 0, 0);
glTranslatef(0, 0.0, 0.0);
glScalef(1, 1, 0.2);
glutSolidTorus( 0.6, 3.2, 20, 20 );
glPopMatrix();

// Drawing Uranus
glLoadIdentity();
glRotatef(Uranus_Rotation, 0, 1, 0);
glTranslatef(0.0, 0.0, 55.0);
glPushMatrix();
glRotatef(UranusSelf_Rotation, 0, 0, 1);
glRotatef(-90.0, 1, 0, 0);
glScalef(1.0, 1.0, 1.0);
glMaterialfv(GL_FRONT,GL_AMBIENT,material_Uranus);
glMaterialfv(GL_FRONT,GL_DIFFUSE,material_Df);
glutSolidSphere(1.8, 20, 20);
glPopMatrix();
// Drawing Uranus’s ring
glLoadIdentity();
glRotatef(Uranus_Rotation, 0, 1, 0);
glTranslatef(0.0, 0.0, 55.0);
glPushMatrix();
glRotatef(UranusRing_Rotation, 0, 0, 1);
glColor3f(0.0, 0.0, 1.0);
glRotatef(EarthMoon_Rotation, 0, 1, 0);
glRotatef(-90.0, 1, 0, 0);
glTranslatef(0, 0.0, 0.0);
glScalef(1, 1, 0.2);
glutSolidTorus( 0.3, 2.7, 20, 20 );
glPopMatrix();

// Drawing Neptune

glLoadIdentity();
glRotatef(Neptune_Rotation, 0, 1, 0);
glTranslatef(0.0, 0.0, 65.0);
glPushMatrix();
glRotatef(NeptuneSelf_Rotation, 0, 0, 1);
glRotatef(-90.0, 1, 0, 0);
glScalef(1.0, 1.0, 1.0);
glMaterialfv(GL_FRONT,GL_AMBIENT,material_Neptune);
glMaterialfv(GL_FRONT,GL_DIFFUSE,material_Df);
glutSolidSphere(0.2, 20, 20);
glPopMatrix();
glEnable(GL_TEXTURE_2D);
// cubesssssssssss
glBindTexture(GL_TEXTURE_2D, texture[0]); // Texture 0

glBegin(GL_QUADS);

    // Front Face Of Cube
	glTexCoord2f(0.0f, 0.0f); glVertex3f(-1.0f, -1.0f,  1.0f);
	glTexCoord2f(1.0f, 0.0f); glVertex3f( 1.0f, -1.0f,  1.0f);
	glTexCoord2f(1.0f, 1.0f); glVertex3f( 1.0f,  1.0f,  1.0f);
	glTexCoord2f(0.0f, 1.0f); glVertex3f(-1.0f,  1.0f,  1.0f);

glEnd();

glBindTexture(GL_TEXTURE_2D, texture[1]); // Texture 1

glBegin(GL_QUADS);

    // Back Face Of Cube
	glTexCoord2f(1.0f, 0.0f); glVertex3f(-1.0f, -1.0f, -1.0f);
	glTexCoord2f(1.0f, 1.0f); glVertex3f(-1.0f,  1.0f, -1.0f);
	glTexCoord2f(0.0f, 1.0f); glVertex3f( 1.0f,  1.0f, -1.0f);
	glTexCoord2f(0.0f, 0.0f); glVertex3f( 1.0f, -1.0f, -1.0f);
	
glEnd();

// cleaning after modelling matrices
glPopMatrix();

//drawing orbits of planets
glMaterialfv(GL_FRONT,GL_AMBIENT,material_Lines);
glMaterialfv(GL_FRONT,GL_DIFFUSE,material_Diffuse_Lines);
glBegin(GL_LINE_LOOP);
for (int j=0; j<40; j++)
{
glVertex3f(sin(3.142j/40) * 10, 0,
cos(3.142j/40) * 10);
}
glEnd();
glBegin(GL_LINE_LOOP);
for (int j=0; j<40; j++)
{
glVertex3f(sin(3.142j/40) * 13, 0,
cos(3.142j/40) * 13);
}
glEnd();
glBegin(GL_LINE_LOOP);
for (int j=0; j<40; j++)
{
glVertex3f(sin(3.142j/40) * 18, 0,
cos(3.142j/40) * 18);
}
glEnd();
glBegin(GL_LINE_LOOP);
for (int j=0; j<40; j++)
{
glVertex3f(sin(3.142j/40) * 23, 0,
cos(3.142j/40) * 23);
}
glEnd();
glBegin(GL_LINE_LOOP);
for (int j=0; j<40; j++)
{
glVertex3f(sin(3.142j/40) * 33, 0,
cos(3.142j/40) * 33);
}
glEnd();
glBegin(GL_LINE_LOOP);
for (int j=0; j<40; j++)
{
glVertex3f(sin(3.142j/40) * 45, 0,
cos(3.142j/40) * 45);
}
glEnd();
glBegin(GL_LINE_LOOP);
for (int j=0; j<40; j++)
{
glVertex3f(sin(3.142j/40) * 55, 0,
cos(3.142j/40) * 55);
}
glEnd();
glBegin(GL_LINE_LOOP);
for (int j=0; j<40; j++)
{
glVertex3f(sin(3.142j/40) * 65, 0,
cos(3.142j/40) * 65);
}
glEnd();
}

//-----------------------------------------------------------------------

// function generating single frame of animation
void DisplayPicture(void)
{
// cleaning frame and depth buffers
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);

glPushMatrix();

// generating picture
DrawScene();

glPopMatrix();

// swapping frame buffers
glutSwapBuffers();

// updates of planets and moons rotation for the next frame

         //global rotations

Mercury_Rotation +=MercuryRotation;
Venus_Rotation +=VenusRotation;
Earth_Rotation +=EarthRotation;
Mars_Rotation +=MarsRotation;
Jupiter_Rotation +=JupiterRotation;
Saturn_Rotation +=SaturnRotation;
Uranus_Rotation +=UranusRotation;
Neptune_Rotation +=NeptuneRotation;
EarthMoon_Rotation +=EarthMoonRotation;
SaturnRing_Rotation += SaturnRingRotation;
UranusRing_Rotation += UranusRingRotation;

         //self rotations

MercurySelf_Rotation +=MercurySelfRotation;
VenusSelf_Rotation +=VenusSelfRotation;
EarthSelf_Rotation +=EarthSelfRotation;
MarsSelf_Rotation +=MarsSelfRotation;
JupiterSelf_Rotation +=JupiterSelfRotation;
SaturnSelf_Rotation +=SaturnSelfRotation;
UranusSelf_Rotation +=UranusSelfRotation;
NeptuneSelf_Rotation +=NeptuneSelfRotation;

}

//-------------------------------------------

// function setting perspective view parameters and size of a viewport
void SetViewParameters(int width, int height)
{
// viewport parameters
glViewport(0, 0, width, height);

// projecting matrix mode
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
// perspective view parameters
gluPerspective(40.0, (GLdouble)width/(GLdouble)height, 0.1, 1000.0);
gluLookAt(eyex, eyey, eyez, eyex, 0, 0.0, 0.0, 1.0, 0.0); // first 3 - position of camera, next 3 - viewing direction
// geometrical modifications mode
glRotatef(viewPosition, 0, 1, 0);
glRotatef(viewAngle, 1, 0, 0);
glMatrixMode(GL_MODELVIEW);
// identity matrix
glLoadIdentity();
}

//----------------------------------------------------------------

// keyboard input
void KeyboardInput(unsigned char key, int x, int y)
{
switch(key)
{
case ‘w’:
eyey+=3;
break;
case ‘s’:
eyey-=3;
break;
case ‘a’:
eyex-=1;
break;
case ‘d’:
eyex+=1;
break;
case ‘=’:
eyez-=3;
break;
case ‘-’:
eyez+=3;
break;
}

SetViewParameters( glutGet( GLUT_WINDOW_WIDTH ), glutGet( GLUT_WINDOW_HEIGHT ) );
}

// mouse functions
void mousePressed(int button, int state, int x, int y)
{
if (state == GLUT_DOWN)
{
lastMouseButton = button;
lastX = x;
lastY = y;
}
SetViewParameters( glutGet( GLUT_WINDOW_WIDTH ), glutGet( GLUT_WINDOW_HEIGHT ) );
}

void mouseDragged(int x, int y)
{
int diffX, diffY;

diffX = x - lastX;
diffY = y - lastY;

lastX = x;
lastY = y;

switch (lastMouseButton)
{
	case GLUT_LEFT_BUTTON:
		viewPosition = (viewPosition + diffX/2) % 360;
		viewAngle = (viewAngle + diffY/2) % 360;
		break;
	
	case GLUT_RIGHT_BUTTON:
		eyez += diffY/2;
		if (eyez &lt; 0) eyez = 0;
		break;
}
SetViewParameters( glutGet( GLUT_WINDOW_WIDTH ), glutGet( GLUT_WINDOW_HEIGHT ) );

}

//----------------------------------------------------------------

// main function
int main(int argc, char **argv)
{
// GLUT library initialisation
glutInit(&argc, argv);

if (!LoadGLTextures())								// Jump To Texture Loading Routine
{
	return FALSE;									// If Texture Didn't Load Return FALSE
}


glEnable(GL_TEXTURE_2D);							// Enable Texture Mapping ( NEW )
glShadeModel(GL_SMOOTH);	

// setting display mode
glutInitDisplayMode (GLUT_DOUBLE|GLUT_RGB|GLUT_DEPTH);

// lower left corner of the window
glutInitWindowPosition(100, 100);

// setting window size(width, height)
glutInitWindowSize(1100, 600);

// creating window
glutCreateWindow(“Solar System OpenGL - Pawel Stateczny”);

// enabling depth buffer
glEnable(GL_DEPTH_TEST);

// setting function in depth buffer
glDepthFunc(GL_LEQUAL);

// clearing buffer value
glClearDepth(1000.0);

// cleaning frame buffer color
glClearColor (0, 0, 0, 0); // - black background color
glEnable(GL_TEXTURE_2D); // Enable Texture Mapping ( NEW )
glShadeModel(GL_SMOOTH);
//light parameters
glEnable(GL_LIGHTING);
glLightfv(GL_LIGHT0, GL_AMBIENT, lightAmbient);
glLightfv(GL_LIGHT0, GL_DIFFUSE, lightDiffuse);
glLightfv(GL_LIGHT0, GL_SPECULAR, lightSpecular);
glLightfv(GL_LIGHT0, GL_POSITION, lightPosition);
glEnable(GL_LIGHT0);
glLightModelfv(GL_LIGHT_MODEL_AMBIENT, ambientLight);
glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, GL_TRUE);

// displaying function
glutDisplayFunc(DisplayPicture);

// function called every time window size is changed
glutReshapeFunc(SetViewParameters);

// function called when there are no changes
glutIdleFunc(DisplayPicture);

// keyboard and mouse input
glutKeyboardFunc(KeyboardInput);
glutMouseFunc(mousePressed);
glutMotionFunc(mouseDragged);

// loop of the program
glutMainLoop();

return 0;
}

I don’t see any glActiveTexture in your code.

ps: Use pasteBin if you want a better chance of answers. I can’t read unformatted code.

glMatrixMode(GL_PROJECTION);
glLoadIdentity();
// perspective view parameters
gluPerspective(40.0, (GLdouble)width/(GLdouble)height, 0.1, 1000.0);
gluLookAt(eyex, eyey, eyez, eyex, 0, 0.0, 0.0, 1.0, 0.0); // first 3 - position of camera, next 3 - viewing direction
// geometrical modifications mode
glRotatef(viewPosition, 0, 1, 0);
glRotatef(viewAngle, 1, 0, 0);
glMatrixMode(GL_MODELVIEW);
// identity matrix

GluLookat should not be set against the projection matrix but the model matrix instead.