Re: [android-developers] Re: OpenGL - 3D rotation from a 2D input

2010-09-09 Thread Thiago Lopes Rosa
Lesson 48 ported to Java (still needs some OpenGL ES adjustments):
http://www.java-tips.org/other-api-tips/jogl/arcball-rotation-nehe-tutorial-jogl-port.html



Thiago


On Tue, Sep 7, 2010 at 21:04, Thiago Lopes Rosa thiago.r...@gmail.comwrote:

 Thanks! =)



 Thiago


 On Tue, Sep 7, 2010 at 14:25, Robert Green rbgrn@gmail.com wrote:

 I was going to suggest doing what they outline in that lesson.  In
 short - keep a rotation matrix for the current orientation of your
 cube.  Process input and keep a rotation matrix that you apply the
 user input to, then multiply the cube matrix by and store the result
 as the cube matrix, then reset the input matrix to identity and start
 all over.

 For user-space Z input rotation, you can do it like they do in the pro
 3D apps - with a little button that shows that rotation to the left
 and to the right.  Still use the same method as above, though, and you
 will get very predictable, nice rotation on all axis.

 On Sep 7, 11:39 am, alan a...@birtles.org.uk wrote:
  your first stop for all opengl questions should be NeHe open gl
  lessons:http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=48
 
  On Sep 6, 9:58 pm, Thiago Lopes Rosa thiago.r...@gmail.com wrote:
 
 
 
   This is a 3D Minesweeper. Instead of searching mines on that
 rectangular
   field, you must search them on several 3D fields (8 in total) by
 looking in
   all faces/planes. So you must rotate the objects to see all sides.
 (search
   for: *3D Mines*)
 
   I got the idea about different movements for each axis, but I really
 wanted
   to use dragging for all axis.
 
   Thanks,
 
   Thiago
 
   On Mon, Sep 6, 2010 at 17:42, Droid rod...@gmail.com wrote:
Suggest dragging for x, y and tapping for z axis movement. But its
 not
clear exactly what your end-game is
You could also use accelerometer for tipping (see Breakout Legend in
the App in mkt)
 
:) Droid
 
On Sep 6, 7:04 pm, Thiago Lopes Rosa thiago.r...@gmail.com wrote:
 Hi,
 
 I have a cube on the center of the screen and the user can rotate
 it
using
 the touchscreen.
 
 The problem:
 For example, when I rotate the cube 180 degrees (vertical), the
horizontal
 rotation gets inverted (i mean, when moving right the cube
 rotates left
 and vice-versa).
 
 The issue is that I'm using 2D coordinates (touchscreen) to rotate
 the 3D
 cube.
 I'm always rotating around the cube's X and Y axis and never
 around the Z
 axis.
 
 The question is:
 How do I calculate how much and which axis to rotate from a 2D
 coordinate
 input?
 
 Thanks,
 
 Thiago
 
--
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.comandroid-developers%2bunsubscr...@googlegroups.comandroid-developers%2Bunsubs
 cr...@googlegroups.com
For more options, visit this group at
   http://groups.google.com/group/android-developers?hl=en

 --
 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.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en




-- 
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

[android-developers] Re: OpenGL - 3D rotation from a 2D input

2010-09-09 Thread Robert Green
To switch to ES -  Create an array of verts and normals and use those
to replace the immediate mode drawing.  You will need to replace the
GLU sphere and torus creation with perhaps a known algorithm to create
them - or if you can find a glut es implementation of those that would
work too.


