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 8 of 8

Thread: Can I do OpenGL in Console programs ???

  1. #1
    Junior Member Newbie
    Join Date
    Feb 2004
    Location
    texas
    Posts
    11

    Can I do OpenGL in Console programs ???

    The sample tutorials are not Windows programs. They seem to be console programs. However when I try to compile them they do give an error in Visual C++ 6.0. I'm running WindowsXP.

    Can someone explain why I can't use OpenGL in console programs and why are the tutorial programs written like that?

    -AJ
    none

  2. #2
    Super Moderator OpenGL Guru dorbie's Avatar
    Join Date
    Jul 2000
    Location
    Bay Area, CA, USA
    Posts
    3,969

    Re: Can I do OpenGL in Console programs ???

    What error?

    What do you mean by console programs? main() vs winmain()?
    That won't be your problem.

  3. #3
    Junior Member Newbie
    Join Date
    Feb 2004
    Location
    arlington,tx usa
    Posts
    6

    Re: Can I do OpenGL in Console programs ???

    What sample programs are you talking about NeHe's are all windows programs. The red book uses glut wich creats a window as well.

  4. #4
    Junior Member Newbie
    Join Date
    Feb 2004
    Location
    texas
    Posts
    11

    Re: Can I do OpenGL in Console programs ???

    What do you mean by console programs? main() vs winman()?
    That is exactly what I mean.
    What error?
    I forgot what error it was, i can still get it for you if you want it.

    Can someone give me an OpenGL console program that will compile in Visual C++ 6.0 and run on WindowsXP.

    What sample programs are you talking about NeHe's are all windows programs.
    http://www.eecs.tulane.edu/www/Terry.../Hello_World.c
    none

  5. #5
    Junior Member Newbie
    Join Date
    Feb 2004
    Location
    texas
    Posts
    11

    Re: Can I do OpenGL in Console programs ???

    ok my program is like this:

    #include <gl\gl.h>

    void main()
    {
    }
    I get these errors:
    --------------------Configuration: openGlTEST - Win32 Debug--------------------
    Compiling...
    opengltest.cpp
    c:\microsoft visual studio\vc98\include\gl\gl.h(1152) : error C2144: syntax error : missing ';' before type 'void'
    c:\microsoft visual studio\vc98\include\gl\gl.h(1152) : error C2501: 'WINGDIAPI' : missing storage-class or type specifiers
    c:\microsoft visual studio\vc98\include\gl\gl.h(1152) : fatal error C1004: unexpected end of file found
    Error executing cl.exe.

    openGlTEST.exe - 3 error(s), 0 warning(s)
    none

  6. #6
    Member Regular Contributor
    Join Date
    Oct 2001
    Location
    Princeton, NJ
    Posts
    386

    Re: Can I do OpenGL in Console programs ???

    try including windows.h explicity before gl.h

  7. #7
    Senior Member OpenGL Guru
    Join Date
    Jun 2000
    Location
    Gastonia, NC, USA
    Posts
    2,070

    Re: Can I do OpenGL in Console programs ???

    This example is written for Linux X windows, not windows:
    Requires a library called Tk which may not be a version of it written for windows, need to check on it though.
    Also the examples on that webpage are also almost 7 years old.

    http://www.eecs.tulane.edu/www/Terry.../Hello_World.c [/B][/QUOTE]


    If you want a good source for openGL under windows, nehe.gamedev.net is a good resource.

    Your bit of code:

    #include <gl\gl.h>
    void main()
    {
    // You have a empty main with no window opening commands!
    }

    This is not enought code to do anything, you also need to have code in which to open a window. OpenGL has no windowing commands, it is strictly a drawing API. So you ether need to open a windows with Native windows code or a API like GLUT.




    [This message has been edited by nexusone (edited 02-04-2004).]

  8. #8
    Junior Member Newbie
    Join Date
    Feb 2004
    Location
    England
    Posts
    10

    Re: Can I do OpenGL in Console programs ???

    "This example is written for Linux X windows, not windows" - well, put it this way: that error is because windows gl headers depend on windows.h. If it is a linux program, then odds on it wont compile under VCPP as it lacks the Linux windowing headers etc.

    I don't mean this in a patronising way, but are you sure you have a windows port there?

Posting Permissions

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