Pages: 1 2 »
  Print  
Author Topic: Sprite_add crashes  (Read 2810 times)
Offline (Unknown gender) daz
Posted on: February 20, 2014, 10:52:45 AM
Contributor
Joined: Jul 2010
Posts: 167

View Profile
I have tried both versions of the sprite_add function and as soon as it's called it crashes the game.
Code: [Select]
spr_title = sprite_add(dataDir + "textures/title.png", 1, false, false, true, true, 0, 0);
spr_title = sprite_add(dataDir + "textures/title.png", 1, false, true, 0, 0);
(I did a file_exists on the path, it returned true)
background_add doesn't have any problems. I tried setting graphics engine to both OpenGL 1 and 3. I have tried changing up the parameters, nothing seems to matter.

Using portable exe from 2/18 if it helps.
Logged
Offline (Male) Goombert
Reply #1 Posted on: February 20, 2014, 12:18:52 PM

Developer
Location: Cappuccino, CA
Joined: Jan 2013
Posts: 3107

View Profile
What size is the image?
Logged
I think it was Leonardo da Vinci who once said something along the lines of "If you build the robots, they will make games." or something to that effect.

Offline (Unknown gender) daz
Reply #2 Posted on: February 20, 2014, 12:36:42 PM
Contributor
Joined: Jul 2010
Posts: 167

View Profile
1191x271

I went ahead and finished your thought. I padded this image with whitespace to the dimensions 2048x512 and it worked.

I'm lazy, but I was able to successfully sprite_add it and draw_sprite_part. Guess I'll be making my own atlases for the time being!
Logged
Offline (Male) Goombert
Reply #3 Posted on: February 21, 2014, 04:16:07 PM

Developer
Location: Cappuccino, CA
Joined: Jan 2013
Posts: 3107

View Profile
Post the image anyway, because draw_sprite_part should work regardless of whether the texture is power of two. It needs fixed.
Logged
I think it was Leonardo da Vinci who once said something along the lines of "If you build the robots, they will make games." or something to that effect.

Offline (Unknown gender) daz
Reply #4 Posted on: February 21, 2014, 09:42:12 PM
Contributor
Joined: Jul 2010
Posts: 167

View Profile
Sure if you want the image that causes the crash, here: https://dl.dropboxusercontent.com/u/1215621/title.png
Logged
Offline (Unknown gender) Darkstar2
Reply #5 Posted on: February 22, 2014, 01:49:42 AM
Member
Joined: Jan 2014
Posts: 1244

View Profile Email
Ok, running some tests, I could reproduce the crash when game is run from the IDE.

When building / compiling the EXE, the EXE runs fine, no crash.  I hope this bit of info can help.
I just placed a controller object in an empty room and
added the code in the create event.

This is a PNG with alpha transparency, I will run other tests.



Logged
Offline (Unknown gender) Darkstar2
Reply #6 Posted on: February 22, 2014, 02:07:30 AM
Member
Joined: Jan 2014
Posts: 1244

View Profile Email
Well fuck me !  :D now it's crashing even in the compiled EXE !  ??? 
I tried different modules, modes, etc, same.....
tried sprite_add_alpha and it tells me function does not exist. lol.

I tried adding it through the create resource in the IDE,
it worked, no crash, and it displayed properly as it should.

I tried converting the PNG into a BMP, GIF, etc, same thing.

Hope this helps. 

Wow this reminds me I used to get this kind of thing a lot when working with 8.1 and studio importing certain files.
I hope you find a solution to this :)

Also using the latest portable + latest jars

« Last Edit: February 22, 2014, 02:12:42 AM by Darkstar2 » Logged
Offline (Unknown gender) Darkstar2
Reply #7 Posted on: February 22, 2014, 03:00:10 PM
Member
Joined: Jan 2014
Posts: 1244

View Profile Email
Any updates ? news on the issue ?
Logged
Offline (Male) Goombert
Reply #8 Posted on: February 22, 2014, 04:00:06 PM

Developer
Location: Cappuccino, CA
Joined: Jan 2013
Posts: 3107

View Profile
Confirmed the issue only exists for sprite_add and background_add and is the result of the transparency parameter and the calculation of the collision box. It is because these two loops do not know the actual size of the pixel data array in order to loop it properly. I tested with the following code.
Code: (EDL) [Select]
show_message(working_directory+"/title.png");
sprite_index = sprite_add(working_directory+"/title.png",1,1,0,0,0);

Edit: I have discovered the full issue and was able to get it to draw properly. Apparantly some Joe Jerkoff thinks our universal graphics system abstract image code is supposed to retrofit powers of two, even though that's is not graphics system agnostic behavior.


