   OpenGL Scene Won't Work
  Hello there! I am finally coming back to OpenGL after a break from programming all together. I never really got deep into programming in OpenGL except for copy NeHe's basecode and editing it for the fun of it. Now, I've just wrote basic code to display a triangle, to get the form of a basic OpenGL Window down again. My only problem is that the triangle is not being displayed... the window's fine.[SOURCE]#define WIN32_LEAN_AND_MEAN#include &lt;windows.h&gt;#include &lt;gl/gl.h&gt;#include &lt;gl/glu.h&gt;#include &lt;gl/glaux.h&gt;using namespace std;//Globalsstatic HGLRC  g_hRC;   // rendering contextstatic HDC    g_hDC;   // the device context// Rezize GL Scenevoid ResizeGLScene(int width, int height){    if(height = 0)  // dont want to divide by zero{height = 1;}   //reset viewport to new dimensionsglViewport(0, 0, width, height);glMatrixMode(GL_PROJECTION);    // select projection matrixglLoadIdentity();// reset projection matrix   // calculate aspect ratio of windowgluPerspective(45.0f, (GLfloat)width/(GLfloat)height, 1.0f, 1000.0f);   glMatrixMode(GL_MODELVIEW);glLoadIdentity();}// RenderGLScenevoid RenderGLScene(){float angle = 0.0f;   glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);glLoadIdentity();angle += 0.1f;if(angle &gt;= 360.0f){    angle = 0.0f;}glTranslatef(0.0f, 0.0f, -5.0f);glRotatef(angle, 0.0f, 0.0f, 0.0f); // rotate along z-axisglColor3f(1.0f, 1.0f, 1.0f);glBegin(GL_TRIANGLES);    glVertex3f(-1.0f,-1.0f, 0.0f);    glVertex3f( 1.0f,-1.0f, 0.0f);    glVertex3f( 0.0f, 1.0f, 0.0f);glEnd();SwapBuffers(g_hDC);}// Sets up the pixel format descriptorvoid SetupPixelFormat(HDC hDC){int nPixelFormat;static PIXELFORMATDESCRIPTOR pfd = { sizeof(PIXELFORMATDESCRIPTOR),  1,  PFD_DRAW_TO_WINDOW |  PFD_SUPPORT_OPENGL |  PFD_DOUBLEBUFFER,  PFD_TYPE_RGBA,  32,  0, 0, 0, 0, 0, 0,  0,  0,  0,  0, 0, 0, 0,  16,  0,  0,  PFD_MAIN_PLANE,  0,  0, 0, 0 };// Choose best matching pixel format, return indexnPixelFormat = ChoosePixelFormat(hDC, &pfd);// Set Pixel Format to Device ContextSetPixelFormat(hDC, nPixelFormat, &pfd);}LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam){   static HGLRC hRC;// rendering context   static HDC   hDC;// device context    switch(message)   {   case WM_CREATE: hDC = GetDC(hWnd);  // get current window's device context   g_hDC = hDC;   // set global device context to current   SetupPixelFormat(hDC);   // call pixel format setup function hRC = wglCreateContext(hDC);  // create rendering context   g_hRC = hRC;   wglMakeCurrent(hDC, hRC);// make it current return 0;   break; case WM_CLOSE: // deselect rendering context and delete it   wglMakeCurrent(hDC, NULL);   wglDeleteContext(hRC); PostQuitMessage(0); return 0;   break; case WM_SIZE: ResizeGLScene(LOWORD(lParam),HIWORD(lParam)); return 0;   break; default: break;   } return (DefWindowProc(hWnd, message, wParam, lParam));    //All unhandled messages   }// Main App Entryint WINAPI WinMain(HINSTANCEhInstance,    HINSTANCEhPrevInstance,    LPSTR    lpCmdLine,    int nCmdShow){    WNDCLASSEX windowClass;    // Window Class    char  lpszClassName[] = "MyClass";   // window class name    HWND  hWnd; // Window handle    MSG   msg;  // message    bool  done = FALSE;// flag saying when the app is complete   windowClass.cbSize   = sizeof(WNDCLASSEX);    windowClass.style    = CS_HREDRAW | CS_VREDRAW;    windowClass.lpfnWndProc   = WndProc;    windowClass.cbClsExtra    = 0;    windowClass.cbWndExtra    = 0;    windowClass.hInstance= hInstance;    windowClass.hIcon    = LoadIcon(NULL, IDI_APPLICATION);    windowClass.hCursor  = LoadCursor(NULL, IDC_ARROW);    windowClass.hbrBackground = NULL;    windowClass.lpszMenuName  = NULL;    windowClass.lpszClassName = lpszClassName;    windowClass.hIconSm  = LoadIcon(NULL, IDI_WINLOGO);  // Register Window Class    if(!RegisterClassEx(&windowClass))    {    MessageBox(NULL,"ERROR: Could not register window class!", "ERROR",MB_OK|MB_ICONEXCLAMATION);    return 0;    }   // Create Window    if(!(hWnd = CreateWindowEx(NULL,// Extended style lpszClassName, // Class Name "Default OpenGL Window App",// App name WS_OVERLAPPEDWINDOW |    // Window style Flags WS_VISIBLE | WS_SYSMENU | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, 100, 100, // X,Y Coordinates 400, 400, // Window Width, Height NULL,// handle to parent NULL,// handle to menu hInstance,// application instance NULL)))    // no extra params    {   MessageBox(NULL,"ERROR: Window could not be created!","ERROR",MB_OK|MB_ICONEXCLAMATION);   return 0;    }   ShowWindow(hWnd, SW_SHOW);    UpdateWindow(hWnd);// Main message loop    done = FALSE;   while(!done)    { PeekMessage(&msg, hWnd, NULL, NULL, PM_REMOVE);  if(msg.message == WM_QUIT)    // Receive a quit meesage? { done = TRUE; } else {    // do rendering here //RenderGLScene(); TranslateMessage(&msg);   // translatte and dispatch to event queueDispatchMessage(&msg); }    }    return msg.wParam;}[/SOURCE]
  sorry for posting again... i might as well go to the top of the list while saying what i think the problem is. I think its either the swapbuffers or rendering function... lol pretty obvious... but i get no errorsEDIT:: Nevermind the problem! I fixed it... it was the if(height == 0)... i had if(height = 0)... woops[Edited by - GL_aLpHa on June 9, 2006 11:15:33 PM]