Jump to content

  • Log In with Google      Sign In   
  • Create Account


#ActualDezachu

Posted 10 November 2012 - 07:34 PM

Hey guys, bit of a noob with OpenGL (Only just started utilising it on my course!). C++.

Got this:

[source lang="cpp"]if((float)Clock.GetElapsedTime()>REFRESH_RATE){ // Clear colour and depth buffer glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // reset the ModelView Transform matrix glMatrixMode(GL_MODELVIEW); glLoadIdentity(); // Apply some transformations glTranslatef(0.f, 0.f, -100.f); //glRotatef(15.f,1.f,0.f,0.f); glRotatef(i,0.f,1.f,0.f); glRotatef(i-15,0.f,0.f,1.f); glRotatef(i+15,1.f,0.f,0.f); // ********************** // drawCylinder(20,20,40); // ********************** // i++; Clock.Reset(); }[/source]

The drawCylinder uses to TRIANGLE_FAN objects and then QUAD_STRIP's, all created via a for loop. The parameters passed in are radius, numberOfSides and height.

i++ is a float declared at the beginning of the program: float i = 30; (I know it should be called f for float, but more confusion to be made there that I was better off avoiding).


When I run the program, the animation is very jumpy as it rotates. Any clues as to why? Cheers :)


EDIT: Dropping the framrate from 0.03 to 0.01 has improved it somewhat. Still, I'd imagine the animation would be more stuttery than jumpy. The animation basically flashed back to the previous frame every so often, looked a bit daft.

#8Dezachu

Posted 10 November 2012 - 07:34 PM

Hey guys, bit of a noob with OpenGL (Only just started utilising it on my course!). C++.

Got this:

[source lang="cpp"]if((float)Clock.GetElapsedTime()>REFRESH_RATE){ // Clear colour and depth buffer glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // reset the ModelView Transform matrix glMatrixMode(GL_MODELVIEW); glLoadIdentity(); // Apply some transformations glTranslatef(0.f, 0.f, -100.f); //glRotatef(15.f,1.f,0.f,0.f); glRotatef(i,0.f,1.f,0.f); glRotatef(i-15,0.f,0.f,1.f); glRotatef(i+15,1.f,0.f,0.f); // ********************** // drawCylinder(20,20,40); // ********************** // i++; Clock.Reset(); }[/source]

The drawCylinder uses to TRIANGLE_FAN objects and then QUAD_STRIP's, all created via a for loop. The parameters passed in are radius, numberOfSides and height.

i++ is a float declared at the beginning of the program: float i = 30; (I know it should be called f for float, but more confusion to be made there that I was better off avoiding).


When I run the program, the animation is very jumpy as it rotates. Any clues as to why? Cheers :)


EDIT: Dropping the framrate from 0.03 to 0.01 has improved it somewhat. Still, I'd imagine the animation would be more stuttery than jumpy. The animation basically flashed back to the previous frame every so often, looked a bit daft.

#7Dezachu

Posted 10 November 2012 - 07:34 PM

Hey guys, bit of a noob with OpenGL (Only just started utilising it on my course!). C++.

Got this:

[source lang="cpp"]if((float)Clock.GetElapsedTime()>REFRESH_RATE){ // Clear colour and depth buffer glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // reset the ModelView Transform matrix glMatrixMode(GL_MODELVIEW); glLoadIdentity(); // Apply some transformations glTranslatef(0.f, 0.f, -100.f); //glRotatef(15.f,1.f,0.f,0.f); glRotatef(i,0.f,1.f,0.f); glRotatef(i-15,0.f,0.f,1.f); glRotatef(i+15,1.f,0.f,0.f); // ********************** // drawCylinder(20,20,40); // ********************** // i++; Clock.Reset(); }[/source]

The drawCylinder uses to TRIANGLE_FAN objects and then QUAD_STRIP's, all created via a for loop. The parameters passed in are radius, numberOfSides and height.

i++ is a float declared at the beginning of the program: float i = 30; (I know it should be called f for float, but more confusion to be made there that I was better off avoiding).


When I run the program, the animation is very jumpy as it rotates. Any clues as to why? Cheers :)


EDIT: Dropping the framrate from 0.03 to 0.01 has improved it somewhat. Still, I'd imagine the animation would be more stuttery than jumpy. The animation basically flashed back to the previous frame every so often, looked a bit daft.

