Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: making a spiral

  1. #1
    Junior Member Newbie
    Join Date
    Apr 2006
    Posts
    14

    making a spiral

    here be the code
    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

  2. #2
    Senior Member OpenGL Pro k_szczech's Avatar
    Join Date
    Feb 2006
    Location
    Poland
    Posts
    1,107

    Re: making a spiral

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

  3. #3
    Senior Member Frequent Contributor
    Join Date
    Feb 2006
    Location
    Sweden
    Posts
    744

    Re: making a spiral

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

  4. #4
    Senior Member OpenGL Pro
    Join Date
    Jul 2001
    Location
    France
    Posts
    1,662

    Re: making a spiral

    Use this function at the first line of your program:

    Code :
    glCorrectMyCode (GL_TRUE);

  5. #5
    Guest

    Re: making a spiral

    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

  6. #6
    Guest

    Re: making a spiral

    what???

  7. #7
    Junior Member Newbie
    Join Date
    Apr 2006
    Posts
    14

    Re: making a spiral

    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.

  8. #8
    Junior Member Newbie
    Join Date
    May 2006
    Location
    México
    Posts
    2

    Re: making a spiral

    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?

  9. #9
    Junior Member Newbie
    Join Date
    Apr 2006
    Posts
    14

    Re: making a spiral

    never mind i found the answer to my problems

  10. #10
    Guest

    Re: making a spiral

    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.
    I usually stay away from here, what is the reason for the sarcasm and rudeness to beginners on here? any opinions?

Page 1 of 2 12 LastLast

Similar Threads

  1. Problem with drawing a 3D spiral
    By Norten in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 03-31-2014, 10:15 PM
  2. Color flashiness and half my spiral not drawing
    By Chdata in forum OpenGL: Basic Coding
    Replies: 0
    Last Post: 12-08-2012, 08:31 AM
  3. tapering spiral ramp model
    By forget.it in forum OpenGL: General
    Replies: 0
    Last Post: 09-13-2005, 02:06 AM
  4. Q3 Mod Making
    By in forum OpenGL: macOS
    Replies: 0
    Last Post: 04-20-2002, 06:50 PM
  5. making a man run
    By BozLee in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 10-24-2000, 05:26 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean