making a spiral

here be the code

 #include <gl/glut.h>

void changesize(GLsizei w, GLsizei h)
{
     GLfloat nRange = 100.0f;
     if(h==0)
     h=1;
     glViewport(0, 0, w, h);
     glMatrixMode(GL_PROJECTION);
     glLoadIdentity();
     
     if(w <= h)
     glOrtho (-nRange, nRange, -nRange*h/w, nRange*h/w, -nRange, nRange);
     else
     glOrtho (-nRange*w/h, nRange*w/h, -nRange, nRange, -nRange, nRange);
     
     glMatrixMode(GL_MODELVIEW);
     glLoadIdentity();
     }
     
     glBegin(GL_POINTS);
     glVertex3f(0.0f, 0.0f, 0.0f);
     glvertex3f(50.0f, 50.0f, 50.0f);
     glEnd();
     
     glBegin(GL_POINTS);
     glvertex3f(0.0f, 0.0f, 0.0f);
     glEnd();
     
     glBegin(GL_POINTS);
     glvertex3f(50.0f, 50.0f, 50.0f);
     glEnd();
     
     #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;
          glClear(GL_COLOR_BUFFER_BIT);
          
          glPushMatrix();
          glRotatef(xRot, 1.0f, 0.0f, 0.0f);
          glRotatef(yRot, 0.0f, 1.0f, 0.0f);
          glBegin(GL_POINTS);
          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;
          }
          
          glEnd();
          glPopMatrix();
          
          glFlush();
          } 

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
tralfas

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:

what???

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