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 / Weird error message with GetImage()

Author
Message
Arch-Ok
AGK Developer
4
Years of Service
User Offline
Joined: 11th Jul 2019
Location: Bursa/TÜRKIYE
Posted: 14th Sep 2019 20:00 Edited at: 15th Sep 2019 11:39
I think it is a bug;

At that line the commands are;
MazeImage = GetImage(0, 0, ScopeSize, ScopeSize)
MapSprite = CreateSprite(MazeImage)
SetSpritePosition(MapSprite, X0, Y0)
SetSpriteDepth(MapSprite, 11)
SetSpriteVisible(CircleMask, _TRUE_)
SetSpriteVisible(AlphaMask, _TRUE_)


I've nothing to do with setrawwritepath at that point.

rendering to an image
getting mazeimage, creating a sprite with it, rendering it and then deleting it to reuse it.

Actually, i wish drawn boxes could be behinde the sprites, their depths also could be adjusted.

Anyways, probably a bug with the error system I guess...

Attachments

Login to view attachments
Arch-Ok
AGK Developer
4
Years of Service
User Offline
Joined: 11th Jul 2019
Location: Bursa/TÜRKIYE
Posted: 15th Sep 2019 11:39
Ok. I've uploaded the error message but it seems the file is not uploaded.

GetImage command gives the error "setrawpath something something bla bla"

So;

The GetImage command is not working while rendering to the image and using CopyImage instead of GetImage is solution but it is really slow.

So, I was trying to make a radar and achieved that;

I hid all sprites, HUD, 3D objects;
I draw map on a render image
I made a sprite from that
I rendered that sprite to new render image
I put two sprites on the new sprite
rendered it
and I made sprite from the final render image;

It works nice on windows but the first render image does not updates on android

PS: I've added the error image to the first post

Attachments

Login to view attachments
Arch-Ok
AGK Developer
4
Years of Service
User Offline
Joined: 11th Jul 2019
Location: Bursa/TÜRKIYE
Posted: 15th Sep 2019 12:14
I am deleting both render images and then recreating them every frame and now android phone draws the map but it is very slow

may be 1 draw per 8 frames??
Cybermind
Valued Member
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: Denmark
Posted: 15th Sep 2019 14:03 Edited at: 15th Sep 2019 14:04
First, mipmaps should be turned off as this could be a performance hit according to help files if you go with the CreateRenderImage approach. Second, I would use images/sprites that are just for map rendering, so that you don't render an entire image but just move around a few sprites or change their image for updating the mini-map.
13/0
Arch-Ok
AGK Developer
4
Years of Service
User Offline
Joined: 11th Jul 2019
Location: Bursa/TÜRKIYE
Posted: 15th Sep 2019 15:15
The mipmaps are off and render images are really small. The code runs very well on windows but not on android! The first renderimage doesn't updates but the second does. Tried to use render(), sync(), update2d() etc...

The game map is dynamic and a minimal raycast (very fast) is performed to determine if the grid is travelled. (yes it is really a nice thing to see in a game.) I couldn't find a way to achive the attached result just using images/sprites, if you can can you tell me please?

Attachments

Login to view attachments
Cybermind
Valued Member
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: Denmark
Posted: 15th Sep 2019 19:26
Do you also use SetRenderToImage and SetRenderToScreen? And also, on Android, depth is not supported so here you should use -1 or 0 as depth parameter.
13/0
Arch-Ok
AGK Developer
4
Years of Service
User Offline
Joined: 11th Jul 2019
Location: Bursa/TÜRKIYE
Posted: 15th Sep 2019 20:32
Yes I am using them correctly. Yes the image is created with param 0.

Anyways I drew the updated map into a memblock (oh god I wish I could use some inline assembly there) and then created a new image from that (after deleting the old one), set the sprite image to that and used a thick ring image to show square sprite as a circle shaped sprite but no alpha sprite used on it, it was a little more faster. I am trying new algorithms to achive that, if i can i will share it.

One thing is certain! On the help page for SetRenderToImage();
"For a more detailled explanation, when you render to an image it will draw to the image exactly what it would have drawn to the screen"
This is not true for android phone (at least for mine -Samsung S4 - yes it is old-)!
I hope they fix it!

And I do hope we will be able to get an image's pixel offset, a memory blocks real pointer, a variables address and use some inline assembly! not the ports, not the avx -ymm zmm vdpps- but just some edi, esi, lea, mov, and, js ... would be great!
Arch-Ok
AGK Developer
4
Years of Service
User Offline
Joined: 11th Jul 2019
Location: Bursa/TÜRKIYE
Posted: 16th Sep 2019 22:29
It seems that render to image is faulty on samsung s4!
It only updates to the desired result when the app lost focus and regain it!
Or deleting and recreating the renderimage is a solution but very slow!

Anyways pc version of the app is really sweat and I will not give up on agk2 yet!

Attachments

Login to view attachments
Arch-Ok
AGK Developer
4
Years of Service
User Offline
Joined: 11th Jul 2019
Location: Bursa/TÜRKIYE
Posted: 20th Sep 2019 01:07
Ok. It's done with a very simple shader. First image is the tile map and second image is a white (1.0, 1.0, 1.0, 1.0) filled circle. The corners of the white circle is black (0.0, 0.0, 0.0, 0.0) (the rest of the square which contains white filled circle is black)
The shader just multiplies the pixels at same uv in the first and second texture. The sprite transparency is set to 2 also.

The tricky part is to re-create the maze map image every frame.

It is done with memblocks with a very clever way. Copy memblock used after defining a single line in another memblock.

And the fps is the same with or without the rotating circle shaped dynamic mini map.

but still at the agk side 'rendertoimage' is faulty and slow on mobile (at least on my s4) and getting image when not rendering to the screen gives wrong error message

Attachments

Login to view attachments

Login to post a reply

Server time is: 2024-04-18 11:51:04
Your offset time is: 2024-04-18 11:51:04