Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 4 of 4

Thread: GLUT v WIN32

  1. #1
    Guest

    GLUT v WIN32

    I am somewhat new to OpenGL, and used Nehe's page as a starting site. Anyhow, I was wondering why himself <along with the apparent majority> favors winAPI over GLUT. I've converted quite a few of Nehe's examples to glut code, and there has been absolutely zero speed change, and about 500% visibility change.

    The winapi seems just silly. In almost every case the final source code is 50% or more smaller. So, with glut you have portability. Winapi, no portability. With glut you have very "visible" code. With winapi you have bundles of various CRAP <I actually took the time to learn a bit of it, when I found out of the default paremeters for window declaration has been outdated since win3.x, but microsoft has still not created an overloaded equivalent function without the useless parameter I became sick and threw out the idea of bothering with winapi>.

    Anyhow, what am I missing????

    Thanks.

  2. #2
    Guest

    Re: GLUT v WIN32

    Assuming somebody might respond with a one word answer: Flexibility. Could somebody please give code examples? I can't find anything glut can't mimic <and 10x easier>

  3. #3
    Member Regular Contributor
    Join Date
    Jul 2001
    Posts
    409

    Re: GLUT v WIN32

    Originally posted by haro:
    [B]Anyhow, what am I missing????
    B]
    Nothing, in my opinion ! GLUT does many things, it has an extremely fast "game mode" (often between +50% and +80% speed) and, as you say, it's portable. Did you know that some games on the market use it, e.g. Black and White ?

    One argument often choosen by those who favour the win32 api is that you are forced to return to it as soon as you've to do some advanced win32 message handling. But, if you're writing a game, you don't have to, because you run in fullscreen and you don't use windows' GUI !

    Morglum

  4. #4
    Guest

    Re: GLUT v WIN32

    Awesome! I did not know BnW used it. Anyhow, thought I would post the simple code I use for using glut, and kicking the console window.

    I know its simple, but after having no experience with win programming I was left dumbfounded for too long to mention with:
    Linking...
    LIBCD.lib(wincrt0.obj) : error LNK2001: unresolved external symbol _WinMain@16
    Debug/sdgsdg.exe : fatal error LNK1120: 1 unresolved externals
    Error executing link.exe.

    so hopefully it can help somebody else..


    #pragma comment (lib, "glaux.lib")

    #define WIN32_LEAN_AND_MEAN

    #include <windows.h>
    #include <GL/glut.h>
    #include <stdlib.h>
    #include <stdio.h>
    #include <math.h>
    #include <time.h>
    #include <GL/glaux.h>

    int main(void); //prototype main function
    int APIENTRY WinMain(HINSTANCE hInstance, //let windows do its thing
    HINSTANCE hPrevInstance,
    LPSTR lpCmdLine,
    int nCmdShow)
    {
    main(); //give control to main function
    return 0;
    }

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •