Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Render to Image - using a 3d plane image to display

Author
Message
haliop_New
User Banned
Posted: 11th Aug 2015 14:29
hi

so i have this 3d plane somewhere inside the virtual 3d world.

its size and position can vary...

renderImage = createRenderImage(2048,2048,0,0) // the render image attached to it

RednerObject = CreateObjectPlane(2048/10,2048/10) // the 3d plane object


in game loop when i press the mouse button i am turning the Screen Rendering into RenderToImage(renderImage,0)
then a sprite is being drawned into that image , and the result is shown on the 3d plane object.

so i have created a small blue box sprite to represent the cursor cause i dont really like windows cursor...

and what i want to achive is draw the sprite on the 3d plane render image only when the blue box cursor is on it
so what i did is:



so now i get the exact 3d point where both hit and thats where i want to paint so the Point X and Point Y should change before the actual drawsprite process .

so now im kinda stuck

sPointerX and sPointerY represents the vars that the sprite will be positioned on screen before drawned to image.
since im trieng to create the best resolution image i can handle or AppGameKit can handle i use 2048x2048 and i dont see any reason to take it down to for the DeviceWidth/Height..

any ideas how i can get the exact 2d pointer to 3d pointer to 2d correct vars so rendertoimage will do what i want ?

thank you for your time and sorry about the sum of text...

haliop.
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 11th Aug 2015 19:48 Edited at: 11th Aug 2015 19:48
can not follow at all ...
u need this because your pointer is a sprite?
GetScreenXFrom3D
GetScreenYFrom3D
or u just use a 3d plane as pointer instead of a sprite?

AGK (Steam) V2 Beta .. : Windows 10 Pro, 8.1 Pro 64 Bit : AMD (15.7.1) Radeon R7 265 : Mac mini OS X 10.10 (Yosemite)
haliop_New
User Banned
Posted: 12th Aug 2015 22:19
ohh sorry ...

ok this is what i have.


i have a mouse pointer as a sprite that is becouse i have also a 2d sprite base top and side menu so i use the same cursor for drawing and selecting a button a 2d button.

then i have a 3d object plane with a texture that takes a renderToimage texture. when i press the mouse button and only when the cursor throws a 3d ray cast from its position and hit the 3d object plane it starts drawing inside the RenderToImage then the 3d plane object updates its own texture with the rendertoimage id.

so what im trying to do is:

where ever the 3d raycast hits it should paint in that location of the image.

so if im clicking and the raycast shows your on x150 y 100 you take those vars and you turn them into Screen Coords and now when you paint it will paint exactly where the raycast hit.

the problem im facing is:

diffrent Virtual Resolutions
diffrent Device Resolutions
diffrent RenderToImage resolution
and
diffrent 3d object plane sizes

i know its tricky , here is a simple code of what im talking about.



for some reason the 3d ray cast dosent work very well.. in other projects it does... dont know what happend to it..

any help will be highly appreciated.
thank you for your time.
haliop.
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 13th Aug 2015 11:56 Edited at: 13th Aug 2015 11:57
I have posted useful information here. Follow the link in the post to a good demo by Paul.

Quidquid latine dictum sit, altum sonatur
TutCity is being rebuilt
haliop_New
User Banned
Posted: 14th Aug 2015 19:33
thank you
haliop.

Login to post a reply

Server time is: 2024-09-29 03:25:07
Your offset time is: 2024-09-29 03:25:07