[android-developers] Re: OpenGL What Cube Face Is Facing Me

2009-04-03 Thread djr
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

[android-developers] Re: OpenGL What Cube Face Is Facing Me

2009-04-03 Thread Streets Of Boston
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

[android-developers] Re: OpenGL What Cube Face Is Facing Me

2009-04-03 Thread William
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,

[android-developers] Re: OpenGL What Cube Face Is Facing Me

2009-04-03 Thread Streets Of Boston
- 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

[android-developers] Re: OpenGL What Cube Face Is Facing Me

2009-04-03 Thread Marco Nelissen
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

[android-developers] Re: OpenGL What Cube Face Is Facing Me

2009-04-03 Thread William
//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

[android-developers] Re: OpenGL What Cube Face Is Facing Me

2009-04-02 Thread Marco Nelissen
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