View Issue Details

IDProjectCategoryView StatusLast Update
0018170Runner3DPublic2017-08-04 14:06
ReporterxotAssigned ToMike Dailly 
PriorityLowSeverityC - GeneralReproducibility100%
Status ClosedResolutionFixed 
PlatformWindowsOSWindow 8.1OS Version64-bit Home
Product Version 
Target VersionFixed in Version 
Summary0018170: image_index rounds differently depending on context
DescriptionWith normal sprite drawing functions, image_index is floored when selecting a sprite subimage to draw.

With texture functions, image_index is rounded to the nearest integer when select a sprite subimage to reference.

With shader functions, image_index is sometimes rounded to the nearest integer when selecting a sprite subimage to reference. It appears to behave differently depending on if the sprite occupies more than one texture page. This may be due to the GGS texture page size setting or the "Used for 3D" setting.
Steps To ReproduceIn the attached example, a "1" or a "2" appear depending on the rounding of image_index which is set to a value of 0.55.

In the top portion, the left is drawn with draw_self() and the right is drawn using a primitive textured by the current sprite and subimage settings.

In the lower portion, a shader is used to draw the current sprite and subimage. A "1" appears in the red channel when the shader references gm_BaseTexture and a "2" appears in the blue channel when the shader uses a staged textures which is set to display the same image.

If the GGS texture page size is increased so that the sprite occupies only one page, the shader functions as expected.

Workaround: Always use floor(image_index) for operations which require a sprite subimage.
Additional InformationOnly Windows and Windows (YYC) have been tested. HTML5 failed to run under Chrome.
1.4 Found In1.99.402
2.x Runtime Found In
2.x Runtime Verified In



2015-06-06 12:53


image_index.gmz (1,179,251 bytes)


2015-06-06 12:53

Updater   ~0037711

Last edited: 2015-06-06 12:53

View 2 revisions

Related: #0016388


2015-06-06 13:05



2015-06-06 13:14

Updater   ~0037712

Function sprite_get_tpe(sprite, index) should probably be looked at. I don't know how to use it so it was not tested.

Mike Dailly

2017-04-21 14:37

Manager   ~0052866

fixed - all display 1 on windows (GMS2) and HTML5