making a spiral

here be the code

 #include <gl/glut.h>

void changesize(GLsizei w, GLsizei h)
     GLfloat nRange = 100.0f;
     glViewport(0, 0, w, h);
     if(w <= h)
     glOrtho (-nRange, nRange, -nRange*h/w, nRange*h/w, -nRange, nRange);
     glOrtho (-nRange*w/h, nRange*w/h, -nRange, nRange, -nRange, nRange);
     glVertex3f(0.0f, 0.0f, 0.0f);
     glvertex3f(50.0f, 50.0f, 50.0f);
     glvertex3f(0.0f, 0.0f, 0.0f);
     glvertex3f(50.0f, 50.0f, 50.0f);
     #define GL_PI 3.1415f
     void SetupRC()
          glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
          glColor3f(0.0f, 1.0f, 0.0f);
     void RenderScene(void)
          GLfloat x, y, z, angle;
          glRotatef(xRot, 1.0f, 0.0f, 0.0f);
          glRotatef(yRot, 0.0f, 1.0f, 0.0f);
          z = -50.0f;
          for(angle = 0.0f; angle <= (2.0f * GL_PI) * 3.0f; angle += 0.1f)
                    x = 50.0f * sin(angle);
                    y = 50.0f * cos(angle);
                    glVertex3f(x, y, z);
                    z += 0.5f;

it makes a spiral and for some reason it doesnt work it gives errors like these when i compile it

21 C:\Dev-Cpp\spiral.cpp expected constructor, destructor, or type conversion before ‘(’ token
21 C:\Dev-Cpp\spiral.cpp expected ,' or;’ before ‘(’ token

can anyone help please
thanks in advance

You have ‘}’ in the wrong place - you placed it in the middle of first function!

The code at line 21 (and a few lines below) does not seem to belong to a function.

Use this function at the first line of your program:

glCorrectMyCode (GL_TRUE);

If a question sounds stupid, it probably is.

If you don’t respond to nonsense like this, maybe it will go away…

These people thrive on reaction, any reaction. I’ve seen it before :rolleyes:


I dont know if you have noticed but this is the begginer board. just because I have a problem doesn’t mean you have to poke fun at my question because you think your soooo much better.

so can you help or are you just going to keep putting useless posts on this thread???

There seems to be a trend on the opengl message board.

Where did you get this code? Or in which code do you base your own code? Your code seems something incomplete.
It needs a main function and another functions for the use of GLUT.
Do you want to use your code with GLUT or with the windows callbacks?

never mind i found the answer to my problems

I’ve also noticed this trend on this beginner board.
The is a tendency to mock and be sarcastic of posters. why even the board moderator is guilty of this. Maybe he is the one who has set this tone for this forum.
This isn’t good at all. OpenGL is way more friendly than this. :slight_smile:
I usually stay away from here, what is the reason for the sarcasm and rudeness to beginners on here? any opinions?

Don’t take it badly, anyone can just kidding. I’m not sarcastic at all (I hope!). I spend most of the time I’m here trying to help others.
I just try to explain (obviously not in a well manner) that this is not a forum about C or any other language. That’s all.

its been executed and also showing thw window but iam not able to see the picture