Jump to content
  • Advertisement

Archived

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

A small problem

This topic is 5473 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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
Advertisement
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
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
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
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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!