   unresolved external symbol _auxDIBImageLoadA@4
  having this problem for a while now.here's the code.[#include &lt;windows.h&gt;// Header File For Windows#include &lt;gl\glut.h&gt;// Header File For The GLu32 Library#include &lt;gl\gl.h&gt;#include &lt;gl\glu.h&gt;#include &lt;gl\glaux.h&gt;#include &lt;fstream.h&gt;#include &lt;stdlib.h&gt;#include &lt;math.h&gt;HDChDC=NULL;// Private GDI Device ContextHGLRChRC=NULL;// Permanent Rendering ContextHWNDhWnd=NULL;// Holds Our Window HandleHINSTANCEhInstance;// Holds The Instance Of The ApplicationGLuint g_textureID = -1;boolkeys[256];// Array Used For The Keyboard Routineboolactive=TRUE;// Window Active Flag Set To TRUE By Defaultboolfullscreen=TRUE;// Fullscreen Flag Set To Fullscreen Mode By Default#define ID_TIMER 1bool Attenuate = FALSE;float xRot = -30, yRot=0, increment=1;float yAngLig = 0, radius1 = 10.0, radius2 = 10.0, Ang=0;int Widths[] = {640, 800, 1024, 1280, 1600, 1680};int Heights[] = {480, 600, 768, 800, 1200, 1050};float light0_position[] = { .0, 2.0, 0.0, 1.0 };float light0_color[] = { 1.0, 0.0, 0.0, 1.0 };float light1_position[] = { 0.0, 2.0, 0.0, 1.0 };float light1_color[] = { 0.0, 1.0, 0, 1.0 };float light2_position[] = { 0.0, 2.0, 0.0, 1.0 };float light2_color[] = { 0.0, 0.0, 1.0, 1.0 };int choice;struct Vertex{    // GL_T2F_V3F    float tu, tv;    float x, y, z;};Vertex g_quadVertices[] ={    { 0.0f,0.0f, -1.0f,-1.0f, 0.0f },    { 1.0f,0.0f,  1.0f,-1.0f, 0.0f },    { 1.0f,1.0f,  1.0f, 1.0f, 0.0f },    { 0.0f,1.0f, -1.0f, 1.0f, 0.0f }};LRESULTCALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);// Declaration For WndProcint get_Res_Choice(){//ifstream infile("Res_Choice.txt");//infile &gt;&gt; choice;choice=3;return choice;}int Set_Width(){get_Res_Choice(); int SCR_WIDTH = Widths[get_Res_Choice()];return SCR_WIDTH;}int Set_Height(){get_Res_Choice();int SCR_HEIGHT = Heights[get_Res_Choice()];return SCR_HEIGHT;}void loadTexture(void){AUX_RGBImageRec *pTextureImage = auxDIBImageLoad( "woodfloor.bmp" );    if( pTextureImage != NULL ){   glGenTextures( 1, &g_textureID );glBindTexture( GL_TEXTURE_2D, g_textureID );glTexParameteri( GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER, GL_LINEAR );glTexParameteri( GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER, GL_LINEAR );glTexImage2D( GL_TEXTURE_2D, 0, 3, pTextureImage-&gt;sizeX, pTextureImage-&gt;sizeY, 0,GL_RGB, GL_UNSIGNED_BYTE, pTextureImage-&gt;data );}if( pTextureImage ){if( pTextureImage-&gt;data )free( pTextureImage-&gt;data );free( pTextureImage );}}void Update_Light_Positions(){light0_position[0] = radius1 * cos(yAngLig);light0_position[2] = radius2 * sin(yAngLig);light1_position[0] = radius1 * cos(yAngLig/2);light1_position[2] = radius2 * sin(yAngLig/2);light2_position[0] = radius1 * cos(yAngLig/4);light2_position[2] = radius2 * sin(yAngLig/4);yAngLig+=0.02;}void BP_Draw_Light0(){glEnable(GL_LIGHT0);glLightfv(GL_LIGHT0, GL_POSITION, light0_position);glLightfv(GL_LIGHT0, GL_DIFFUSE, light0_color);if(Attenuate==TRUE){ glLightf(GL_LIGHT0, GL_CONSTANT_ATTENUATION, 0.1);glLightf(GL_LIGHT0, GL_LINEAR_ATTENUATION, 0.1);glLightf(GL_LIGHT0, GL_QUADRATIC_ATTENUATION, 0.1);}glDisable(GL_LIGHTING);glColor3fv(light0_color );glTranslatef(light0_position[0], light0_position[1], light0_position[2]);glutSolidSphere(0.2, 8, 8);glTranslatef(-light0_position[0], -light0_position[1], -light0_position[2]);glEnable(GL_LIGHTING);}void BP_Draw_Light1(){glEnable(GL_LIGHT1);glLightfv(GL_LIGHT1, GL_POSITION, light1_position);glLightfv(GL_LIGHT1, GL_DIFFUSE, light1_color); if(Attenuate==TRUE){glLightf(GL_LIGHT1, GL_CONSTANT_ATTENUATION, 0.1);glLightf(GL_LIGHT1, GL_LINEAR_ATTENUATION, 0.1);glLightf(GL_LIGHT1, GL_QUADRATIC_ATTENUATION, 0.1);} glDisable(GL_LIGHTING);glColor3fv(light1_color);glTranslatef(light1_position[0], light1_position[1], light1_position[2]);glutSolidSphere(0.2, 8, 8);glTranslatef(-light1_position[0], -light1_position[1], -light1_position[2]);glEnable(GL_LIGHTING);}void BP_Draw_Light2(){glEnable(GL_LIGHT2);glLightfv(GL_LIGHT2, GL_POSITION, light2_position);glLightfv(GL_LIGHT2, GL_DIFFUSE, light2_color); if(Attenuate==TRUE){glLightf(GL_LIGHT2, GL_CONSTANT_ATTENUATION, 0.1);glLightf(GL_LIGHT2, GL_LINEAR_ATTENUATION, 0.1);glLightf(GL_LIGHT2, GL_QUADRATIC_ATTENUATION, 0.1);} glDisable(GL_LIGHTING);glColor3fv(light2_color);glTranslatef(light2_position[0], light2_position[1], light2_position[2]);glutSolidSphere(0.2, 8, 8);glTranslatef(-light2_position[0], -light2_position[1], -light2_position[2]);glEnable(GL_LIGHTING);}GLvoid ReSizeGLScene(GLsizei width, GLsizei height){glViewport(0,0,width,height);glMatrixMode(GL_PROJECTION);glLoadIdentity();gluPerspective(45.0f,(GLfloat)width/(GLfloat)height,0.1f,100.0f);glMatrixMode(GL_MODELVIEW);glLoadIdentity();}int InitGL(GLvoid){//loadTexture();glShadeModel(GL_SMOOTH);glClearColor(0.0f, 0.0f, 0.0f, 0.5f);glClearDepth(1.0f);glEnable(GL_DEPTH_TEST);glEnable(GL_CULL_FACE);glEnable(GL_LIGHTING);glEnable(GL_TEXTURE_2D);glDepthFunc(GL_LEQUAL);glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);return TRUE;}int DrawGLScene(GLvoid){glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);glLoadIdentity();gluLookAt(0, 20, 50, 0, 0, 0, 0, 1, 0);glRotatef(yRot, 1, 0, 0);glRotatef(xRot, 0, 1, 0);BP_Draw_Light0();BP_Draw_Light1();BP_Draw_Light2();    glScalef(10, 10, 10);glBindTexture( GL_TEXTURE_2D, g_textureID );    glInterleavedArrays( GL_T2F_V3F, 0, g_quadVertices );    glDrawArrays( GL_QUADS, 0, 4 );return TRUE;}GLvoid KillGLWindow(GLvoid)// Properly Kill The Window{if (fullscreen)// Are We In Fullscreen Mode?{ChangeDisplaySettings(NULL,0);// If So Switch Back To The DesktopShowCursor(TRUE);// Show Mouse Pointer}}BOOL CreateGLWindow(char* title, int width, int height, int bits, bool fullscreenflag){GLuintPixelFormat;// Holds The Results After Searching For A MatchWNDCLASSwc;// Windows Class StructureDWORDdwExstyle;// Window Extended styleDWORDdwstyle;// Window styleRECTWindowRect;// Grabs Rectangle Upper Left / Lower Right ValuesWindowRect.left=(long)0;// Set Left Value To 0WindowRect.right=(long)width;// Set Right Value To Requested WidthWindowRect.top=(long)0;// Set Top Value To 0WindowRect.bottom=(long)height;// Set Bottom Value To Requested Heightfullscreen=fullscreenflag;// Set The Global Fullscreen FlaghInstance= GetModuleHandle(NULL);// Grab An Instance For Our Windowwc.style= CS_HREDRAW | CS_VREDRAW | CS_OWNDC;// Redraw On Size, And Own DC For Window.wc.lpfnWndProc= (WNDPROC) WndProc;// WndProc Handles Messageswc.cbClsExtra= 0;// No Extra Window Datawc.cbWndExtra= 0;// No Extra Window Datawc.hInstance= hInstance;// Set The Instancewc.hIcon= LoadIcon(NULL, IDI_WINLOGO);// Load The Default Iconwc.hCursor= LoadCursor(NULL, IDC_ARROW);// Load The Arrow Pointerwc.hbrBackground= NULL;// No Background Required For GLwc.lpszMenuName= NULL;// We Don't Want A Menuwc.lpszClassName= "OpenGL";// Set The Class NameRegisterClass(&wc);if (fullscreen)// Attempt Fullscreen Mode?{DEVMODE dmScreenSettings;// Device Modememset(&dmScreenSettings,0,sizeof(dmScreenSettings));// Makes Sure Memory's CleareddmScreenSettings.dmSize=sizeof(dmScreenSettings);// Size Of The Devmode StructuredmScreenSettings.dmPelsWidth= width;// Selected Screen WidthdmScreenSettings.dmPelsHeight= height;// Selected Screen HeightdmScreenSettings.dmBitsPerPel= bits;// Selected Bits Per PixeldmScreenSettings.dmFields=DM_BITSPERPEL|DM_PELSWIDTH|DM_PELSHEIGHT;ChangeDisplaySettings(&dmScreenSettings,CDS_FULLSCREEN);}if (fullscreen)// Are We Still In Fullscreen Mode?{dwExstyle=WS_EX_APPWINDOW;// Window Extended styledwstyle=WS_POPUP;// Windows styleShowCursor(FALSE);// Hide Mouse Pointer}else{dwExstyle=WS_EX_APPWINDOW | WS_EX_WINDOWEDGE;// Window Extended styledwstyle=WS_OVERLAPPEDWINDOW;// Windows style}AdjustWindowRectEx(&WindowRect, dwstyle, FALSE, dwExstyle);// Adjust Window To True Requested Size// Create The Windowif (!(hWnd=CreateWindowEx(dwExstyle,// Extended style For The Window"OpenGL",// Class Nametitle,// Window Titledwstyle |// Defined Window styleWS_CLIPSIBLINGS |// Required Window styleWS_CLIPCHILDREN,// Required Window style0, 0,// Window PositionWindowRect.right-WindowRect.left,// Calculate Window WidthWindowRect.bottom-WindowRect.top,// Calculate Window HeightNULL,// No Parent WindowNULL,// No MenuhInstance,// InstanceNULL)))// Dont Pass Anything To WM_CREATE{KillGLWindow();// Reset The DisplayMessageBox(NULL,"Window Creation Error.","ERROR",MB_OK|MB_ICONEXCLAMATION);return FALSE;// Return FALSE}staticPIXELFORMATDESCRIPTOR pfd=// pfd Tells Windows How We Want Things To Be{sizeof(PIXELFORMATDESCRIPTOR),// Size Of This Pixel Format Descriptor1,// Version NumberPFD_DRAW_TO_WINDOW |// Format Must Support WindowPFD_SUPPORT_OPENGL |// Format Must Support OpenGLPFD_DOUBLEBUFFER,// Must Support Double BufferingPFD_TYPE_RGBA,// Request An RGBA Formatbits,// Select Our Color Depth0, 0, 0, 0, 0, 0,// Color Bits Ignored0,// No Alpha Buffer0,// Shift Bit Ignored0,// No Accumulation Buffer0, 0, 0, 0,// Accumulation Bits Ignored16,// 16Bit Z-Buffer (Depth Buffer)  0,// No Stencil Buffer0,// No Auxiliary BufferPFD_MAIN_PLANE,// Main Drawing Layer0,// Reserved0, 0, 0// Layer Masks Ignored};hDC=GetDC(hWnd);PixelFormat=ChoosePixelFormat(hDC,&pfd);SetPixelFormat(hDC,PixelFormat,&pfd);hRC=wglCreateContext(hDC);wglMakeCurrent(hDC,hRC);ShowWindow(hWnd,SW_SHOW);// Show The WindowSetForegroundWindow(hWnd);// Slightly Higher PrioritySetFocus(hWnd);// Sets Keyboard Focus To The WindowInitGL();ReSizeGLScene(width, height);// Set Up Our Perspective GL Screenreturn TRUE;// Success}LRESULT CALLBACK WndProc(HWNDhWnd,// Handle For This WindowUINTuMsg,// Message For This WindowWPARAMwParam,// Additional Message InformationLPARAMlParam)// Additional Message Information{switch (uMsg)// Check For Windows Messages{case WM_ACTIVATE:// Watch For Window Activate Message{SetTimer (hWnd, ID_TIMER, 10, NULL) ;if (!HIWORD(wParam))// Check Minimization State{active=TRUE;// Program Is Active}else{active=FALSE;// Program Is No Longer Active}return 0;// Return To The Message Loop}case WM_TIMER:{case ID_TIMER:{if(GetAsyncKeyState(VK_UP))yRot-=increment;if(GetAsyncKeyState(VK_DOWN))yRot+=increment;if(GetAsyncKeyState(VK_LEFT))xRot-=increment;if(GetAsyncKeyState(VK_RIGHT))xRot+=increment;Update_Light_Positions();}break;}case WM_SYSCOMMAND:// Intercept System Commands{switch (wParam)// Check System Calls{case SC_SCREENSAVE:// Screensaver Trying To Start?case SC_MONITORPOWER:// Monitor Trying To Enter Powersave?return 0;// Prevent From Happening}break;// Exit}case WM_CLOSE:// Did We Receive A Close Message?{PostQuitMessage(0);// Send A Quit Messagereturn 0;// Jump Back}case WM_KEYDOWN:// Is A Key Being Held Down?{keys[wParam] = TRUE;// If So, Mark It As TRUEreturn 0;// Jump Back}case WM_KEYUP:// Has A Key Been Released?{keys[wParam] = FALSE;// If So, Mark It As FALSEreturn 0;// Jump Back}case WM_SIZE:// Resize The OpenGL Window{ReSizeGLScene(LOWORD(lParam),HIWORD(lParam));  // LoWord=Width, HiWord=Heightreturn 0;// Jump Back}}// Pass All Unhandled Messages To DefWindowProcreturn DefWindowProc(hWnd,uMsg,wParam,lParam);}int WINAPI WinMain(HINSTANCEhInstance,// InstanceHINSTANCEhPrevInstance,// Previous InstanceLPSTRlpCmdLine,// Command Line ParametersintnCmdShow)// Window Show State{MSGmsg;// Windows Message StructureBOOLdone=FALSE;// Bool Variable To Exit Loop// Create Our OpenGL Windowif (!CreateGLWindow("NeHe's OpenGL Framework", Set_Width(), Set_Height(), 32, fullscreen)){return 0;// Quit If Window Was Not Created}while(!done)// Loop That Runs While done=FALSE{if (PeekMessage(&msg,NULL,0,0,PM_REMOVE))// Is There A Message Waiting?{if (msg.message==WM_QUIT)// Have We Received A Quit Message?{done=TRUE;// If So done=TRUE}else// If Not, Deal With Window Messages{TranslateMessage(&msg);// Translate The MessageDispatchMessage(&msg);// Dispatch The Message}}else// If There Are No Messages{// Draw The Scene.  Watch For ESC Key And Quit Messages From DrawGLScene()if (active)// Program Active?{if (keys[VK_ESCAPE])// Was ESC Pressed?{done=TRUE;// ESC Signalled A Quit}else// Not Time To Quit, Update Screen{DrawGLScene();// Draw The SceneSwapBuffers(hDC);// Swap Buffers (Double Buffering)}}}}// ShutdownKillGLWindow();// Kill The Windowreturn (msg.wParam);// Exit The Program}][Edited by - basudev1311 on August 11, 2006 8:17:33 AM]
  sorry about the long code.don't know how to do that code in a scroll box thing./*DONE*/[Edited by - basudev1311 on August 11, 2006 8:59:40 AM];  Posting of source code is covered in the FAQ.As you your problem you either want to link glaux.lib to your project or, better, replace the bitmap loading code with the glaux replacement code from the NeHe site.Σnigma   ;  Thanx a lot.I finally managed to get something textured.  Really Happy.But it runs quite slow. I think i'm really missing something. #include <windows.h>// Header File For Windows#include <gl\glut.h>// Header File For The GLu32 Library#include <gl\gl.h>#include <gl\glu.h>#include <gl\glaux.h>#include <fstream.h>#include <stdlib.h>#include <math.h>HDChDC=NULL;// Private GDI Device ContextHGLRChRC=NULL;// Permanent Rendering ContextHWNDhWnd=NULL;// Holds Our Window HandleHINSTANCEhInstance;// Holds The Instance Of The ApplicationGLuinttexture[1];boolkeys[256];// Array Used For The Keyboard Routineboolactive=TRUE;// Window Active Flag Set To TRUE By Defaultboolfullscreen=TRUE;// Fullscreen Flag Set To Fullscreen Mode By Default#define ID_TIMER 1bool Attenuate = FALSE;float xRot = -30, yRot=0, increment=1;float yAngLig = 0, radius1 = 10.0, radius2 = 10.0, Ang=0;int Widths[] = {640, 800, 1024, 1280, 1600, 1680};int Heights[] = {480, 600, 768, 800, 1200, 1050};float light0_position[] = { .0, 2.0, 0.0, 1.0 };float light0_color[] = { 1.0, 0.0, 0.0, 1.0 };float light1_position[] = { 0.0, 2.0, 0.0, 1.0 };float light1_color[] = { 0.0, 1.0, 0, 1.0 };float light2_position[] = { 0.0, 2.0, 0.0, 1.0 };float light2_color[] = { 0.0, 0.0, 1.0, 1.0 };int choice;struct Vertex{    // GL_T2F_V3F    float tu, tv;    float x, y, z;};Vertex g_quadVertices[] ={    { 0.0f,0.0f, -1.0f,-1.0f, 0.0f },    { 1.0f,0.0f,  1.0f,-1.0f, 0.0f },    { 1.0f,1.0f,  1.0f, 1.0f, 0.0f },    { 0.0f,1.0f, -1.0f, 1.0f, 0.0f }};LRESULTCALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);// Declaration For WndProcint get_Res_Choice(){//ifstream infile("Res_Choice.txt");//infile >> choice;choice=3;return choice;}int Set_Width(){get_Res_Choice(); int SCR_WIDTH = Widths[get_Res_Choice()];return SCR_WIDTH;}int Set_Height(){get_Res_Choice();int SCR_HEIGHT = Heights[get_Res_Choice()];return SCR_HEIGHT;}bool NeHeLoadBitmap(LPTSTR szFileName, GLuint &texid)// Creates Texture From A Bitmap File{HBITMAP hBMP;// Handle Of The BitmapBITMAPBMP;// Bitmap StructureglGenTextures(1, &texid);// Create The TexturehBMP=(HBITMAP)LoadImage(GetModuleHandle(NULL), szFileName, IMAGE_BITMAP, 0, 0, LR_CREATEDIBSECTION | LR_LOADFROMFILE );if (!hBMP)// Does The Bitmap Exist?return FALSE;// If Not Return FalseGetObject(hBMP, sizeof(BMP), &BMP);// Get The Object// hBMP:   Handle To Graphics Object// sizeof(BMP): Size Of Buffer For Object Information// &BMP:   Buffer For Object InformationglPixelStorei(GL_UNPACK_ALIGNMENT, 4);// Pixel Storage Mode (Word Alignment / 4 Bytes)// Typical Texture Generation Using Data From The BitmapglBindTexture(GL_TEXTURE_2D, texid);// Bind To The Texture IDglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);// Linear Min FilterglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);// Linear Mag FilterglTexImage2D(GL_TEXTURE_2D, 0, 3, BMP.bmWidth, BMP.bmHeight, 0, GL_BGR_EXT, GL_UNSIGNED_BYTE, BMP.bmBits);DeleteObject(hBMP);// Delete The Objectreturn TRUE;// Loading Was Successful}void Update_Light_Positions(){light0_position[0] = radius1 * cos(yAngLig);light0_position[2] = radius2 * sin(yAngLig);light1_position[0] = radius1 * cos(yAngLig/2);light1_position[2] = radius2 * sin(yAngLig/2);light2_position[0] = radius1 * cos(yAngLig/4);light2_position[2] = radius2 * sin(yAngLig/4);yAngLig+=0.02;}void BP_Draw_Light0(){glEnable(GL_LIGHT0);glLightfv(GL_LIGHT0, GL_POSITION, light0_position);glLightfv(GL_LIGHT0, GL_DIFFUSE, light0_color);if(Attenuate==TRUE){ glLightf(GL_LIGHT0, GL_CONSTANT_ATTENUATION, 0.1);glLightf(GL_LIGHT0, GL_LINEAR_ATTENUATION, 0.1);glLightf(GL_LIGHT0, GL_QUADRATIC_ATTENUATION, 0.1);}glDisable(GL_LIGHTING);glColor3fv(light0_color );glTranslatef(light0_position[0], light0_position[1], light0_position[2]);glutSolidSphere(0.2, 8, 8);glTranslatef(-light0_position[0], -light0_position[1], -light0_position[2]);glEnable(GL_LIGHTING);}void BP_Draw_Light1(){glEnable(GL_LIGHT1);glLightfv(GL_LIGHT1, GL_POSITION, light1_position);glLightfv(GL_LIGHT1, GL_DIFFUSE, light1_color); if(Attenuate==TRUE){glLightf(GL_LIGHT1, GL_CONSTANT_ATTENUATION, 0.1);glLightf(GL_LIGHT1, GL_LINEAR_ATTENUATION, 0.1);glLightf(GL_LIGHT1, GL_QUADRATIC_ATTENUATION, 0.1);} glDisable(GL_LIGHTING);glColor3fv(light1_color);glTranslatef(light1_position[0], light1_position[1], light1_position[2]);glutSolidSphere(0.2, 8, 8);glTranslatef(-light1_position[0], -light1_position[1], -light1_position[2]);glEnable(GL_LIGHTING);}void BP_Draw_Light2(){glEnable(GL_LIGHT2);glLightfv(GL_LIGHT2, GL_POSITION, light2_position);glLightfv(GL_LIGHT2, GL_DIFFUSE, light2_color); if(Attenuate==TRUE){glLightf(GL_LIGHT2, GL_CONSTANT_ATTENUATION, 0.1);glLightf(GL_LIGHT2, GL_LINEAR_ATTENUATION, 0.1);glLightf(GL_LIGHT2, GL_QUADRATIC_ATTENUATION, 0.1);} glDisable(GL_LIGHTING);glColor3fv(light2_color);glTranslatef(light2_position[0], light2_position[1], light2_position[2]);glutSolidSphere(0.2, 8, 8);glTranslatef(-light2_position[0], -light2_position[1], -light2_position[2]);glEnable(GL_LIGHTING);}GLvoid ReSizeGLScene(GLsizei width, GLsizei height){glViewport(0,0,width,height);glMatrixMode(GL_PROJECTION);glLoadIdentity();gluPerspective(45.0f,(GLfloat)width/(GLfloat)height,0.1f,100.0f);glMatrixMode(GL_MODELVIEW);glLoadIdentity();}int InitGL(GLvoid){NeHeLoadBitmap("woodfloor.bmp", texture[0]);glShadeModel(GL_SMOOTH);glClearColor(0.0f, 0.0f, 0.0f, 0.5f);glClearDepth(1.0f);glEnable(GL_DEPTH_TEST);glEnable(GL_CULL_FACE);//glEnable(GL_LIGHTING);glEnable(GL_TEXTURE_2D);glDepthFunc(GL_LEQUAL);glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);return TRUE;}int DrawGLScene(GLvoid){glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);glLoadIdentity();gluLookAt(0, 20, 50, 0, 0, 0, 0, 1, 0);glRotatef(yRot, 1, 0, 0);glRotatef(xRot, 0, 1, 0);    glScalef(10, 10, 10);glBindTexture( GL_TEXTURE_2D, texture[0] );    glInterleavedArrays( GL_T2F_V3F, 0, g_quadVertices );    glDrawArrays( GL_QUADS, 0, 4 );return TRUE;}GLvoid KillGLWindow(GLvoid)// Properly Kill The Window{if (fullscreen)// Are We In Fullscreen Mode?{ChangeDisplaySettings(NULL,0);// If So Switch Back To The DesktopShowCursor(TRUE);// Show Mouse Pointer}}BOOL CreateGLWindow(char* title, int width, int height, int bits, bool fullscreenflag){GLuintPixelFormat;// Holds The Results After Searching For A MatchWNDCLASSwc;// Windows Class StructureDWORDdwExStyle;// Window Extended StyleDWORDdwStyle;// Window StyleRECTWindowRect;// Grabs Rectangle Upper Left / Lower Right ValuesWindowRect.left=(long)0;// Set Left Value To 0WindowRect.right=(long)width;// Set Right Value To Requested WidthWindowRect.top=(long)0;// Set Top Value To 0WindowRect.bottom=(long)height;// Set Bottom Value To Requested Heightfullscreen=fullscreenflag;// Set The Global Fullscreen FlaghInstance= GetModuleHandle(NULL);// Grab An Instance For Our Windowwc.style= CS_HREDRAW | CS_VREDRAW | CS_OWNDC;// Redraw On Size, And Own DC For Window.wc.lpfnWndProc= (WNDPROC) WndProc;// WndProc Handles Messageswc.cbClsExtra= 0;// No Extra Window Datawc.cbWndExtra= 0;// No Extra Window Datawc.hInstance= hInstance;// Set The Instancewc.hIcon= LoadIcon(NULL, IDI_WINLOGO);// Load The Default Iconwc.hCursor= LoadCursor(NULL, IDC_ARROW);// Load The Arrow Pointerwc.hbrBackground= NULL;// No Background Required For GLwc.lpszMenuName= NULL;// We Don't Want A Menuwc.lpszClassName= "OpenGL";// Set The Class NameRegisterClass(&wc);if (fullscreen)// Attempt Fullscreen Mode?{DEVMODE dmScreenSettings;// Device Modememset(&dmScreenSettings,0,sizeof(dmScreenSettings));// Makes Sure Memory's CleareddmScreenSettings.dmSize=sizeof(dmScreenSettings);// Size Of The Devmode StructuredmScreenSettings.dmPelsWidth= width;// Selected Screen WidthdmScreenSettings.dmPelsHeight= height;// Selected Screen HeightdmScreenSettings.dmBitsPerPel= bits;// Selected Bits Per PixeldmScreenSettings.dmFields=DM_BITSPERPEL|DM_PELSWIDTH|DM_PELSHEIGHT;ChangeDisplaySettings(&dmScreenSettings,CDS_FULLSCREEN);}if (fullscreen)// Are We Still In Fullscreen Mode?{dwExStyle=WS_EX_APPWINDOW;// Window Extended StyledwStyle=WS_POPUP;// Windows StyleShowCursor(FALSE);// Hide Mouse Pointer}else{dwExStyle=WS_EX_APPWINDOW | WS_EX_WINDOWEDGE;// Window Extended StyledwStyle=WS_OVERLAPPEDWINDOW;// Windows Style}AdjustWindowRectEx(&WindowRect, dwStyle, FALSE, dwExStyle);// Adjust Window To True Requested Size// Create The Windowif (!(hWnd=CreateWindowEx(dwExStyle,// Extended Style For The Window"OpenGL",// Class Nametitle,// Window TitledwStyle |// Defined Window StyleWS_CLIPSIBLINGS |// Required Window StyleWS_CLIPCHILDREN,// Required Window Style0, 0,// Window PositionWindowRect.right-WindowRect.left,// Calculate Window WidthWindowRect.bottom-WindowRect.top,// Calculate Window HeightNULL,// No Parent WindowNULL,// No MenuhInstance,// InstanceNULL)))// Dont Pass Anything To WM_CREATE{KillGLWindow();// Reset The DisplayMessageBox(NULL,"Window Creation Error.","ERROR",MB_OK|MB_ICONEXCLAMATION);return FALSE;// Return FALSE}staticPIXELFORMATDESCRIPTOR pfd=// pfd Tells Windows How We Want Things To Be{sizeof(PIXELFORMATDESCRIPTOR),// Size Of This Pixel Format Descriptor1,// Version NumberPFD_DRAW_TO_WINDOW |// Format Must Support WindowPFD_SUPPORT_OPENGL |// Format Must Support OpenGLPFD_DOUBLEBUFFER,// Must Support Double BufferingPFD_TYPE_RGBA,// Request An RGBA Formatbits,// Select Our Color Depth0, 0, 0, 0, 0, 0,// Color Bits Ignored0,// No Alpha Buffer0,// Shift Bit Ignored0,// No Accumulation Buffer0, 0, 0, 0,// Accumulation Bits Ignored16,// 16Bit Z-Buffer (Depth Buffer)  0,// No Stencil Buffer0,// No Auxiliary BufferPFD_MAIN_PLANE,// Main Drawing Layer0,// Reserved0, 0, 0// Layer Masks Ignored};hDC=GetDC(hWnd);PixelFormat=ChoosePixelFormat(hDC,&pfd);SetPixelFormat(hDC,PixelFormat,&pfd);hRC=wglCreateContext(hDC);wglMakeCurrent(hDC,hRC);ShowWindow(hWnd,SW_SHOW);// Show The WindowSetForegroundWindow(hWnd);// Slightly Higher PrioritySetFocus(hWnd);// Sets Keyboard Focus To The WindowInitGL();ReSizeGLScene(width, height);// Set Up Our Perspective GL Screenreturn TRUE;// Success}LRESULT CALLBACK WndProc(HWNDhWnd,// Handle For This WindowUINTuMsg,// Message For This WindowWPARAMwParam,// Additional Message InformationLPARAMlParam)// Additional Message Information{switch (uMsg)// Check For Windows Messages{case WM_ACTIVATE:// Watch For Window Activate Message{SetTimer (hWnd, ID_TIMER, 10, NULL) ;if (!HIWORD(wParam))// Check Minimization State{active=TRUE;// Program Is Active}else{active=FALSE;// Program Is No Longer Active}return 0;// Return To The Message Loop}case WM_TIMER:{case ID_TIMER:{if(GetAsyncKeyState(VK_UP))yRot-=increment;if(GetAsyncKeyState(VK_DOWN))yRot+=increment;if(GetAsyncKeyState(VK_LEFT))xRot-=increment;if(GetAsyncKeyState(VK_RIGHT))xRot+=increment;Update_Light_Positions();}break;}case WM_SYSCOMMAND:// Intercept System Commands{switch (wParam)// Check System Calls{case SC_SCREENSAVE:// Screensaver Trying To Start?case SC_MONITORPOWER:// Monitor Trying To Enter Powersave?return 0;// Prevent From Happening}break;// Exit}case WM_CLOSE:// Did We Receive A Close Message?{PostQuitMessage(0);// Send A Quit Messagereturn 0;// Jump Back}case WM_KEYDOWN:// Is A Key Being Held Down?{keys[wParam] = TRUE;// If So, Mark It As TRUEreturn 0;// Jump Back}case WM_KEYUP:// Has A Key Been Released?{keys[wParam] = FALSE;// If So, Mark It As FALSEreturn 0;// Jump Back}case WM_SIZE:// Resize The OpenGL Window{ReSizeGLScene(LOWORD(lParam),HIWORD(lParam));  // LoWord=Width, HiWord=Heightreturn 0;// Jump Back}}// Pass All Unhandled Messages To DefWindowProcreturn DefWindowProc(hWnd,uMsg,wParam,lParam);}int WINAPI WinMain(HINSTANCEhInstance,// InstanceHINSTANCEhPrevInstance,// Previous InstanceLPSTRlpCmdLine,// Command Line ParametersintnCmdShow)// Window Show State{MSGmsg;// Windows Message StructureBOOLdone=FALSE;// Bool Variable To Exit Loop// Create Our OpenGL Windowif (!CreateGLWindow("NeHe's OpenGL Framework", Set_Width(), Set_Height(), 32, fullscreen)){return 0;// Quit If Window Was Not Created}while(!done)// Loop That Runs While done=FALSE{if (PeekMessage(&msg,NULL,0,0,PM_REMOVE))// Is There A Message Waiting?{if (msg.message==WM_QUIT)// Have We Received A Quit Message?{done=TRUE;// If So done=TRUE}else// If Not, Deal With Window Messages{TranslateMessage(&msg);// Translate The MessageDispatchMessage(&msg);// Dispatch The Message}}else// If There Are No Messages{// Draw The Scene.  Watch For ESC Key And Quit Messages From DrawGLScene()if (active)// Program Active?{if (keys[VK_ESCAPE])// Was ESC Pressed?{done=TRUE;// ESC Signalled A Quit}else// Not Time To Quit, Update Screen{DrawGLScene();// Draw The SceneSwapBuffers(hDC);// Swap Buffers (Double Buffering)}}}}// ShutdownKillGLWindow();// Kill The Windowreturn (msg.wParam);// Exit The Program}