dimanche 18 décembre 2022

OpenGL Drawing 2 vectors with a given angle between them

Might be a stupid question, but I can't find anywhere something to help. I'm trying to draw in OpenGL 2 vectors with a given angle (in radians) between them, something like this:

enter image description here

I managed to draw the vectors but I'm not sure how to place them at the specific angle:

                glBegin(GL_LINES);  // Vx
                glColor4f(1, .5, 0, 1);
                glVertex3f(0, 0, 0);
                glVertex3f(0, vectorYRScalingValue, 0);  // vectorYRScalingValue is 5.0
                glEnd();
                glBegin(GL_LINES);  // Vy
                glColor4f(1, .5, 0, 1);
                glVertex3f(0, 0, 0);
                glVertex3f(0, vectorYRScalingValue, 0);
                glEnd();

Aucun commentaire:

Enregistrer un commentaire