Jump to content

  • Log In with Google      Sign In   
  • Create Account

Interested in a FREE copy of HTML5 game maker Construct 2?

We'll be giving away three Personal Edition licences in next Tuesday's GDNet Direct email newsletter!

Sign up from the right-hand sidebar on our homepage and read Tuesday's newsletter for details!

We're also offering banner ads on our site from just $5! 1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


Member Since 19 Apr 2014
Offline Last Active Apr 19 2014 05:49 AM

Topics I've Started

I need a C program using OpenGL to create a pendulum that rotates about its string on a...

19 April 2014 - 05:51 AM

I need it for my mini project. I havent understoods the basics for the rotation yet. I have the source code for creating the pendulum with the thread. I understand that I have to create a matrix for translating the tip of the string to the origin, then rotate the entire figure, and translate it back to the initial position; and multiply all these matrices. I dont understand how to create these matrices, please help me. To create the sphere in the pendulum, I've used recursive defintion of the sphere using tetrahedrons. Please help me, I need the source code. Thank you.
This is the source code so far:
int n=10;
GLfloat v[4][3]={{0.0,0.0,1.0},{0.0,0.942809,-0.33333},{-0.816497,-0.471405,-0.33333},{0.816497,-0.471405,-0.333333}};
GLfloat a[2][3]={{0.0,0.0,-0.333333},{0.0,10.0,-0.333333}};
void normalize(GLfloat *p)
    double d=0.0;
    int i;
void triangle(GLfloat *a,GLfloat *b,GLfloat *c)
void divide_triangle(GLfloat *a,GLfloat *b,GLfloat *c,int n)
    GLfloat v1[3],v2[3],v3[3];
    int j;
void tetrahedron(int n)
void display(void)
void myReshape(int w,int h)
void main(int argc,char** argv)