Surface Problem

Posted by Moikle on Sept. 20, 2010, 2:06 p.m.

First things first, am I doing something wrong? I have used surfaces before, but I have only recently got back into gm after ages of not touching it. When using surfaces in a little test, I ran across a problem, when displayed the image is all fractured and white lines appear, I’ve whittled down the code to as simple as I can while still using surfaces, but I still get the fracturing.

creation

 bases=surface_create(500,333) 

draw

 surface_set_target(bases)
draw_sprite(base,1,x,y)
surface_reset_target()
draw_surface(bases,x,y)

Is this something like my graphics card messing up, has gm just derped, or have i missed something stupid again?

Also, can I preserve the alpha channel on a surface? Drawing an image using bm_add and transfer it to a surface without losing the alpha channel? Or does it do this automatically?

If not, then is there any way I can run bm_subtract, and then bm_inv_src_color on a single sprite in that order?

Haha, my previous three blogs are asking for help.

Comments

Juju 14 years, 3 months ago

surface_set_target(bases)
[i]draw_clear(c_white)[/i]
draw_sprite(base,1,x,y)
surface_reset_target()
draw_surface(bases,x,y)

Moikle 14 years, 3 months ago

oh yeah, thanks.

i forgot about clearing the surface first.

Cesque 14 years, 3 months ago

I never used surfaces, but that graphic effect looks cool :P

Castypher 14 years, 3 months ago

I never used surfaces until I tried advanced lighting, which made me realize that surfaces are actually pretty powerful as far as effects go.

Juju 14 years, 3 months ago

Yeah, surfaces are great (in GM7 and above where that annoying scaling bug doesn't happen) (also, apart from the issues with alpha channels) (they're kinda slow sometimes) (oh yeah, the memory leaking gets pretty annoying).

marbs 14 years, 3 months ago

(Juju has much surface experience)

Lapixx 14 years, 3 months ago

Also, press CTRL+ALT+DEL in Vista or 7, or wait for the screensaver to appear. Then take a look at your (suddenly) non existing surface :/

Juju 14 years, 3 months ago

That as well. Basically, they're great in principle and in the brief moments between bugs and tearing your hair out in frustration with the arcane blend modes, they're truly joyous.