   Texture is not getting load?
  hi , i have two functions same like NEHE's tutorial int Gl_Engine::LoadTexture(StrArray strFileNames){int iSize = strFileNames.size();if(iSize<1){return 0;}memset(TextureImage,0,sizeof(void *)*10); //for(int Loop=0; Loop<iSize; Loop++){if(LoadBMPS((char*)strFileNames[Loop].c_str(),TextureImage[0])==FALSE){string strTmp = "Problem in loading file from ";strTmp+=strFileNames[Loop].c_str();MessageBox(NULL,strTmp.c_str(),"Error",MB_OK);}glGenTextures(1, &m_Texture[Loop]); // Create The Texture// Typical Texture Generation Using Data From The BitmapglBindTexture(GL_TEXTURE_2D, m_Texture[0]);glTexImage2D(GL_TEXTURE_2D, 0, 3, TextureImage[Loop]->sizeX, TextureImage[Loop]->sizeY, 0, GL_RGB,GL_UNSIGNED_BYTE, TextureImage[Loop]->data);}    glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR); // Linear FilteringglTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR); // Linear Filteringfor(int Loop2=0; Loop2<iSize; Loop2++){if (TextureImage[Loop2]) // If Texture Exists{if (TextureImage[Loop2]->data) // If Texture Image Exists{free(TextureImage[Loop2]->data); // Free The Texture Image Memory}free(TextureImage[Loop2]); // Free The Image Structure}}return 1;}BOOL Gl_Engine::LoadBMPS(char *szFileName, AUX_RGBImageRec *&r_RGBrec){FILE *pfile=NULL;if(!szFileName){return FALSE;}pfile= fopen(szFileName,"r");if(!pfile){return FALSE;}else{ fclose(pfile); //it was just used to check it if file exist or not AUX_RGBImageRec *Tmp_RGBrec= auxDIBImageLoad(szFileName); r_RGBrec= Tmp_RGBrec;}return TRUE;}and on Render function i am doing like , a rotating pyramid and a rotating cube with textureint Gl_Engine::DrawGLScene(GLvoid)// Here's Where We Do All The Drawing{glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);// Clear The Screen And The Depth BufferglLoadIdentity();// Reset The Current Modelview MatrixglTranslatef(-1.5f,0.0f,-6.0f);glRotatef(m_RotDeg++,0.0f,1.0f,0.0f);glBegin(GL_TRIANGLES); // Drawing Using TrianglesglColor3f(1.0f,0.0f,0.0f); // RedglVertex3f( 0.0f, 1.0f, 0.0f); // Top Of Triangle (Front)glColor3f(0.0f,1.0f,0.0f); // GreenglVertex3f(-1.0f,-1.0f, 1.0f); // Left Of Triangle (Front)glColor3f(0.0f,0.0f,1.0f); // BlueglVertex3f( 1.0f,-1.0f, 1.0f); // Right Of Triangle (Front)glColor3f(1.0f,0.0f,0.0f); // RedglVertex3f( 0.0f, 1.0f, 0.0f); // Top Of Triangle (Right)glColor3f(0.0f,0.0f,1.0f); // BlueglVertex3f( 1.0f,-1.0f, 1.0f); // Left Of Triangle (Right)glColor3f(0.0f,1.0f,0.0f); // GreenglVertex3f( 1.0f,-1.0f, -1.0f); // Right Of Triangle (Right)glColor3f(1.0f,0.0f,0.0f); // RedglVertex3f( 0.0f, 1.0f, 0.0f); // Top Of Triangle (Back)glColor3f(0.0f,1.0f,0.0f); // GreenglVertex3f( 1.0f,-1.0f, -1.0f); // Left Of Triangle (Back)glColor3f(0.0f,0.0f,1.0f); // BlueglVertex3f(-1.0f,-1.0f, -1.0f); // Right Of Triangle (Back)glColor3f(1.0f,0.0f,0.0f); // RedglVertex3f( 0.0f, 1.0f, 0.0f); // Top Of Triangle (Left)glColor3f(0.0f,0.0f,1.0f); // BlueglVertex3f(-1.0f,-1.0f,-1.0f); // Left Of Triangle (Left)glColor3f(0.0f,1.0f,0.0f); // GreenglVertex3f(-1.0f,-1.0f, 1.0f); // Right Of Triangle (Left)glEnd(); // Finished Drawing The TriangleglLoadIdentity();// Reset The Current Modelview MatrixglTranslatef(1.5f,0.0f,-6.0f); // Move Right 3 UnitsglRotatef(m_RotDeg2--,0.0f,1.0f,0.0f);glBindTexture(GL_TEXTURE_2D, m_Texture[0]); // Select Our TextureglBegin(GL_QUADS); // Draw A QuadglTexCoord2f(0.0f, 0.0f); glVertex3f(-1.0f, -1.0f, 1.0f); // Bottom Left Of The Texture and QuadglTexCoord2f(1.0f, 0.0f); glVertex3f( 1.0f, -1.0f, 1.0f); // Bottom Right Of The Texture and QuadglTexCoord2f(1.0f, 1.0f); glVertex3f( 1.0f, 1.0f, 1.0f); // Top Right Of The Texture and QuadglTexCoord2f(0.0f, 1.0f); glVertex3f(-1.0f, 1.0f, 1.0f); // Top Left Of The Texture and Quad// Back FaceglTexCoord2f(1.0f, 0.0f); glVertex3f(-1.0f, -1.0f, -1.0f); // Bottom Right Of The Texture andQuadglTexCoord2f(1.0f, 1.0f); glVertex3f(-1.0f, 1.0f, -1.0f); // Top Right Of The Texture and QuadglTexCoord2f(0.0f, 1.0f); glVertex3f( 1.0f, 1.0f, -1.0f); // Top Left Of The Texture and QuadglTexCoord2f(0.0f, 0.0f); glVertex3f( 1.0f, -1.0f, -1.0f); // Bottom Left Of The Texture and Quad// Top FaceglTexCoord2f(0.0f, 1.0f); glVertex3f(-1.0f, 1.0f, -1.0f); // Top Left Of The Texture and QuadglTexCoord2f(0.0f, 0.0f); glVertex3f(-1.0f, 1.0f, 1.0f); // Bottom Left Of The Texture and QuadglTexCoord2f(1.0f, 0.0f); glVertex3f( 1.0f, 1.0f, 1.0f); // Bottom Right Of The Texture and QuadglTexCoord2f(1.0f, 1.0f); glVertex3f( 1.0f, 1.0f, -1.0f); // Top Right Of The Texture and Quad// Bottom FaceglTexCoord2f(1.0f, 1.0f); glVertex3f(-1.0f, -1.0f, -1.0f); // Top Right Of The Texture and QuadglTexCoord2f(0.0f, 1.0f); glVertex3f( 1.0f, -1.0f, -1.0f); // Top Left Of The Texture and QuadglTexCoord2f(0.0f, 0.0f); glVertex3f( 1.0f, -1.0f, 1.0f); // Bottom Left Of The Texture and QuadglTexCoord2f(1.0f, 0.0f); glVertex3f(-1.0f, -1.0f, 1.0f); // Bottom Right Of The Texture and Quad// Right faceglTexCoord2f(1.0f, 0.0f); glVertex3f( 1.0f, -1.0f, -1.0f); // Bottom Right Of The Texture and QuadglTexCoord2f(1.0f, 1.0f); glVertex3f( 1.0f, 1.0f, -1.0f); // Top Right Of The Texture and QuadglTexCoord2f(0.0f, 1.0f); glVertex3f( 1.0f, 1.0f, 1.0f); // Top Left Of The Texture and QuadglTexCoord2f(0.0f, 0.0f); glVertex3f( 1.0f, -1.0f, 1.0f); // Bottom Left Of The Texture and Quad// Left FaceglTexCoord2f(0.0f, 0.0f); glVertex3f(-1.0f, -1.0f, -1.0f); // Bottom Left Of The Texture and QuadglTexCoord2f(1.0f, 0.0f); glVertex3f(-1.0f, -1.0f, 1.0f); // Bottom Right Of The Texture and QuadglTexCoord2f(1.0f, 1.0f); glVertex3f(-1.0f, 1.0f, 1.0f); // Top Right Of The Texture and QuadglTexCoord2f(0.0f, 1.0f); glVertex3f(-1.0f, 1.0f, -1.0f); // Top Left Of The Texture and QuadglEnd();return TRUE;// Everything Went OK }what could be the reason that its not loading the texture???Thanks in advance..   
  Did you call glEnable(GL_TEXTURE_2D)?   ;  What omgomghilol said, and even more issues with your Gl_Engine::LoadTexture function.You call glGenTextures on m_Texture[Loop], but bind m_Texture[0]. You should bind index Loop, not 0.glTexParameter sets texture parameters for the currently active texture object, which is a per-texture state, not a global state. The code you have, assuming you fix the first point, will set filtering for the last texture loaded only, leaving the other textures with default filtering (which requires mipmaps, which you aren't providing). Move the calls to glTexParameter inside the loop so you call it for each texture.;  thanks for the tips but it still didnt work , please help me to get solve....thanks and regardsnow i am posting my full code please let me know what am i doing wrong in it// Gl_Engine.cpp: implementation of the Gl_Engine class.////////////////////////////////////////////////////////////////////////#include "Gl_Engine.h"#include <stdio.h>//////////////////////////////////////////////////////////////////////// Construction/Destruction//////////////////////////////////////////////////////////////////////Gl_Engine::Gl_Engine(){m_hRC=NULL;m_RotDeg =m_RotDeg2 = 10;}Gl_Engine::~Gl_Engine(){}int Gl_Engine::InitGL(GLvoid){glShadeModel(GL_SMOOTH);// Enables Smooth ShadingglEnable(GL_TEXTURE_2D); // Enable Texture Mapping ( NEW )glClearColor(0.0f, 0.0f, 0.0f, 0.0f);// Black BackgroundglClearDepth(1.0f);// Depth Buffer SetupglEnable(GL_DEPTH_TEST);// Enables Depth TestingglDepthFunc(GL_LEQUAL);// The Type Of Depth Test To DoglHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);// Really Nice Perspective CalculationsStrArray tmpvar;tmpvar.push_back("D:\\Documents and Settings\\noman\\Desktop\\me and her.bmp");LoadTexture(tmpvar);return TRUE;// Initialization Went OK}int Gl_Engine::DrawGLScene(GLvoid)// Here's Where We Do All The Drawing{glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);// Clear The Screen And The Depth BufferglLoadIdentity();// Reset The Current Modelview MatrixglTranslatef(-1.5f,0.0f,-6.0f);glRotatef(m_RotDeg++,0.0f,1.0f,0.0f);glBegin(GL_TRIANGLES); // Drawing Using TrianglesglColor3f(1.0f,0.0f,0.0f); // RedglVertex3f( 0.0f, 1.0f, 0.0f); // Top Of Triangle (Front)glColor3f(0.0f,1.0f,0.0f); // GreenglVertex3f(-1.0f,-1.0f, 1.0f); // Left Of Triangle (Front)glColor3f(0.0f,0.0f,1.0f); // BlueglVertex3f( 1.0f,-1.0f, 1.0f); // Right Of Triangle (Front)glColor3f(1.0f,0.0f,0.0f); // RedglVertex3f( 0.0f, 1.0f, 0.0f); // Top Of Triangle (Right)glColor3f(0.0f,0.0f,1.0f); // BlueglVertex3f( 1.0f,-1.0f, 1.0f); // Left Of Triangle (Right)glColor3f(0.0f,1.0f,0.0f); // GreenglVertex3f( 1.0f,-1.0f, -1.0f); // Right Of Triangle (Right)glColor3f(1.0f,0.0f,0.0f); // RedglVertex3f( 0.0f, 1.0f, 0.0f); // Top Of Triangle (Back)glColor3f(0.0f,1.0f,0.0f); // GreenglVertex3f( 1.0f,-1.0f, -1.0f); // Left Of Triangle (Back)glColor3f(0.0f,0.0f,1.0f); // BlueglVertex3f(-1.0f,-1.0f, -1.0f); // Right Of Triangle (Back)glColor3f(1.0f,0.0f,0.0f); // RedglVertex3f( 0.0f, 1.0f, 0.0f); // Top Of Triangle (Left)glColor3f(0.0f,0.0f,1.0f); // BlueglVertex3f(-1.0f,-1.0f,-1.0f); // Left Of Triangle (Left)glColor3f(0.0f,1.0f,0.0f); // GreenglVertex3f(-1.0f,-1.0f, 1.0f); // Right Of Triangle (Left)glEnd(); // Finished Drawing The TriangleglLoadIdentity();// Reset The Current Modelview MatrixglTranslatef(1.5f,0.0f,-6.0f); // Move Right 3 UnitsglRotatef(m_RotDeg2--,0.0f,1.0f,0.0f);glBindTexture(GL_TEXTURE_2D, m_Texture[0]); // Select Our TextureglBegin(GL_QUADS); // Draw A QuadglTexCoord2f(0.0f, 0.0f); glVertex3f(-1.0f, -1.0f, 1.0f); // Bottom Left Of The Texture and QuadglTexCoord2f(1.0f, 0.0f); glVertex3f( 1.0f, -1.0f, 1.0f); // Bottom Right Of The Texture and QuadglTexCoord2f(1.0f, 1.0f); glVertex3f( 1.0f, 1.0f, 1.0f); // Top Right Of The Texture and QuadglTexCoord2f(0.0f, 1.0f); glVertex3f(-1.0f, 1.0f, 1.0f); // Top Left Of The Texture and Quad// Back FaceglTexCoord2f(1.0f, 0.0f); glVertex3f(-1.0f, -1.0f, -1.0f); // Bottom Right Of The Texture andQuadglTexCoord2f(1.0f, 1.0f); glVertex3f(-1.0f, 1.0f, -1.0f); // Top Right Of The Texture and QuadglTexCoord2f(0.0f, 1.0f); glVertex3f( 1.0f, 1.0f, -1.0f); // Top Left Of The Texture and QuadglTexCoord2f(0.0f, 0.0f); glVertex3f( 1.0f, -1.0f, -1.0f); // Bottom Left Of The Texture and Quad// Top FaceglTexCoord2f(0.0f, 1.0f); glVertex3f(-1.0f, 1.0f, -1.0f); // Top Left Of The Texture and QuadglTexCoord2f(0.0f, 0.0f); glVertex3f(-1.0f, 1.0f, 1.0f); // Bottom Left Of The Texture and QuadglTexCoord2f(1.0f, 0.0f); glVertex3f( 1.0f, 1.0f, 1.0f); // Bottom Right Of The Texture and QuadglTexCoord2f(1.0f, 1.0f); glVertex3f( 1.0f, 1.0f, -1.0f); // Top Right Of The Texture and Quad// Bottom FaceglTexCoord2f(1.0f, 1.0f); glVertex3f(-1.0f, -1.0f, -1.0f); // Top Right Of The Texture and QuadglTexCoord2f(0.0f, 1.0f); glVertex3f( 1.0f, -1.0f, -1.0f); // Top Left Of The Texture and QuadglTexCoord2f(0.0f, 0.0f); glVertex3f( 1.0f, -1.0f, 1.0f); // Bottom Left Of The Texture and QuadglTexCoord2f(1.0f, 0.0f); glVertex3f(-1.0f, -1.0f, 1.0f); // Bottom Right Of The Texture and Quad// Right faceglTexCoord2f(1.0f, 0.0f); glVertex3f( 1.0f, -1.0f, -1.0f); // Bottom Right Of The Texture and QuadglTexCoord2f(1.0f, 1.0f); glVertex3f( 1.0f, 1.0f, -1.0f); // Top Right Of The Texture and QuadglTexCoord2f(0.0f, 1.0f); glVertex3f( 1.0f, 1.0f, 1.0f); // Top Left Of The Texture and QuadglTexCoord2f(0.0f, 0.0f); glVertex3f( 1.0f, -1.0f, 1.0f); // Bottom Left Of The Texture and Quad// Left FaceglTexCoord2f(0.0f, 0.0f); glVertex3f(-1.0f, -1.0f, -1.0f); // Bottom Left Of The Texture and QuadglTexCoord2f(1.0f, 0.0f); glVertex3f(-1.0f, -1.0f, 1.0f); // Bottom Right Of The Texture and QuadglTexCoord2f(1.0f, 1.0f); glVertex3f(-1.0f, 1.0f, 1.0f); // Top Right Of The Texture and QuadglTexCoord2f(0.0f, 1.0f); glVertex3f(-1.0f, 1.0f, -1.0f); // Top Left Of The Texture and QuadglEnd();return TRUE;// Everything Went OK }int Gl_Engine::CreateGlContext(HDC &r_hdc){if (!(m_hRC=wglCreateContext(r_hdc)))// Are We Able To Get A Rendering Context?{MessageBox(NULL,"Can't Create A GL Rendering Context.","ERROR",MB_OK|MB_ICONEXCLAMATION);return FALSE;// Return FALSE}if(!wglMakeCurrent(r_hdc,m_hRC))// Try To Activate The Rendering Context{MessageBox(NULL,"Can't Activate The GL Rendering Context.","ERROR",MB_OK|MB_ICONEXCLAMATION);return FALSE;// Return FALSE}return TRUE;}void Gl_Engine::CloseGl_Engine(){if (!wglMakeCurrent(NULL,NULL))// Are We Able To Release The DC And RC Contexts?{MessageBox(NULL,"Release Of DC And RC Failed.","SHUTDOWN ERROR",MB_OK | MB_ICONINFORMATION);}if (!wglDeleteContext(m_hRC))// Are We Able To Delete The RC?{MessageBox(NULL,"Release Rendering Context Failed.","SHUTDOWN ERROR",MB_OK | MB_ICONINFORMATION);}this->m_hRC=NULL;}void Gl_Engine::ReSizeGLScene(GLsizei width, GLsizei height)// Resize And Initialize The GL Window{if (height==0)// Prevent A Divide By Zero By{height=1;// Making Height Equal One}glViewport(0, 0, width, height);// Reset The Current ViewportglMatrixMode(GL_PROJECTION);// Select The Projection MatrixglLoadIdentity();// Reset The Projection Matrix// Calculate The Aspect Ratio Of The WindowgluPerspective(45.0f,(GLfloat)width/(GLfloat)height,0.1f,100.0f);glMatrixMode(GL_MODELVIEW);// Select The Modelview MatrixglLoadIdentity();// Reset The Modelview Matrix}int Gl_Engine::LoadTexture(StrArray strFileNames){int iSize = strFileNames.size();if(iSize<1){return 0;}memset(TextureImage,0,sizeof(void *)*10); //for(int Loop=0; Loop<iSize; Loop++){if(LoadBMPS((char*)strFileNames[Loop].c_str(),TextureImage[0])==FALSE){string strTmp = "Problem in loading file from ";strTmp+=strFileNames[Loop].c_str();MessageBox(NULL,strTmp.c_str(),"Error",MB_OK);}glGenTextures(1, &m_Texture[Loop]); // Create The Texture// Typical Texture Generation Using Data From The BitmapglBindTexture(GL_TEXTURE_2D, m_Texture[Loop]);glTexImage2D(GL_TEXTURE_2D, 0, 3, TextureImage[Loop]->sizeX, TextureImage[Loop]->sizeY, 0, GL_RGB,GL_UNSIGNED_BYTE, TextureImage[Loop]->data);glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR); // Linear FilteringglTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR); // Linear Filtering}    for(int Loop2=0; Loop2<iSize; Loop2++){if (TextureImage[Loop2]) // If Texture Exists{if (TextureImage[Loop2]->data) // If Texture Image Exists{free(TextureImage[Loop2]->data); // Free The Texture Image Memory}free(TextureImage[Loop2]); // Free The Image Structure}}return 1;}BOOL Gl_Engine::LoadBMPS(char *szFileName, AUX_RGBImageRec *&r_RGBrec){FILE *pfile=NULL;if(!szFileName){return FALSE;}pfile= fopen(szFileName,"r");if(!pfile){return FALSE;}else{ fclose(pfile); //it was just used to check it if file exist or not AUX_RGBImageRec *Tmp_RGBrec= auxDIBImageLoad(szFileName); r_RGBrec= Tmp_RGBrec;}return TRUE;};  Check the texture size. Unless you have OpenGL 2.0 or the ARB_texture_non_power_of_two extension present, texture dimensionsmust be a power of two.And you still have an issue with the texturing code, although not enough to cause the texture to not appear. You enable texturing once at the init stage, but one of the object doesn't looks like it should be textured. When you draw the first object, you have texturing enabled so texturing will be applied, but you don't provide any texture coordinates, nor do you bind a texture, so texturing is pretty much undefined for that object.What you want to do is enable texturing only when you need it.// first objectglBegin(GL_TRIANGLE);...glEnd();// second objectglBindTexture(...);glEnable(GL_TEXTURE_2D);glBegin(GL_TRIANGLE);...glEnd();glDisable(GL_TEXTURE_2D);Don't enable a state globally if it isn't a global state. Texturing in this case  is not something you want at all times, only sometimes.And also check that the init function is called after the window is set up and ready for rendering, not before.   ;  Thanks Brother Bob,i got it , the problem was inside the bmp , after i used the NEHE bm[ ot works while the bmp that i created doesnt work so it must be the power of 2. Plus texture enable and disable was also needed in this scenario..thanks again for your time regards   