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 / i think no understand this with render to image

Author
Message
pamercomov
FPSC Reloaded TGC Backer
9
Years of Service
User Offline
Joined: 2nd Jan 2015
Location: palma de mallorca
Posted: 15th Jun 2020 15:30
please...

i have this code


I am trying to make a minimap.

I have read in the forum that we can only use one camera, so what I try is to place the camera, get that image and apply that image to a sprite that I have on screen ...

I know I'm doing something wrong because the sprite is always white and I can't get a single image ...

can you please indicate the steps in the correct order to be able to paint the sprite with the image obtained when recollecting the camera

very very very thx
using AppGameKit V2 tier 1
janbo
15
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 15th Jun 2020 19:09 Edited at: 15th Jun 2020 19:11
In your example code i'd first recommend you to create the renderimage outside of the main loop, clear the screen before rendering the mipmap texture and also paste Render() after you set to render to the screen again or are you using sync() after your DrawMinimap() function ?
Then lets see what happens ...maybe post a screenshot and some code of your main loop ?
Golelorn
7
Years of Service
User Offline
Joined: 20th Nov 2016
Location:
Posted: 16th Jun 2020 00:15 Edited at: 16th Jun 2020 00:22


I've added comments. I usually drawObjects() instead of render(), though. So, could still need refinement.
pamercomov
FPSC Reloaded TGC Backer
9
Years of Service
User Offline
Joined: 2nd Jan 2015
Location: palma de mallorca
Posted: 16th Jun 2020 08:50
Thank you very much .... this already works ... the problem is that it has the image that I get is of very poor quality .... I suppose that it has to see when rescaling the image to apply it to the sprite .... I have tried to create the image and the sprite of the same size so that it has not rescaled but it is all very very blurred and you can hardly distinguish anything. On the other hand, how can I set the camera so that the minimap works as an orthographic? maybe it would improve
using AppGameKit V2 tier 1
janbo
15
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 16th Jun 2020 08:58
pamercomov wrote: "the problem is that it has the image that I get is of very poor quality"

The image you are rendering to is only 160*120 pixels so...
pamercomov wrote: "how can I set the camera so that the minimap works as an orthographic?"

SetCameraFOV( 1, 0 )

@Golelorn: SetRenderToImage(1, -1) is only needed if you are rendering a 3D scene and need the objects sorted in depth.
pamercomov
FPSC Reloaded TGC Backer
9
Years of Service
User Offline
Joined: 2nd Jan 2015
Location: palma de mallorca
Posted: 16th Jun 2020 12:19 Edited at: 16th Jun 2020 17:28
mmmm....
two other things that are happening now ...
If I use setcamerafov (1,0), it does not affect the distance I put from the camera and everything looks too close, a close-up.

afterwards, I have some particles that can be seen perfectly if I deactivate the minimap, but if I activate it they are square, as if they did not blend correctly ...

PS: how can I take a screenshot .... I tried the print screen button on the keyboard, so you could see what the particles are, but it captures all black

edit1: im trying this



but nothing happens or I can't find the image in the middle folder
edit
Quote: "If I use setcamerafov (1,0), it does not affect the distance I put from the camera and everything looks too close, a close-up."

this is already understood and solved, with this

SetCameraFOV(1,0)
SetCameraOrthoWidth( 1, 480 )

missing to solve or know what happens to the particles
using AppGameKit V2 tier 1
pamercomov
FPSC Reloaded TGC Backer
9
Years of Service
User Offline
Joined: 2nd Jan 2015
Location: palma de mallorca
Posted: 16th Jun 2020 13:03
I upload two examples for you to see, one with a minimap and the other without rendering the minimap, just change that ...
this is the function drawminimap


and this is the loop
using AppGameKit V2 tier 1
pamercomov
FPSC Reloaded TGC Backer
9
Years of Service
User Offline
Joined: 2nd Jan 2015
Location: palma de mallorca
Posted: 17th Jun 2020 19:43
I do not understand why the images that I upload are not seen
using AppGameKit V2 tier 1
ando
4
Years of Service
User Offline
Joined: 21st Feb 2020
Location: Australia
Posted: 17th Jun 2020 21:48
Hi, in your first post I see....

render()
SetSpriteImage(minimapa,1)

Maybe switch around...

SetSpriteImage(minimapa,1)
render()

Also I played with render texture in this project and maybe can help

https://forum.thegamecreators.com/thread/226343#msg2656245
I'm a time traveller from 40 years ago. You'll never guess how long it took to get here.
ando
4
Years of Service
User Offline
Joined: 21st Feb 2020
Location: Australia
Posted: 18th Jun 2020 01:53 Edited at: 20th Jun 2020 19:47
I just made this as a test. Hope it helps.



Never play leap frog with a unicorn.

Attachments

Login to view attachments
pamercomov
FPSC Reloaded TGC Backer
9
Years of Service
User Offline
Joined: 2nd Jan 2015
Location: palma de mallorca
Posted: 19th Jun 2020 11:09 Edited at: 19th Jun 2020 11:09
thanks, seeing your example code I have fixed the minimap and at the same time the one that arose from the particles, I was erroneously assigning the id but this is it ..... thank you very much.
this community has been and continues to be spectacular with newbies
using AppGameKit V2 tier 1
Golelorn
7
Years of Service
User Offline
Joined: 20th Nov 2016
Location:
Posted: 19th Jun 2020 23:09
Quote: "@Golelorn: SetRenderToImage(1, -1) is only needed if you are rendering a 3D scene and need the objects sorted in depth."


OK, I really have to laugh at myself. I always thought that had to do with a depth map. Not 3d drawing, which is what I am assuming you mean.
janbo
15
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 20th Jun 2020 19:17
It does have to do with depth maps but -1 takes a depth map generated and managed by AGK. And for 2D you dont need depth maps obviously...thats all

Login to post a reply

Server time is: 2024-03-28 14:53:50
Your offset time is: 2024-03-28 14:53:50