Archived

This topic is now archived and is closed to further replies.

Kronos259

A small problem

Recommended Posts

Kronos259    122
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?

Share this post


Link to post
Share on other sites
Willm    138
Im guessing you missed a parenthesis above draw, or you typed a '')'' when you meant ''}'' - or vice versa.

Share this post


Link to post
Share on other sites
Kronos259    122
It is right after this code (thereis nothing else drawn in the screen)
int DrawGLScene(GLvoid) // Here''s Where We Do All The Drawing
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clear The Screen And The Depth Buffer
glLoadIdentity(); // Reset The View

Share this post


Link to post
Share on other sites
Kronos259    122
Thanks for your interest.
The whole code is fine, i use the required { or ( where it is needed and believe me there is no problem in that .When i do not use the statements void draw (){
and }(after the code that draw sthe cube)

everything works fine.The cube is correctly created.
What i actually want to do is add a function that will help me draw several cubes by calling it.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
something like this?

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


void drawManyCubes(){
for(int i=0;i<100;i++){
glBegin(GL_QUADS);
..
...
glEnd();
}
}

Share this post


Link to post
Share on other sites