On Sep 9, 4:11 pm, Thiago Lopes Rosa thiago.r...@gmail.com wrote:
 Lesson 48 ported to Java (still needs some OpenGL ES 
 adjustments):http://www.java-tips.org/other-api-tips/jogl/arcball-rotation-nehe-tu...

 Thiago

 On Tue, Sep 7, 2010 at 21:04, Thiago Lopes Rosa thiago.r...@gmail.comwrote:



  Thanks! =)

  Thiago

  On Tue, Sep 7, 2010 at 14:25, Robert Green rbgrn@gmail.com wrote:

  I was going to suggest doing what they outline in that lesson.  In
  short - keep a rotation matrix for the current orientation of your
  cube.  Process input and keep a rotation matrix that you apply the
  user input to, then multiply the cube matrix by and store the result
  as the cube matrix, then reset the input matrix to identity and start
  all over.

  For user-space Z input rotation, you can do it like they do in the pro
  3D apps - with a little button that shows that rotation to the left
  and to the right.  Still use the same method as above, though, and you
  will get very predictable, nice rotation on all axis.

  On Sep 7, 11:39 am, alan a...@birtles.org.uk wrote:
   your first stop for all opengl questions should be NeHe open gl
   lessons:http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=48

   On Sep 6, 9:58 pm, Thiago Lopes Rosa thiago.r...@gmail.com wrote:

This is a 3D Minesweeper. Instead of searching mines on that
  rectangular
field, you must search them on several 3D fields (8 in total) by
  looking in
all faces/planes. So you must rotate the objects to see all sides.
  (search
for: *3D Mines*)

I got the idea about different movements for each axis, but I really
  wanted
to use dragging for all axis.

Thanks,

Thiago

On Mon, Sep 6, 2010 at 17:42, Droid rod...@gmail.com wrote:
 Suggest dragging for x, y and tapping for z axis movement. But its
  not
 clear exactly what your end-game is
 You could also use accelerometer for tipping (see Breakout Legend in
 the App in mkt)

 :) Droid

 On Sep 6, 7:04 pm, Thiago Lopes Rosa thiago.r...@gmail.com wrote:
  Hi,

  I have a cube on the center of the screen and the user can rotate
  it
 using
  the touchscreen.

  The problem:
  For example, when I rotate the cube 180 degrees (vertical), the
 horizontal
  rotation gets inverted (i mean, when moving right the cube
  rotates left
  and vice-versa).

  The issue is that I'm using 2D coordinates (touchscreen) to rotate
  the 3D
  cube.
  I'm always rotating around the cube's X and Y axis and never
  around the Z
  axis.

  The question is:
  How do I calculate how much and which axis to rotate from a 2D
  coordinate
  input?

  Thanks,

  Thiago

 --
 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.comandroid-developers%2Bunsubs
  cr...@googlegroups.comandroid-developers%2Bunsubs
  cr...@googlegroups.com
 For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

  --
  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.comandroid-developers%2Bunsubs
   cr...@googlegroups.com
  For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en

-- 
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


[android-developers] Re: OpenGL - 3D rotation from a 2D input

2010-09-07 Thread alan
your first stop for all opengl questions should be NeHe open gl
lessons:
http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=48

On Sep 6, 9:58 pm, Thiago Lopes Rosa thiago.r...@gmail.com wrote:
 This is a 3D Minesweeper. Instead of searching mines on that rectangular
 field, you must search them on several 3D fields (8 in total) by looking in
 all faces/planes. So you must rotate the objects to see all sides. (search
 for: *3D Mines*)

 I got the idea about different movements for each axis, but I really wanted
 to use dragging for all axis.

 Thanks,

 Thiago

 On Mon, Sep 6, 2010 at 17:42, Droid rod...@gmail.com wrote:
  Suggest dragging for x, y and tapping for z axis movement. But its not
  clear exactly what your end-game is
  You could also use accelerometer for tipping (see Breakout Legend in
  the App in mkt)

  :) Droid

  On Sep 6, 7:04 pm, Thiago Lopes Rosa thiago.r...@gmail.com wrote:
   Hi,

   I have a cube on the center of the screen and the user can rotate it
  using
   the touchscreen.

   The problem:
   For example, when I rotate the cube 180 degrees (vertical), the
  horizontal
   rotation gets inverted (i mean, when moving right the cube rotates left
   and vice-versa).

   The issue is that I'm using 2D coordinates (touchscreen) to rotate the 3D
   cube.
   I'm always rotating around the cube's X and Y axis and never around the Z
   axis.

   The question is:
   How do I calculate how much and which axis to rotate from a 2D coordinate
   input?

   Thanks,

   Thiago

  --
  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.comandroid-developers%2bunsubscr...@googlegroups.com
  For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en



