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?
Where in your code have you put the function? is this function draw() inside another one?
Im guessing you missed a parenthesis above draw, or you typed a '')'' when you meant ''}'' - or vice versa.
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
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
It doesn''t look like you''re ending the DrawGLScene function with a ''}''....
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.
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.
May 28, 2003 10:21 AM
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();
}
}
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();
}
}
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement