Quantcast
Channel: beginners - openFrameworks
Viewing all articles
Browse latest Browse all 4929

Sphere orientation

$
0
0

@cabral1349 wrote:

Hi, i'm trying to understand how the orientation of a sphere works.

I've declared an ofImage and an ofSpherePrimitve in my ofApp.h, then called the following code in the setup:

ofEnableDepthTest();

ofEnableNormalizedTexCoords();

catImg.load("cat.jpg");

sphere.set(300, 50);

sphere.setPosition(ofGetWidth()/2, ofGetHeight()/2, 0);

sphere.setOrientation(ofQuaternion(0, 1, 0, 0));

sphere.mapTexCoords(0,0,1,1);

when I draw this scene I get what I want: the sphere drawn and the center of the texture is aligned with the camera.
However, I don't understand why. I understand how quaternions work to change an orientation, but not how they define an absolute orientation. The values that I used were based on trial and error.

Can someone explain me how setOrientation works?

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 4929

Trending Articles