This site is no longer active and is available for archival purposes only. Registration and login is disabled.

Translate


Translate

Postby Gar » May 5, 2009 @ 8:57am

Hi,

I am trying to fix the problem in my project when the object is moving. The Cube should locate in the center, but from the figures below are not.


Image

Image

I think it should be the translate problem. The part code is as following:

-----------------------------
//Before rotating, translating or scaling, reset the cube to its original position to prevent rounding errors
cube.Reset();
cube.Translate(patt_trans[0][3],-patt_trans[1][3],-patt_trans[2][3]);

cube.Rotate((4096/(2*3.14))*rot[0],(4096/(2*3.14))*rot[1],(4096/(2*3.14))*rot[2]);

//Set 3D perspective and move the camera backwards (scale for the Edge internal renderer)
display->Perspective3D(display->GetWidth(), display->GetHeight());

// #if !defined(EGL_USEGL)
display->WorldScale(65536 * 2, 65536 * 2, 65536 * 2);
// #endif

display->WorldScale(65536*patt_width/2, 65536*patt_width/2,65536*patt_width/2);
display->Render(&cube);
return(E_OK);
display->WorldReset();


------------------------------------
Thanks.
good good study, day day up!
open heart every day ^!^
Gar
pm Member
 
Posts: 14
Joined: Mar 13, 2008 @ 2:03am


Postby edge » May 10, 2009 @ 5:41pm

Hi Gar,

It seems the translation is going fine, but your perspective isn't. Are you able to read the perspective matrix/properties from your camera? If you can retrieve the camera's perspective matrix, you can use the ClassEDisplay::SetPerspectiveMatrix function to fix your perpective.

Also, are you using OpenGL or the EDGELIB software 3D renderer?
EDGELIB: Cross-platform mobile development at your fingertips
http://www.edgelib.com
User avatar
edge
pm Member
 
Posts: 1180
Joined: Aug 22, 2005 @ 3:42pm
Location: The Netherlands


Postby Gar » May 11, 2009 @ 4:34am

Hi Edge,

I read the perspective matrix from my camera, but this matrix is 4X4, and the ClassEDisplay::SetPerspectiveMatrix function is reading 20:12 fixed point. What should i do then?

>Also, are you using OpenGL or the EDGELIB software 3D renderer?

I am using EDGELIB software to render.
good good study, day day up!
open heart every day ^!^
Gar
pm Member
 
Posts: 14
Joined: Mar 13, 2008 @ 2:03am


Postby edge » May 11, 2009 @ 8:38am

EDGELIB: Cross-platform mobile development at your fingertips
http://www.edgelib.com
User avatar
edge
pm Member
 
Posts: 1180
Joined: Aug 22, 2005 @ 3:42pm
Location: The Netherlands


Return to EDGELIB


Sort


Forum Description

Powerful and affordable C++ middleware solution covering true multi-platform 2D, 3D and network features for Apple iPhone, Windows Mobile, Symbian S60, UIQ, Linux and Windows desktop.

Moderator:

edge

Forum permissions

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

cron