This can be fixed fully when we add texture atlasing.
https://github.com/enigma-dev/enigma-dev/issues/653
« Last Edit: February 22, 2014, 05:17:34 PM by Robert B Colton » Logged
I think it was Leonardo da Vinci who once said something along the lines of "If you build the robots, they will make games." or something to that effect.

Offline (Unknown gender) TheExDeus
Reply #9 Posted on: February 22, 2014, 05:52:55 PM

Developer
Joined: Apr 2008
Posts: 1872

View Profile
Quote
Apparantly some Joe Jerkoff thinks our universal graphics system abstract image code is supposed to retrofit powers of two, even though that's is not graphics system agnostic behavior.
Actually that IS the graphics system agnostic behavior. Power of two will work on every GPU ever made, while non power of two will not. Today it might not be such a big of a problem on desktop PC's, but embedded devices still often have this limitation. The only way around that is to use texture atlasing. Something every graphics engine usually has.
Logged
Offline (Male) Goombert
Reply #10 Posted on: February 22, 2014, 05:56:15 PM

Developer
Location: Cappuccino, CA
Joined: Jan 2013
Posts: 3107

View Profile
Yes Harri, I recanted halfway through, I thought the behavior on graphics cards that didn't support it was to just fit it to a power of two size. And then later changed the ticket to texture atlasing. That said, I can implement all the options to LateralGM but the texture atlasing needs designed around that, if somebody is going to do it ENIGMA side then I will go ahead and add it LGM side.
Logged
I think it was Leonardo da Vinci who once said something along the lines of "If you build the robots, they will make games." or something to that effect.

Offline (Unknown gender) TheExDeus
Reply #11 Posted on: February 22, 2014, 06:13:32 PM

Developer
Joined: Apr 2008
Posts: 1872

View Profile
But I don't think texture atlasing during runtime is the best idea for included resources. GM:S does texture atlasing in GM and then just adds the large texture as a resource. At least I think it does, because GM allows seeing texture pages inside the IDE. Texture atlasing will need to be done ENIGMA side too of course, because of sprite_add and so on.
Logged
Offline (Male) Goombert
Reply #12 Posted on: February 23, 2014, 01:29:28 AM

Developer
Location: Cappuccino, CA
Joined: Jan 2013
Posts: 3107

View Profile
Well it still needs fixed atm, and I have fixed his issue in my local version but now I am trying to figure out the saving power of two issues. And I want to recant again, I was correct in my initial premise partially. Because every sprite and background function shouldnt be doing the padding, this is graphics system dependent and the padding should be moved to graphics_create_texture/graphics_get_rgba_data and the universal system can provide utility functions for padding and cropping the data in its image format code, which will in turn also lead to less code.

This has now been resolved temporarily in the following pull request with Josh's help. By temporarily I mean it fixes it, but doesn't get started with texture atlasing, but does fix the issue properly.
https://github.com/enigma-dev/enigma-dev/pull/654
Logged
I think it was Leonardo da Vinci who once said something along the lines of "If you build the robots, they will make games." or something to that effect.

Offline (Male) time-killer-games
Reply #13 Posted on: February 23, 2014, 12:52:02 PM

Contributor
Location: Virginia Beach
Joined: Jan 2013
Posts: 1157

View Profile Email
When GMS originally released the C++ runner during the beta season, sprite/background_add() could successfully load and draw PNG, JPG, BMP, GIF, and for just sprite_add() animated GIF.Since then in GMS all those image formats other than PNG were dropped because they "weren't cross-platform compatible" even though they technically are. So yet another thing we could have that GMS will never have are those external image importing formats that Studio dropped, but that is only IF such functionality were added to ENIGMA, because right now, we only support BMP, which isn't compatible w/ studio, studio only has PNG. So if we aren't going to support JPG, GIF, and animated GIF, we should at least support PNG to be more compatible with Studio and the fact BMP doesn't support partial alpha transparency, but PNG does.
Logged
Offline (Unknown gender) Darkstar2
Reply #14 Posted on: February 23, 2014, 01:28:38 PM
Member
Joined: Jan 2014
Posts: 1244

View Profile Email
lol!

Yep you nailed it once again, they seem to have an acquired skill of butchering and removing, sometimes I wonder, are they removing more stuff than they are adding ? At this rate what's going to be left for cross platform compatibility sake ! 

Actually if you translate to proper english it would have nothing to do with cross platform, they could easily fix this but it would require some minimal work ;) God forbid !

So translated it means:

"We don't want to bother making it cross platform." 

BTW, what about the less talked about MNG (animated PNG), ? Whatever happened to this format ? Did not pick up ? I remember many years ago I was using software for animated GIFs, and it supported MNG as well :)
Logged
Pages: 1 2 »
  Print