PDA

View Full Version : How set texture on 3D model use this



ljubomir993
12-14-2014, 02:28 PM
How set texture, on my model. I use this


glBindTexture(GL_TEXTURE_2D, textures[i]);

uwi2k2
12-14-2014, 11:55 PM
hi,

basicly what you are doing MAY be right .. but a lot of code is needed additionally to this to really use a texture..
can you show your code ?
does your model has Texture coordinates ?

regrads
uwi2k2

ljubomir993
12-15-2014, 06:58 AM
#include <windows.h> // Standardno windows zaglavlje
#include <GL/GL.h> // Microsoft OpenGL verzija 1.1
#include <GL/glu.h> // OpenGL Utilities
#include <GL/glut.h> // GLUT
#include <math.h> // matematicke funkcije
#include "model.h" // za rad sa modelom
#include "Proracun_Normala.h"
#include <FreeImage.h>



// kompajlerska direktiva koja ne prikazuje konzolni prozor
#pragma comment(linker, "/subsystem:\"windows\" /entry:\"mainCRTStartup\"")


// Uglovi rotacije
GLfloat g_rotationX = 0.0f;
GLfloat g_rotationY = 0.0f;

// Glu objekat
GLUquadricObj* g_gluObj = NULL;
Model* g_model = NULL;



// Identifikatori tekstura i putanje do odgovarajucih slika
typedef enum { TEXTURE_DRVO = 0, TEXTURE_METAL, TEXTURE_ZID, TEXTURE_GLASS, TEXTURE_TRAVA,TEXTURE_GRASS, TEXTURE_CRAN, TEXTURE_RUBBER, TEXTURE_GROUND, TEXTURE_COUNT } TTextures;
GLuint textures[TEXTURE_COUNT];
const char* textureFiles[TEXTURE_COUNT] = { "drvo.jpg", "metal.jpg", "zid.jpg", "glass.jpg", "trava.jpg" ,"grass.jpg", "cran.jpg", "rubber.jpg", "ground.jpg"};




// Prototipovi funkcija
void RenderScene(void);
void SetupRenderingContext();
void SpecialKeys(int key, int x, int y);
void ChangeSize(int w, int h);
void DrawWheel();
void Shutdown();








//////////////////////////////////////////////////////////////////////
// Naziv: main
// Namena: main funkcija
// Parametri: argc, argv
// Povratna vrednost: int
//////////////////////////////////////////////////////////////////////
int main(int argc, char *argv[])
{
// TODO 1: Kreirati prozor dimenzija 640x480 koji podrzava rad sa dablbafering i testiranje dubine
// Naslov prozora treba da bude: Dizalica
// Za iscrtavanje scene koristiti RenderScene funkciju, za izmenu dimenzija ChangeSize,
// za inicijalizaciju SetupRenderingContext, za oslobadanje resursa funkciju Shutdown

glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_DEPTH); // Podrzava rad sa dablbafering i testiranje dubine
glutInitWindowSize(640, 480); // Prozor dimenzija 640x480
glutCreateWindow("Dizalica"); // Naslov prozora " Dizalica"
glutDisplayFunc(RenderScene); // Iscrtavanje scene
glutReshapeFunc(ChangeSize); // Izmena dimenzije prozora
glutSpecialFunc(SpecialKeys); // Pomeranje pomocu tastera
SetupRenderingContext(); // Inicijalizacija
glutMainLoop();// Pokretanje glavne petlje

Shutdown(); // Oslobadjanje resursa


return 0;
}



FIBITMAP* LoadImageFromFile(const char* filename)
{
// odredi format slike
FREE_IMAGE_FORMAT fifmt = FreeImage_GetFileType(filename, 0);
// ucitaj sliku
FIBITMAP *dib = FreeImage_Load(fifmt, filename, 0);

return dib;
}


