A small problem

I use
void draw(){
//here i draw a cube starting with glbegin
//finishing with glEnd;
}

When i compile the program i get the message “Local functions are illegal”.
Anyone knows why?

It’s because it’s inside another function.

check the position of the ‘{’ and ‘}’ around it. my guess is that you’ve removed an if statement or other large code section that uses ‘{’ and ‘}’ and there’s a mismatch…

Allan

That code is right after the following(i have drawn nothing before it so there is no way it could be messed with other functions)

int DrawGLScene(GLvoid) {
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glLoadIdentity();

you are trying to declare draw() inside int DrawGLScene:

int DrawGLScene()
{
void Draw() // This is a local function definition and illegal…
{
}
}

you need to write it as:

void Draw()
{
}

int DrawGLScene()
{
Draw();
}