• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!
  • Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

HTML5 [SOLVED] Surfaces Doesn't Work Correctly In HTML5

  • Thread starter JoccumTV Studio
  • Start date
J

JoccumTV Studio

Guest
Hello,

HTML5 it doesn't work correctly with surfaces.
The Layers under the surface will be blue. There are no Sprites under.
In Windows all works correctly.

Here are some pictures:
Windows:


HTML5:
 
J

JoccumTV Studio

Guest
how are you drawing your surfaces?
I create a surface with:

light = surface_create(view_xview,view_yview)

(But I have imported the view gml from GMS1.4)

I create the colored overlay with:

surface_set_target(light);
draw_set_color(the color overlay)
draw_rectangle(0,0,view_wview,view_hview,false);
surface_reset_target();

I draw the light circle with:

gpu_set_blendmode(bm_subtract);
surface_set_target(light);
draw_ellipse_color(x - radius / 2 - view_xview, y - radius / 2 - view_yview, x + radius / 2 - view_xview, y + radius / 2 - view_yview, c_orange, c_black, false);
surface_reset_target();
gpu_set_blendmode(bm_normal);

I draw the color overlay with:

gpu_set_blendmode(bm_subtract);
draw_surface(the surface, view_xview, view_yview);
gpu_set_blendmode(bm_normal);

I hope you can help me! :)
 
J

JoccumTV Studio

Guest
Is all code in "DRAW" event ?
The surface is created in the create event.

The draw light is in the end step event.

The color overlay creation in the step.

The over is drawing in the draw event
 

gnysek

Member
Read manual about surfaces and you will find all anwsers (that you should draw on surface only in draw event).
 
J

JoccumTV Studio

Guest
Read manual about surfaces and you will find all anwsers (that you should draw on surface only in draw event).
Thank you,

but it's weird it doesn't work in HTML5 but in Windows it works correctly.

I will check the manual. :)
 
D

Deleted member 13992

Guest
drawing should ideally only happen in the Draw or Draw GUI events. drawing in step events might work on PCs because they are that much more flexible. on mobile and HTML5, there are lots more compromises with the hardware and API, so they are much more rigid/less forgiving.
 
J

JoccumTV Studio

Guest
drawing should ideally only happen in the Draw or Draw GUI events. drawing in step events might work on PCs because they are that much more flexible. on mobile and HTML5, there are lots more compromises with the hardware and API, so they are much more rigid/less forgiving.
Thank you for your comment. But it works!
HTML5 does only use surfaces as you use WebGL.
And i had it disabled.

It's Fixed!

Thank you all for your comments! :D
 

Mike

nobody important
GMC Elder
Surfaces work fine on both canvas and WebGL, but BLEND MODES only work in WebGL - which you're making use of.
 
Top