//////////////////////////////////////////////////////////////////////
// Naziv: DrawWheel
// Namena: funkcija iscrtava tocak
//////////////////////////////////////////////////////////////////////
void DrawWheel()
{

// Tocak kao valjak i felna kao disk
glPushMatrix();

// TODO 2: Nacrtati tocak kao valjak poluprecnika 0.3 i visine 0.2, koristiti g_gluObj promenljivu
gluCylinder(g_gluObj, 0.3, 0.3, 0.2, 64, 64);

// TODO 2: Nacrtati felnu kao krug poluprecnika 0.3 na dubini od 0.2 jedinice po z-osi, koristiti g_gluObj promenljivu
glTranslated(0, 0, 0.2); //translacija po z-osi
gluDisk(g_gluObj,0.0,0.3,64,64);

glPopMatrix();
}




//////////////////////////////////////////////////////////////////////
// Naziv: RenderScene
// Namena: funkcija iscrtava OpenGL scenu
//////////////////////////////////////////////////////////////////////
void RenderScene(void)
{
// Obrisi sadrzaj kolor i depth bafera
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);


// Sacuvaj stanje modelview matrice i primeni transformacije
glPushMatrix();
// Primeni transformacije
glBindTexture(GL_TEXTURE_2D, textures[TEXTURE_RUBBER]);
glEnable(GL_TEXTURE_GEN_S);
glEnable(GL_TEXTURE_GEN_T);
glNormal3f(1.0f, 1.0f, 1.0f);
glTranslated(0.0, -0.7, -10.0);
glRotatef(g_rotationX, 1.0f, 0.0f, 0.0f);
glRotatef(g_rotationY, 0.0f, 1.0f, 0.0f);
glDisable(GL_TEXTURE_GEN_S);
glDisable(GL_TEXTURE_GEN_T);


// Podloga
glColor3ub(0, 255, 0);



glPushMatrix();
// TODO 2: Nacrtati podlogu koriscenjem GL_QUADS primitive
// temena su (u pravilnom redosledu):
glBindTexture(GL_TEXTURE_2D, textures[TEXTURE_GROUND]);
glColor3ub(255, 255, 255);
glBegin(GL_QUADS);
glNormal3f(0.0f, 1.0f, 0.0f);
glTexCoord2f(0.0f, 1.0f);
glVertex3d(18.0f, -0.9f, -18.0f);
glTexCoord2f(1.0f, 1.0f);
glVertex3d(-18.0f, -0.9f, -18.0f);
glTexCoord2f(1.0f, 0.0f);
glVertex3d(-18.0f, -0.9f, 18.0f);
glTexCoord2f(0.0f, 0.0f);
glVertex3d(18.0f, -0.9f, 18.0f);
glEnd();

glPopMatrix();



// Tockovi
glBindTexture(GL_TEXTURE_2D, textures[TEXTURE_RUBBER]);
glEnable(GL_TEXTURE_GEN_S);
glEnable(GL_TEXTURE_GEN_T);
glNormal3f(1.0f, 1.0f, 1.0f);
glColor3ub(255, 255,255);
glPushMatrix();
// TODO 2: Nacrtati tockove koriscenjem DL mehanizma:
// tocak 1 na poziciji (-2, -0.55, 1.0)
glTranslatef(-2, -0.60, 1.0);
DrawWheel();
// tocak 2 na poziciji (-1.2, -0.55, 1.0)
glTranslatef(4, -0.04, -0.08);
DrawWheel();
//// tocak 3 na poziciji (1.6, -0.55, 1.0)
glTranslatef(-3.0, 0.09, -0.01);
DrawWheel();
//// tocak 4 na poziciji (1.6, -0.55, -1.0)
glRotatef(180,0.0,1.0,0.0);
glTranslatef(1.0, -0.05, 1.9);
DrawWheel();
//// tocak 5 na poziciji (-1.2, -0.55, -1.0)

