Author Topic: X_World2Screen and X_Screen2World  (Read 3260 times)

Offline mentalthink

  • Prof. Inline
  • *****
  • Posts: 3375
  • Integrated Brain
    • View Profile
X_World2Screen and X_Screen2World
« on: 2011-May-25 »
HI, in the hot update, the log file, say thats coomand run, but for me not. Anybody can test this little code please?¿, I need this commands for my next application, and is very important for me that´s runs.

Code: (glbasic) [Select]
SETCURRENTDIR("Media") // seperate media and binaries?

X_LOADOBJ "Sphere002.dda", 1



LOADSPRITE "webos-icon.png", 2


GLOBAL sx#, sy#, sz#

WHILE TRUE
MOUSESTATE sx#, sy#, b1,b2
X_SCREEN2WORLD sx#, sy#, -1, wx#, wy#, wz#


PRINT wx#,0,0
PRINT wy#,0,30

X_MAKE3D 1,1000,45
X_CAMERA 0,0,-700,0,0,0
X_MOVEMENT wx#, wy#, 800
X_DRAWOBJ 1,0
SHOWSCREEN
WEND

The objects 3d and Sprite, not are used, but I leave the first code I made
Thanks and Kinds Regards,
Ps: Perhaps I made something bad on the code, but on Windows runs well. Another fact I´m testing on Palm Pre, but 1.4.5 O.S

MrTAToad

  • Guest
Re: X_World2Screen and X_Screen2World
« Reply #1 on: 2011-May-25 »
Could you make the object available too please?

Offline Wampus

  • Prof. Inline
  • *****
  • Posts: 1004
    • View Profile
Re: X_World2Screen and X_Screen2World
« Reply #2 on: 2011-May-25 »
Will wait for object in the example before testing but I saw something yesterday that went wrong with a small app I wrote that could mean X_World2Screen was not working for my iPod Touch but was fine with my PC. Might be something else - will follow this thread and see/help.

Offline mentalthink

  • Prof. Inline
  • *****
  • Posts: 3375
  • Integrated Brain
    • View Profile
Re: X_World2Screen and X_Screen2World
« Reply #3 on: 2011-May-25 »
@ MrTatoad, this is the complete project. Well this is another (is attached), this is only, when you move the mouse, you look the parameters, "equivalents" in 3D world, don´t appear nothing, but on my Palm Pre, always say 0 , 0

@Ragaril, thanks I don´t try in my iPod Touch yet, but seems don´t works fine. Well... if Gernnot, tell us this work on OpenGL-ES devices, I think I made something wrong.

Ps: About the object not is necessary, because you can see always the value at 0, the object only moves like this, but I don´t make too much well this part, beause can keep out, not is too much important.


[attachment deleted by admin]

MrTAToad

  • Guest
Re: X_World2Screen and X_Screen2World
« Reply #4 on: 2011-May-25 »
Yes, it does return just 0 all the time... :blink:

Offline mentalthink

  • Prof. Inline
  • *****
  • Posts: 3375
  • Integrated Brain
    • View Profile
Re: X_World2Screen and X_Screen2World
« Reply #5 on: 2011-May-25 »
Uppss!!!. Thanks MrTatoad for try.

Well I wait to Gernnot, I hope can resolve this litle bug all quickly he can.

Thanks a lot.
Iván J.

Offline Wampus

  • Prof. Inline
  • *****
  • Posts: 1004
    • View Profile
Re: X_World2Screen and X_Screen2World
« Reply #6 on: 2011-May-25 »
I'm getting 0 for all returned values on my iPod Touch when using X_WORLD2SCREEN too. Works fine on PC.

Offline Kitty Hello

  • code monkey
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 10817
  • here on my island the sea says 'hello'
    • View Profile
    • http://www.glbasic.com
Re: X_World2Screen and X_Screen2World
« Reply #7 on: 2011-May-26 »
Uhm... X_SCREEN2WORLD must be done _AFTER_ X_MAKE3D and X_CAMERA. Obviously, no?

Offline mentalthink

  • Prof. Inline
  • *****
  • Posts: 3375
  • Integrated Brain
    • View Profile
Re: X_World2Screen and X_Screen2World
« Reply #8 on: 2011-May-26 »
Gernoot, ok... but I try this code, and don´t works, perhaps is the 1.4.5 S.O of the Palm pre


GLOBAL sx#, sy#, sz#

WHILE TRUE
MOUSESTATE sx#, sy#, b1,b2


X_MAKE3D 1,1000,45

X_CAMERA 0,0,-700,0,0,0

X_WORLD2SCREEN sx#, sy#, -1, wx#, wy#, wz#


X_MAKE2D
PRINT wx#,0,0
PRINT wy#,0,30
SHOWSCREEN
WEND

On Pc, works fine, but on my device always return 0 on the 2 values.

Thanks

MrTAToad

  • Guest
Re: X_World2Screen and X_Screen2World
« Reply #9 on: 2011-May-26 »
Same with 2.x machines too :)

Offline mentalthink

  • Prof. Inline
  • *****
  • Posts: 3375
  • Integrated Brain
    • View Profile
Re: X_World2Screen and X_Screen2World
« Reply #10 on: 2011-May-26 »
Thanks Mr.Tatoad.  :booze:

Offline Kitty Hello

  • code monkey
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 10817
  • here on my island the sea says 'hello'
    • View Profile
    • http://www.glbasic.com
Re: X_World2Screen and X_Screen2World
« Reply #11 on: 2011-May-26 »
OK, back to the sketch board then... I'll investigate over the weekend.

Offline mentalthink

  • Prof. Inline
  • *****
  • Posts: 3375
  • Integrated Brain
    • View Profile
Re: X_World2Screen and X_Screen2World
« Reply #12 on: 2011-May-26 »
oK, Gernnot a lot of thanks