API... what.

This is a discussion on API... what. within the Game Programming forums, part of the General Programming Boards category; I have started to learn Open GL.. but presently coding using a Win 32 Console mode.. That is in VC++... ...

  1. #1
    Its not rocket science vasanth's Avatar
    Join Date
    Jan 2002
    Posts
    1,683

    API... what.

    I have started to learn Open GL.. but presently coding using a Win 32 Console mode.. That is in VC++... so using Open GL with plance C/C++.. but most of the code i see is integrated with the WIN API to render in an Windows created by VC++.. I have no Idea bout the Win API.. do you recomend i learn it before proceeding with it.. or since i am interested in Open Gl.. shall i continue exploring Open GL in Console Mode programin using normal C/C++ syntax..

    What do you recomend and why...
    Thanx In advance
    Vasanth

  2. #2
    Registered User codingmaster's Avatar
    Join Date
    Sep 2002
    Posts
    309
    If you don't / or won't understand the windows api...

    You can use glut to create a window.... it's very simple....

    There are a lot of information about glut at www.opengl.org

    There is a link at www.gamedev.net to the RedBook (The OpenGL Programming Guide), which explains the usage of glut

  3. #3
    Registered User codingmaster's Avatar
    Join Date
    Sep 2002
    Posts
    309
    You can download glut here: http://www.xmission.com/~nate/glut/glut-3.7.6-bin.zip

    here is a simple example using glut:

    Code:
    #include <gl/glut.h>
    
    void display(void)
    {
    	glClear(GL_COLOR_BUFFER_BIT);
    	
    	glColor3f(1.0,1.0,1.0);
    
    	glBegin(GL_POLYGON);
    		glVertex3f(0.25,0.25,0.0);
    		glVertex3f(0.75,0.25,0.0);
    		glVertex3f(0.75,0.75,0.0);
    		glVertex3f(0.25,0.75,0.0);
    	glEnd();
    
    
    glFlush();
    }
    
    void init(void)
    {
    	glClearColor(0.0,0.0,0.0,0.0);
    
    	glMatrixMode(GL_PROJECTION);
    	glLoadIdentity();
    	glOrtho(0.0,1.0,0.0,1.0,-1.0,1.0);
    }
    
    int main(int argc, char** argv)
    {
    	glutInit(&argc,argv);
    	glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
    	glutInitWindowSize(300,300);
    	glutInitWindowPosition(0,0);
    	glutCreateWindow("My GLUT window for OpenGL");
    	init();
    	glutDisplayFunc(display);
    	glutMainLoop();
    return 0;
    }

  4. #4
    Crazy Fool Perspective's Avatar
    Join Date
    Jan 2003
    Location
    Canada
    Posts
    2,640
    you dont need to go so far as to "learn" the win32 api, just learn what you need (ie. how to set up a window) and learn more as you need it (menu's, etc...) thats what i did (... am doing)

    i can post/send you a copy of my window class, you just instantiate the class to get an openGL ready win32 api window

  5. #5
    Its not rocket science vasanth's Avatar
    Join Date
    Jan 2002
    Posts
    1,683
    well using the glaux library i am able to create windows.



    Code:
    # include <gl\alaux.h>
    # include <gl\gl.h>
    
    int main(void)
    {
    
    auxInitDisplayMode(AUX_DOUBLE|AUX_RGBA);
    auxInitPosition(100,100,300,300);
    auxInitWindow("My Window");
    
    //------------------------------------ etc etc
    //------------------------------------all other aux function gl function callin etc etc
    
    
    return 0;
    }

    But many people said that i should not use the aux library why is that.. what is wrong with the auxilary library and whats the advantage of using glut over aux to create windows etc etc....

    ANd any way thanx for the advice.. not gona learn win API just to learn OpenGL..

  6. #6
    carry on JaWiB's Avatar
    Join Date
    Feb 2003
    Location
    Seattle, WA
    Posts
    1,972
    I would suggest learning the basics of the Win API. I wouldn't worry to much about menus and junk, though, just stuff like get an idea of how it works and what the message loop is, etc
    "Think not but that I know these things; or think
    I know them not: not therefore am I short
    Of knowing what I ought."
    -John Milton, Paradise Regained (1671)

    "Work hard and it might happen."
    -XSquared

  7. #7
    Banned
    Join Date
    Jan 2003
    Posts
    1,708
    some of the things in the aux library are buggy, for example loading bitmaps. However it should be fine for what you have.

  8. #8
    RoD
    RoD is offline
    Redundantly Redundant RoD's Avatar
    Join Date
    Sep 2002
    Location
    Missouri
    Posts
    6,331
    I went ahead and learned WinAPI, and i think its a good idea because i personally do not perfer glut.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. platform specific API or C standard API
    By George2 in forum C Programming
    Replies: 1
    Last Post: 11-12-2007, 01:32 AM
  2. OpenSSL and Win32 SSL API :: SSL/TLS
    By kuphryn in forum Networking/Device Communication
    Replies: 0
    Last Post: 03-10-2004, 07:46 PM
  3. FILES in WinAPI
    By Garfield in forum Windows Programming
    Replies: 46
    Last Post: 10-02-2003, 07:51 PM
  4. OLE Clipboard :: Win32 API vs. MFC
    By kuphryn in forum Windows Programming
    Replies: 3
    Last Post: 08-11-2002, 06:57 PM
  5. pthread api vs win32 thread api
    By Unregistered in forum Windows Programming
    Replies: 1
    Last Post: 11-20-2001, 08:55 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21