static void myInit()
{
PrimitiveType=GL_POLYGON;

LineSegments=3;
}

can someone tell me what static does to the function?

Member functions (and data members) of a class can be declared as static. This means that they do not belong to any particular instance of the class, but instead are similar to gloabal functions (or variables), but must be referenced using the scope of the class they belong to: Class::staticmemberfunction()
Static member functions cannot act on instance data members of a class.

The following link provides an online C++ tutorial, although it is a bit brief:
http://www.cplusplus.com/doc/tutorial/

There are many other free online resources for learning the basics of object oriented programming in C++ that can be found through a google search.

when not in a class definition, 'static' means that the name should not be visible outside the compiled module. This is an older style and has been 'deprecated' by the standards committee, but people still use it all the time.

Here's an example:

// file A
void ExportedRoutine()
{
}

static void NonExportedRoutine()
{
}
// File B
    // this asks the linker to find ExportedRoutine defined in some other file
extern void ExportedRoutine(); 

    // this won't work because the routine is 'static' and therefore not available
    // to the linker to be found...
extern void NonExportedRoutine(); // will generate a linker error

Same applies for any declared variable:

static int foo;
int bar; // this could be found by the linker from another obj file.

when not in a class definition, 'static' means that the name should not be visible outside the compiled module. This is an older style and has been 'deprecated' by the standards committee, but people still use it all the time.

Here's an example:

// file A
void ExportedRoutine()
{
}

static void NonExportedRoutine()
{
}
// File B
    // this asks the linker to find ExportedRoutine defined in some other file
extern void ExportedRoutine(); 

    // this won't work because the routine is 'static' and therefore not available
    // to the linker to be found...
extern void NonExportedRoutine(); // will generate a linker error

Same applies for any declared variable:

static int foo;
int bar; // this could be found by the linker from another obj file.

Thats good information for me to know thanx, i was familiar with the use of static with regards to classes.

if a variable is declared as static within a function, the variable is maintained and is available for future calls of the function in which it has been declared

>the variable is maintained and is available for future calls of the function in which it has been declared
However, this isn't as useful as it appears at first.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.