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.

On Apr 3, 11:30 am, Streets Of Boston <flyingdutc...@gmail.com> wrote:
> 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 the "--Model View--> 2D coord --Project View--
>
> >" for you.
>
> It's quite a bit of math and such. You have to draw it out and get a
> good understanding of it. The hints i gave you above should give you a
> good direction (gluProject for mapping 3D to 2D; MatrixTrackerGL for
> obtaining the current model view and projection view matrices). The
> rest of the math you have to code yourself. Learn up on geometric
> calculations a bit, google a lot (that's what i did :-)).
>
> On Apr 3, 2:17 pm, William <william.caine...@gmail.com> wrote:
>
> > 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, 11:55 am, Streets Of Boston <flyingdutc...@gmail.com> wrote:
>
> > > - 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 objects are occupying.
>
> > > On Apr 3, 10:24 am, William <william.caine...@gmail.com> 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 -900
> > > > to +900.  I figure I can used them somehow to tell what is rotated but
> > > > I am unsure how.  i just pass them in and it magically rotates for
> > > > me.  so i am unsure how to tell from the numbers what angle the cube
> > > > is at.
>
> > > > can I take a trig function to them or what?  or do i take the xRot %
> > > > 360 and the remainder is what degree I am at.  Or is xRot in radians
> > > > so I must convert it.
>
> > > > On Apr 3, 12:41 am, Marco Nelissen <marc...@android.com> wrote:
>
> > > > > 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 <william.caine...@gmail.com> 
> > > > > 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 randomly spin the cube when done spinning. I want 
> > > > > > to
> > > > > > know which face(s) I am looking at.  10% of face 1, 90% of face 2.- 
> > > > > > Hide quoted text -
>
> > > > - Show quoted text -- Hide quoted text -
>
> > - Show quoted text -
>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to