#6Dezachu

Posted 10 November 2012 - 07:34 PM

Hey guys, bit of a noob with OpenGL (Only just started utilising it on my course!). C++.

Got this:

[source lang="cpp"]if((float)Clock.GetElapsedTime()>REFRESH_RATE){ // Clear colour and depth buffer glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // reset the ModelView Transform matrix glMatrixMode(GL_MODELVIEW); glLoadIdentity(); // Apply some transformations glTranslatef(0.f, 0.f, -100.f); //glRotatef(15.f,1.f,0.f,0.f); glRotatef(i,0.f,1.f,0.f); glRotatef(i-15,0.f,0.f,1.f); glRotatef(i+15,1.f,0.f,0.f); // ********************** // drawCylinder(20,20,40); // ********************** // i++; Clock.Reset(); }[/source]

The drawCylinder uses to TRIANGLE_FAN objects and then QUAD_STRIP's, all created via a for loop. The parameters passed in are radius, numberOfSides and height.

i++ is a float declared at the beginning of the program: float i = 30; (I know it should be called f for float, but more confusion to be made there that I was better off avoiding).


When I run the program, the animation is very jumpy as it rotates. Any clues as to why? Cheers :)


EDIT: Dropping the framrate from 0.03 to 0.01 has improved it somewhat. Still, I'd imagine the animation would be more stuttery than jumpy. The animation basically flashed back to the previous frame every so often, looked a bit daft.

#5Dezachu

Posted 10 November 2012 - 07:34 PM

Hey guys, bit of a noob with OpenGL (Only just started utilising it on my course!). C++.

Got this:

[source lang="cpp"]if((float)Clock.GetElapsedTime()>REFRESH_RATE){ // Clear colour and depth buffer glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // reset the ModelView Transform matrix glMatrixMode(GL_MODELVIEW); glLoadIdentity(); // Apply some transformations glTranslatef(0.f, 0.f, -100.f); //glRotatef(15.f,1.f,0.f,0.f); glRotatef(i,0.f,1.f,0.f); glRotatef(i-15,0.f,0.f,1.f); glRotatef(i+15,1.f,0.f,0.f); // ********************** // drawCylinder(20,20,40); // ********************** // i++; Clock.Reset(); }[/source]

The drawCylinder uses to TRIANGLE_FAN objects and then QUAD_STRIP's, all created via a for loop. The parameters passed in are radius, numberOfSides and height.

i++ is a float declared at the beginning of the program: float i = 30; (I know it should be called f for float, but more confusion to be made there that I was better off avoiding).


When I run the program, the animation is very jumpy as it rotates. Any clues as to why? Cheers :)


EDIT: Dropping the framrate from 0.03 to 0.01 has improved it somewhat. Still, I'd imagine the animation would be more stuttery than jumpy. The animation basically flashed back to the previous frame every so often, looked a bit daft.

#4Dezachu

Posted 10 November 2012 - 07:34 PM

Hey guys, bit of a noob with OpenGL (Only just started utilising it on my course!). C++.

Got this:

[source lang="cpp"]if((float)Clock.GetElapsedTime()>REFRESH_RATE){ // Clear colour and depth buffer glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // reset the ModelView Transform matrix glMatrixMode(GL_MODELVIEW); glLoadIdentity(); // Apply some transformations glTranslatef(0.f, 0.f, -100.f); //glRotatef(15.f,1.f,0.f,0.f); glRotatef(i,0.f,1.f,0.f); glRotatef(i-15,0.f,0.f,1.f); glRotatef(i+15,1.f,0.f,0.f); // ********************** // drawCylinder(20,20,40); // ********************** // i++; Clock.Reset(); }[/source]

The drawCylinder uses to TRIANGLE_FAN objects and then QUAD_STRIP's, all created via a for loop. The parameters passed in are radius, numberOfSides and height.

i++ is a float declared at the beginning of the program: float i = 30; (I know it should be called f for float, but more confusion to be made there that I was better off avoiding).


When I run the program, the animation is very jumpy as it rotates. Any clues as to why? Cheers :)


EDIT: Dropping the framrate from 0.03 to 0.01 has improved it somewhat. Still, I'd imagine the animation would be more stuttery than jumpy. The animation basically flashed back to the previous frame every so often, looked a bit daft.

PARTNERS