glTranslatef(-1.0, -0.05, -0.05);
DrawWheel();
//// tocak 6 na poziciji (-2, -0.55, -1.0)
glTranslatef(-2.95, -0.05, -0.05);
DrawWheel();

glDisable(GL_TEXTURE_GEN_S);
glDisable(GL_TEXTURE_GEN_T);
glPopMatrix();





// Osnova tela dizalice

glBindTexture(GL_TEXTURE_2D, textures[TEXTURE_CRAN]);

glEnable(GL_TEXTURE_GEN_S);
glEnable(GL_TEXTURE_GEN_T);
glColor3ub(255, 255, 255);
glPushMatrix();
glTranslatef(-1.55f, -0.35f, 0.0f);
glScaled(2.4f, 0.6f, 2.0f);
glutSolidCube(1.0);
glPopMatrix();
glColor3ub(255, 255, 255);
glPushMatrix();
glTranslatef(0.3f, -0.35f, 0.0f);
glScaled(1.4f, 0.4f, 1.7f);
glutSolidCube(1.0);
glPopMatrix();
glColor3ub(255, 255, 255);
glPushMatrix();
glTranslatef(1.65f, -0.35f, 0.0f);
glScaled(1.5f, 0.6f, 2.0f);

glutSolidCube(1.0);
glDisable(GL_TEXTURE_GEN_S);
glDisable(GL_TEXTURE_GEN_T);
glPopMatrix();


// Nosac dizalice
glBindTexture(GL_TEXTURE_2D, textures[TEXTURE_CRAN]);
glEnable(GL_TEXTURE_GEN_S);
glEnable(GL_TEXTURE_GEN_T);
glColor3ub(255, 255, 255);
glPushMatrix();
glTranslatef(-1.55f, 0.25f, 0.0f);
glScaled(2.0f, 0.6f, 1.8f);
glutSolidCube(1.0);
glDisable(GL_TEXTURE_GEN_S);
glDisable(GL_TEXTURE_GEN_T);
glPopMatrix();

// Kran dizalice
glBindTexture(GL_TEXTURE_2D, textures[TEXTURE_CRAN]);
glEnable(GL_TEXTURE_GEN_S);
glEnable(GL_TEXTURE_GEN_T);
glColor3ub(255, 255, 255);
glPushMatrix();
glTranslatef(-1.6f, 0.65f, -0.8f);

// Osnova krana dizalice (valjak)

// TODO 2: Nacrtati valjak poluprecnika 0.6 i visine 0.5, koristiti g_gluObj promenljivu
gluCylinder(g_gluObj, 0.6, 0.6, 0.5, 64, 64);

glFrontFace(GL_CW);

// TODO 2: Nacrtati krug poluprecnika 0.6, koristiti g_gluObj promenljivu
gluDisk(g_gluObj,0.0,0.6,64,64);

glFrontFace(GL_CCW);

// TODO 2: Nacrtati krug poluprecnika 0.6 na dubini od 0.5 po z-osi, koristiti g_gluObj promenljivu
glTranslated(0, 0, 0.5); //translacija po z-osi
gluDisk(g_gluObj,0.0,0.6,64,64);

// Spoljni kran
glBindTexture(GL_TEXTURE_2D, textures[TEXTURE_CRAN]);
glColor3ub(255, 255, 255);
glPushMatrix();

// TODO 2: Nacrtati spoljni kran kao kvadar sirine 3.2, visine 0.5 i dubine 0.4 na poziciji (1.6, 0.2, -0.2)

glTranslatef(1.6,0.2,-0.2);
glScaled(3.2f, 0.5f, 0.4f);
glutSolidCube(1.0);
glDisable(GL_TEXTURE_GEN_S);
glDisable(GL_TEXTURE_GEN_T);
glPopMatrix();


// Unutrasnji kran (extensor)
glBindTexture(GL_TEXTURE_2D, textures[TEXTURE_ZID]);
glEnable(GL_TEXTURE_GEN_S);
glEnable(GL_TEXTURE_GEN_T);
glColor3ub(255, 255, 255);
glPushMatrix();

// TODO 2: Nacrtati unutrasnji kran kao kvadar sirine 3.2, visine 0.35 i dubine 0.28 na poziciji (3.2, 0.2, -0.2)

glNormal3f(1.0, 1.0, 1.0);
glTranslatef(3.2, 0.2, -0.2);
glScaled(3.2, 0.35, 0.28);
glutSolidCube(1);
glDisable(GL_TEXTURE_GEN_S);
glDisable(GL_TEXTURE_GEN_T);
glPopMatrix();

// Kuka
glColor3ub(255, 0, 0);
glPushMatrix();

// TODO 2: Translirati za (4.5, -0.2, -0.25), zatim skalirati 0.6 puta po x i y osama, zatim rotirati -90 stepeni oko x-ose
glTranslated(4.5, -0.2, -0.25);
glScaled(0.6, 0.6, 0);
glRotated(-90, 1, 0, 0);

gluCylinder(g_gluObj, 0.05, 0.05, 0.5, 64, 64);

// TODO 2: Translirati za (-0.15, 0, -0.15), zatim rotirati 45 stepeni oko y-ose
glTranslated(-0.15, 0, -0.15);
glRotated(45, 0, 1, 0);

gluCylinder(g_gluObj, 0.05, 0.05, 0.25, 64, 64);

// TODO 2: Translirati za (-0.05, 0, 0), zatim rotirati 100 stepeni oko y-ose
glTranslated(-0.05, 0, 0);
glRotated(100, 0, 1, 0);

gluCylinder(g_gluObj, 0.05, 0.05, 0.3, 64, 64);

// TODO 2: Translirati za (-0.35, 0, 0.35), zatim rotirati 90 stepeni oko y-ose
glTranslated(-0.35, 0, 0.35);
glRotated(90, 0, 1, 0);

gluCylinder(g_gluObj, 0.05, 0.05, 0.4, 64, 64);
glPopMatrix();
glPopMatrix();

// Kabina dizalice
glBindTexture(GL_TEXTURE_2D, textures[TEXTURE_GLASS]);
glColor3ub(255, 255, 255);
glPushMatrix();
glTranslatef(-2.0f, 0.55f, 0.8f);

// TODO 2: Nacrtati kabinu koriscenjem GL_QUADS primitive
// temena su (u pravilnom redosledu): (0.1f, 1.0f, 0.0f), (0.0f, 0.0f, 0.0f), (1.2f, 0.0f, 0.0f), (0.9f, 1.0f, 0.0f),
// (1.2f, 0.0f, 0.0f), (1.2f, 0.0f, -0.6f), (0.9f, 1.0f, -0.6f), (0.9f, 1.0f, 0.0f),
// (0.9f, 1.0f, -0.6f), (1.2f, 0.0f, -0.6f), (0.0f, 0.0f, -0.6f), (0.1f, 1.0f, -0.6f),
// (0.1f, 1.0f, -0.6f), (0.0f, 0.0f, -0.6f), (0.0f, 0.0f, 0.0f), (0.1f, 1.0f, 0.0f),
// (0.1f, 1.0f, -0.6f), (0.1f, 1.0f, 0.0f), (0.9f, 1.0f, 0.0f), (0.9f, 1.0f, -0.6f).

glBegin(GL_QUADS);


glNormal3f(0.0f, 1.0f, 0.0f);
glTexCoord2f(0.0f, 1.0f);
glVertex3d(0.1f, 1.0f, 0.0f);
glTexCoord2f(1.0f, 1.0f);
glVertex3d(0.0f, 0.0f, 0.0f);
glTexCoord2f(1.0f, 0.0f);
glVertex3d(1.2f, 0.0f, 0.0f);
glTexCoord2f(0.0f, 0.0f);
glVertex3d(0.9f, 1.0f, 0.0f);

glEnd();

