You can compute a normal to each face of the cube to determine
direction. Here is a URL to the basics of the mathematics (http://
www.geocities.com/SiliconValley/2151/math3d.html). Look for code on
the internet that computes normals in 3D. If your mathematics isn't
good, this will be a problem.
O
You have to project 3D coordinates (model view) back to 2D coordinates
(LCD screen).
I wrote an app that needed to do the exact opposite (2d coords to 3d
coord and vectors).
But the idea is the same.
3D coords --Model View--> 2D coord --Project View--> 2D screen coords
gluProject takes care of t
I am still lost. I am very new to opengl. I looked at the code and
there is a lot going on. And even if I can understand it, I still
have to then make code to do the detection. Someone has had to have
this problem in the past that I could see the actual code that does
the detection.
On Apr 3,
- Get your objects coordinates in the model view (you should have
those :))
- Get the current model view matrix (see MatrixTrackingGL class in
your APIDemo's source code for OpenGL)
- Take a look the gluUnProject/gluProject methods and use them to
figure out what part of the LCD-screen your 3D obj
On Fri, Apr 3, 2009 at 7:24 AM, William wrote:
>
> //i rotate the cube using the following
> //xRot,yRot are inc or decremented to change angles
> gl.glRotatef(xRot, 1.0f, 0.0f, 0.0f);
> gl.glRotatef(yRot, 0.0f, 1.0f, 0.0f);
>
> So yes i have access to yRot and xRot but they numbers range from -9
//i rotate the cube using the following
//xRot,yRot are inc or decremented to change angles
gl.glRotatef(xRot, 1.0f, 0.0f, 0.0f);
gl.glRotatef(yRot, 0.0f, 1.0f, 0.0f);
So yes i have access to yRot and xRot but they numbers range from -900
to +900. I figure I can used them somehow to tell what is
Since you're rotating and drawing the cube, shouldn't you have that
information in your app already?
On Thu, Apr 2, 2009 at 7:30 PM, William wrote:
>
> Hi Folks,
>
> I am drawing and rotating a cube. Is there a programmatic way to tell
> what side of the cube is facing me?
>
> For example if I
7 matches
Mail list logo