Thread: OpenGL wont Render

  1. #1
    Politics&Cpp geek Da-Nuka's Avatar
    Join Date
    Oct 2004
    Posts
    104

    OpenGL wont Render

    Suddenly my OpenGL has stopped rendering...I cant figure out why..

    I have included the 3 files im using..

  2. #2
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,868
    Which line does it fail on?

    (use a debugger and watch the app run or add a messageboxes to tell you where the app is up to)
    Debugging is a skill you need to develop.

    If using MSVC then click the cursor on the first line of your WM_CREATE and press F9. A dot (red) should appear before the line (a break point). Run and the app should pause at this line. You can then press F10 to move one line at a time.

    When using InvalidateRect it is a good idea to follow with UpdateWindow(). This bypasses the OS message que and posts the paint message directly to your message loop.

    The code as posted is very hard to read due to lack of formatting. IMHO this will reduce your chance of getting much more help.

    Can you attach a zip with the files in it?
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

  3. #3
    Politics&Cpp geek Da-Nuka's Avatar
    Join Date
    Oct 2004
    Posts
    104
    I dont think I can use a debugger in this case.
    This isnt a syntax error, and OpenGL doesent FAIL at some point...
    It is a logical failure, that I think only can be discoverd by going thorugh the whole code.

    I havent found it yet though... Maybe I have forgotten a OpenGL command or something.

  4. #4
    Politics&Cpp geek Da-Nuka's Avatar
    Join Date
    Oct 2004
    Posts
    104
    I solved the problem...finally... After scanning my Initializing code for the 6th time.

    xSize=LOWORD(lParam);
    ySize=HIWORD(lParam);
    glViewport(0,0,cxClient,cyClient);
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    gluOrtho2D(0.0, cxClient, 0.0, cyClient);
    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();
    glDisable(GL_CULL_FACE);
    glEnable(GL_TEXTURE_2D);
    glDisable(GL_DEPTH_TEST);
    glDisable(GL_ALPHA_TEST);
    glEnable(GL_BLEND);
    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
    glDisable(GL_FOG);

    I needed to insert "xSize" and "ySize" instead of "cxClient" and "cyClient". Noobish

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. OpenGL Window
    By Morgul in forum Game Programming
    Replies: 1
    Last Post: 05-15-2005, 12:34 PM
  2. render OpenGL geomatry on dialog box button press
    By psychopath in forum Windows Programming
    Replies: 0
    Last Post: 08-20-2004, 08:49 PM
  3. proper way to render particles (OpenGL)
    By ... in forum Game Programming
    Replies: 2
    Last Post: 03-29-2004, 10:45 PM
  4. OpenGL .dll vs video card dll
    By Silvercord in forum Game Programming
    Replies: 14
    Last Post: 02-12-2003, 07:57 PM
  5. opengl code not working
    By Unregistered in forum Windows Programming
    Replies: 4
    Last Post: 02-14-2002, 10:01 PM