glBegin(GL_QUADS);
glNormal3f(0.0f, 1.0f, 0.0f);
glTexCoord2f(0.0f, 1.0f);
glVertex3d(1.2f, 0.0f, 0.0f);
glTexCoord2f(1.0f, 1.0f);
glVertex3d(1.2f, 0.0f, -0.6f);
glTexCoord2f(1.0f, 0.0f);
glVertex3d(0.9f, 1.0f, -0.6f);
glTexCoord2f(0.0f, 0.0f);
glVertex3d(0.9f, 1.0f, 0.0f);

glEnd();

glBegin(GL_QUADS);
glNormal3f(0.0f, 1.0f, 0.0f);
glTexCoord2f(0.0f, 1.0f);
glVertex3d(0.9f, 1.0f, -0.6f);
glTexCoord2f(1.0f, 1.0f);
glVertex3d(1.2f, 0.0f, -0.6f);
glTexCoord2f(1.0f, 0.0f);
glVertex3d(0.0f, 0.0f, -0.6f);
glTexCoord2f(0.0f, 0.0f);
glVertex3d(0.1f, 1.0f, -0.6f);

glEnd();

glBegin(GL_QUADS);
glNormal3f(0.0f, 1.0f, 0.0f);
glTexCoord2f(0.0f, 1.0f);
glVertex3d(0.1f, 1.0f, -0.6f);
glTexCoord2f(1.0f, 1.0f);
glVertex3d(0.0f, 0.0f, -0.6f);
glTexCoord2f(1.0f, 0.0f);
glVertex3d(0.0f, 0.0f, 0.0f);
glTexCoord2f(0.0f, 0.0f);
glVertex3d(0.1f, 1.0f, 0.0f);

glEnd();

glBegin(GL_QUADS);
glNormal3f(0.0f, 1.0f, 0.0f);
glTexCoord2f(0.0f, 1.0f);
glVertex3d(0.1f, 1.0f, -0.6f);
glTexCoord2f(1.0f, 1.0f);
glVertex3d(0.1f, 1.0f, 0.0f);
glTexCoord2f(1.0f, 0.0f);
glVertex3d(0.9f, 1.0f, 0.0f);
glTexCoord2f(0.0f, 0.0f);
glVertex3d(0.9f, 1.0f, -0.6f);

glEnd();

glPopMatrix();

// Kabina vozila
glPushMatrix();
glBindTexture(GL_TEXTURE_2D, textures[TEXTURE_GLASS]);

glBegin(GL_QUADS);

glNormal3f(1.0f, 1.0f, 1.0f);
glTexCoord2f(0.0f, 1.0f);
glVertex3f(1.2f, 0.9f, 1.0f);
glTexCoord2f(1.0f, 1.0f);
glVertex3f(1.2f, -0.1f, 1.0f);
glTexCoord2f(1.0f, 0.0f);
glVertex3f(2.4f, -0.1f, 1.0f);
glTexCoord2f(0.0f, 0.0f);
glVertex3f(2.1f, 0.9f, 1.0f);

glEnd();

glBegin(GL_QUADS);

glNormal3f(1.0f, 1.0f, 1.0f);
glTexCoord2f(0.0f, 1.0f);
glVertex3f(2.4f, -0.1f, 1.0f);
glTexCoord2f(1.0f, 1.0f);
glVertex3f(2.4f, -0.1f, 0.0f);
glTexCoord2f(1.0f, 0.0f);
glVertex3f(2.1f, 0.9f, 0.0f);
glTexCoord2f(0.0f, 0.0f);
glVertex3f(2.1f, 0.9f, 1.0f);

glEnd();