-- 
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


[android-developers] Re: OpenGL - 3D rotation from a 2D input

2010-09-07 Thread Robert Green
I was going to suggest doing what they outline in that lesson.  In
short - keep a rotation matrix for the current orientation of your
cube.  Process input and keep a rotation matrix that you apply the
user input to, then multiply the cube matrix by and store the result
as the cube matrix, then reset the input matrix to identity and start
all over.

For user-space Z input rotation, you can do it like they do in the pro
3D apps - with a little button that shows that rotation to the left
and to the right.  Still use the same method as above, though, and you
will get very predictable, nice rotation on all axis.

On Sep 7, 11:39 am, alan a...@birtles.org.uk wrote:
 your first stop for all opengl questions should be NeHe open gl
 lessons:http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=48

 On Sep 6, 9:58 pm, Thiago Lopes Rosa thiago.r...@gmail.com wrote:



  This is a 3D Minesweeper. Instead of searching mines on that rectangular
  field, you must search them on several 3D fields (8 in total) by looking in
  all faces/planes. So you must rotate the objects to see all sides. (search
  for: *3D Mines*)

  I got the idea about different movements for each axis, but I really wanted
  to use dragging for all axis.

  Thanks,

  Thiago

  On Mon, Sep 6, 2010 at 17:42, Droid rod...@gmail.com wrote:
   Suggest dragging for x, y and tapping for z axis movement. But its not
   clear exactly what your end-game is
   You could also use accelerometer for tipping (see Breakout Legend in
   the App in mkt)

   :) Droid

   On Sep 6, 7:04 pm, Thiago Lopes Rosa thiago.r...@gmail.com wrote:
Hi,

I have a cube on the center of the screen and the user can rotate it
   using
the touchscreen.

The problem:
For example, when I rotate the cube 180 degrees (vertical), the
   horizontal
rotation gets inverted (i mean, when moving right the cube rotates 
left
and vice-versa).

The issue is that I'm using 2D coordinates (touchscreen) to rotate the 
3D
cube.
I'm always rotating around the cube's X and Y axis and never around the 
Z
axis.

The question is:
How do I calculate how much and which axis to rotate from a 2D 
coordinate
input?

Thanks,

Thiago

   --
   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.comandroid-developers%2Bunsubs
cr...@googlegroups.com
   For more options, visit this group at
  http://groups.google.com/group/android-developers?hl=en

-- 
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


Re: [android-developers] Re: OpenGL - 3D rotation from a 2D input

2010-09-07 Thread Thiago Lopes Rosa
Thanks! =)



Thiago


On Tue, Sep 7, 2010 at 14:25, Robert Green rbgrn@gmail.com wrote:

 I was going to suggest doing what they outline in that lesson.  In
 short - keep a rotation matrix for the current orientation of your
 cube.  Process input and keep a rotation matrix that you apply the
 user input to, then multiply the cube matrix by and store the result
 as the cube matrix, then reset the input matrix to identity and start
 all over.

 For user-space Z input rotation, you can do it like they do in the pro
 3D apps - with a little button that shows that rotation to the left
 and to the right.  Still use the same method as above, though, and you
 will get very predictable, nice rotation on all axis.

 On Sep 7, 11:39 am, alan a...@birtles.org.uk wrote:
  your first stop for all opengl questions should be NeHe open gl
  lessons:http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=48
 
  On Sep 6, 9:58 pm, Thiago Lopes Rosa thiago.r...@gmail.com wrote:
 
 
 
   This is a 3D Minesweeper. Instead of searching mines on that
 rectangular
   field, you must search them on several 3D fields (8 in total) by
 looking in
   all faces/planes. So you must rotate the objects to see all sides.
 (search
   for: *3D Mines*)
 
   I got the idea about different movements for each axis, but I really
 wanted
   to use dragging for all axis.
 
   Thanks,
 
   Thiago
 
   On Mon, Sep 6, 2010 at 17:42, Droid rod...@gmail.com wrote:
Suggest dragging for x, y and tapping for z axis movement. But its
 not
clear exactly what your end-game is
You could also use accelerometer for tipping (see Breakout Legend in
the App in mkt)
 
:) Droid
 
On Sep 6, 7:04 pm, Thiago Lopes Rosa thiago.r...@gmail.com wrote:
 Hi,
 
 I have a cube on the center of the screen and the user can rotate
 it
using
 the touchscreen.
 
 The problem:
 For example, when I rotate the cube 180 degrees (vertical), the
horizontal
 rotation gets inverted (i mean, when moving right the cube
 rotates left
 and vice-versa).
 
 The issue is that I'm using 2D coordinates (touchscreen) to rotate
 the 3D
 cube.
 I'm always rotating around the cube's X and Y axis and never around
 the Z
 axis.
 
 The question is:
 How do I calculate how much and which axis to rotate from a 2D
 coordinate
 input?
 
 Thanks,
 
 Thiago
 
--
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.comandroid-developers%2bunsubscr...@googlegroups.comandroid-developers%2Bunsubs
 cr...@googlegroups.com
For more options, visit this group at
   http://groups.google.com/group/android-developers?hl=en

 --
 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.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en


-- 
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

[android-developers] Re: OpenGL - 3D rotation from a 2D input

2010-09-06 Thread Droid
Suggest dragging for x, y and tapping for z axis movement. But its not
clear exactly what your end-game is
You could also use accelerometer for tipping (see Breakout Legend in
the App in mkt)

:) Droid


On Sep 6, 7:04 pm, Thiago Lopes Rosa thiago.r...@gmail.com wrote:
 Hi,

 I have a cube on the center of the screen and the user can rotate it using
 the touchscreen.

 The problem:
 For example, when I rotate the cube 180 degrees (vertical), the horizontal
 rotation gets inverted (i mean, when moving right the cube rotates left
 and vice-versa).

 The issue is that I'm using 2D coordinates (touchscreen) to rotate the 3D
 cube.
 I'm always rotating around the cube's X and Y axis and never around the Z
 axis.

 The question is:
 How do I calculate how much and which axis to rotate from a 2D coordinate
 input?

 Thanks,

 Thiago

-- 
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


Re: [android-developers] Re: OpenGL - 3D rotation from a 2D input

2010-09-06 Thread Thiago Lopes Rosa
This is a 3D Minesweeper. Instead of searching mines on that rectangular
field, you must search them on several 3D fields (8 in total) by looking in
all faces/planes. So you must rotate the objects to see all sides. (search
for: *3D Mines*)

I got the idea about different movements for each axis, but I really wanted
to use dragging for all axis.

Thanks,



Thiago


On Mon, Sep 6, 2010 at 17:42, Droid rod...@gmail.com wrote:

 Suggest dragging for x, y and tapping for z axis movement. But its not
 clear exactly what your end-game is
 You could also use accelerometer for tipping (see Breakout Legend in
 the App in mkt)

 :) Droid


 On Sep 6, 7:04 pm, Thiago Lopes Rosa thiago.r...@gmail.com wrote:
  Hi,
 
  I have a cube on the center of the screen and the user can rotate it
 using
  the touchscreen.
 
  The problem:
  For example, when I rotate the cube 180 degrees (vertical), the
 horizontal
  rotation gets inverted (i mean, when moving right the cube rotates left
  and vice-versa).
 
  The issue is that I'm using 2D coordinates (touchscreen) to rotate the 3D
  cube.
  I'm always rotating around the cube's X and Y axis and never around the Z
  axis.
 
  The question is:
  How do I calculate how much and which axis to rotate from a 2D coordinate
  input?
 
  Thanks,
 
  Thiago

 --
 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.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en


-- 
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