Results 1 to 4 of 4

Thread: simple openGL question

  1. #1
    Junior Member Newbie
    Join Date
    Feb 2001

    simple openGL question

    This is the main body of an example problem i got out of an opengl book:

    int main (int argc, char** argv)


    glutInit(&argc, argv);

    glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB);

    glutInitWindowSize(250, 250);

    glutInitWindowPosition(100, 100);







    return 0;


    I was just wondering if anyone could tell me the function of
    (int argc, char** argv) being passed into the main function?

  2. #2

    Re: simple openGL question

    well it looks like a console application, and those variables are used to tell what sort of command line paramaters were specified when the program was started, like a -n or /p whatever, nothing to do with OpenGL to tell you the truth.

    hell i might be wrong.

  3. #3

    Re: simple openGL question

    I think its for command line arguements. Think you can specify window size and other parameters with the argument strings.

    I usually put glutInit after I set the window size. So, in the event someone does pass a command line paramater it will use it instead before I create the window.

  4. #4
    Senior Member Frequent Contributor
    Join Date
    Apr 2000
    Adelaide, South Australia, Australia

    Re: simple openGL question

    int argc, char **argv (which can also be written int argc, char *argv[], if you've seen that) ARE the command line options.

    argc (argument count) indicates how many parameters you have, and argv (argument vector) is a vector of pointers to the strings containting the arguments. an example, Mr Music:

    int main(int argc, char **argv)
    int t;

    for(t=0; t<argc; t++) {
    printf("arg %d: %s\n", t, argv[t]);

    argc is always at least 1. the first argument (argv[0]) points to the executable name, and possibly the path, too, depending on your o/s.


Similar Threads

  1. A simple opengl question
    By hayden in forum OpenGL: Basic Coding
    Replies: 8
    Last Post: 02-08-2013, 03:06 AM
  2. new to openGL simple question
    By shippo113 in forum OpenGL: Basic Coding
    Replies: 8
    Last Post: 07-21-2012, 11:01 AM
  3. Simple question on modern GLSL of OpenGL 3.1+
    By imported_tobindax in forum OpenGL: Basic Coding
    Replies: 0
    Last Post: 09-02-2010, 01:58 PM
  4. Simple question about installing opengl
    By tomgl in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 08-25-2004, 02:36 PM
  5. Simple VB6 & OpenGL Question
    By Keeling in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 04-15-2004, 11:36 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Proudly hosted by Digital Ocean