glBegin(GL_QUADS);
glNormal3f(1.0f, 1.0f, 1.0f);
glTexCoord2f(0.0f, 1.0f);
glVertex3f(2.1f, 0.9f, 0.0f);
glTexCoord2f(1.0f, 1.0f);
glVertex3f(2.4f, -0.1f, 0.0f);
glTexCoord2f(1.0f, 0.0f);
glVertex3f(1.2f, -0.1f, 0.0f);
glTexCoord2f(0.0f, 0.0f);
glVertex3f(1.2f, 0.9f, 0.0f);

glEnd();


glBegin(GL_QUADS);
glNormal3f(1.0f, 1.0f, 1.0f);
glTexCoord2f(0.0f, 1.0f);
glVertex3f(1.2f, 0.9f, 0.0f);
glTexCoord2f(1.0f, 1.0f);
glVertex3f(1.2f, -0.1f, 0.0f);
glTexCoord2f(1.0f, 0.0f);
glVertex3f(1.2f, -0.1f, 1.0f);
glTexCoord2f(0.0f, 0.0f);
glVertex3f(1.2f, 0.9f, 1.0f);

glEnd();

glBegin(GL_QUADS);
glNormal3f(1.0f, 1.0f, 1.0f);
glTexCoord2f(0.0f, 1.0f);
glVertex3f(1.2f, 0.9f, 0.0f);
glTexCoord2f(1.0f, 1.0f);
glVertex3f(1.2f, 0.9f, 1.0f);
glTexCoord2f(1.0f, 0.0f);
glVertex3f(2.1f, 0.9f, 1.0f);
glTexCoord2f(0.0f, 0.0f);
glVertex3f(2.1f, 0.9f, 0.0f);
glEnd();
glPopMatrix();



// Zgrada u izgradnji (skela)
glPushMatrix();

// TODO 3: Pozicionirati, skalirati i prikazati ucitani model zgrade u izgradnji (sa skelom) desno od dizalice (po x-osi).
glTranslatef(0.0f, 2.0f, -8.0f);
glRotatef(270,0.0,1.0,0.0);
glScalef(10.0, 10.0, 10.0);

DrawModel(g_model);

glPopMatrix();


// Restauriraj modelview matricu
glPopMatrix();
glutSwapBuffers();


}


//////////////////////////////////////////////////////////////////////
// Naziv: ChangeSize
// Namena: funkcija obradjuje promenu velicine prozora
// Parametri: nove dimenzije prozora
//////////////////////////////////////////////////////////////////////
void ChangeSize(int w, int h)

{ // Pozicija svetla iznad dizalice - ljubicaste boje
static GLfloat lightPos[] = {82.0f, 125.0f, -125.0f, 1.0f };
glLightfv(GL_LIGHT0, GL_POSITION, lightPos);


// TODO 1: Definisati viewport preko celog prozora

glViewport(0, 0, w, h);



// TODO 1: Definisati projekciju u perspektivi sa fov = 75.0, near = 1.0 i far = 20.0

glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(75.0, (GLdouble)w/h, 1.0, 20.0);

glLightfv(GL_LIGHT0, GL_POSITION, lightPos);
}


//////////////////////////////////////////////////////////////////////
// Naziv: SetupRenderingContext
// Namena: funkcija vrsi potrebne inicijalizacije pre pocetka
// GLUT petlje
//////////////////////////////////////////////////////////////////////
void SetupRenderingContext()

{
// Boja osvetljenja


GLfloat ambient[] = { 0.0f, 0.0f, 0.0f, 1.0f };
GLfloat diffuse[] = { 1.0f, 1.0f, 1.0f, 1.0f };
GLfloat specular[] = { 1.0f, 0.39f, 1.0f, 0.99f };
GLfloat smer[] = { 0.0f, 0.0f, 1.0f };

//GLfloat ambient[] = { 1.0f, 0.11f, 0.0f, 0.78f };
// GLfloat diffuse[] = { 0.37f, 0.0f, 0.43f, 0.99f };
// GLfloat specular[] = { 1.0f, 0.39f, 1.0f, 0.99f };
//

FIBITMAP* image = 0; // promenljiva u koju ucitavamo sadrzaj slike
int i;



glClearColor(0.0f, 0.0f, 1.2588f, 2.0f); // teget boja

// Ukljuci depth testing
glEnable(GL_DEPTH_TEST);
glEnable(GL_CULL_FACE);
glFrontFace(GL_CW);


glLightfv(GL_LIGHT0, GL_AMBIENT, ambient);
glLightfv(GL_LIGHT0,GL_DIFFUSE,diffuse);
glLightfv(GL_LIGHT0, GL_SPECULAR, specular);

// Reflektorski svetlosni izvor
glLightfv(GL_LIGHT0,GL_SPOT_DIRECTION,smer);
glLightf(GL_LIGHT0,GL_SPOT_CUTOFF, 50.0f);


glEnable(GL_LIGHT0);


//glEnable(GL_NORMALIZE); // automatska normalizacija

glEnable(GL_TEXTURE_2D);

// Ukljuci i podesi color tracking
glEnable(GL_COLOR_MATERIAL);
glColorMaterial(GL_FRONT, GL_AMBIENT_AND_DIFFUSE);




// Ukljuci automatsku normalizaciju nad normalama
glEnable(GL_NORMALIZE);


// Ucitaj slike i kreiraj teksture
glGenTextures(TEXTURE_COUNT, textures);
for (i = 0; i < TEXTURE_COUNT; ++i)
{
// Pridruzi teksturu odgovarajucem identifikatoru
glBindTexture(GL_TEXTURE_2D, textures[i]);

// TODO 1: Ucitaj sliku i podesi parametre teksture
image = LoadImageFromFile(textureFiles[i]);

if (image != 0)
{
gluBuild2DMipmaps(GL_TEXTURE_2D, 3, FreeImage_GetWidth(image),
FreeImage_GetHeight(image), GL_BGR_EXT,
GL_UNSIGNED_BYTE, FreeImage_GetBits(image));

// TODO 1: Podesiti texture filtre: max = linear, min=linear_mipmap_linear,
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);

glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);

FreeImage_Unload(image);


}
};

// Ukljuci generisanje koord. teksture



// TODO 1: Ukljuciti depth testing, back face culling
glEnable(GL_DEPTH_TEST);
glEnable(GL_CULL_FACE);

// TODO 1: Kreirati novi GLU objekat u promenljivu g_gluObj.
g_gluObj = gluNewQuadric();
gluQuadricNormals(g_gluObj, GLU_SMOOTH);



// TODO 3: Ucitati model zgrade u izgradnji (skele)
glPushMatrix();

g_model = LoadModel("Zgrada.obj",GL_TRUE, GL_TRUE);

// Ukljuci svetlosni izvor
glEnable(GL_LIGHT0);
glEnable(GL_LIGHTING);


glPopMatrix();

}

//////////////////////////////////////////////////////////////////////
// Naziv: Shutdown
// Namena: oslobadjanje resursa
//////////////////////////////////////////////////////////////////////
void Shutdown()
{
// TODO 1: Osloboditi alocirane resurse
gluDeleteQuadric(g_gluObj);
UnloadModel(g_model);
// Oslobodi teksture
glDeleteTextures(TEXTURE_COUNT, textures);

}


//////////////////////////////////////////////////////////////////////
// Naziv: SpecialKeys
// Namena: obrada specijalnih karaktera
// Parametri: key, x i y
//////////////////////////////////////////////////////////////////////
void SpecialKeys(int key, int x, int y)
{
switch (key)
{
case GLUT_KEY_UP:
g_rotationX -= 5.0f;
break;

case GLUT_KEY_DOWN:
g_rotationX += 5.0f;
break;

case GLUT_KEY_LEFT:
g_rotationY -= 5.0f;
break;

case GLUT_KEY_RIGHT:
g_rotationY += 5.0f;
};

glutPostRedisplay();
}


This my code, but i not see texture on my input model :/ Can you help me ?