Jump to content


Photo

Rare Alpha problem!


  • Please log in to reply
2 replies to this topic

#1 lester3857

lester3857

    GMC Member

  • New Member
  • 14 posts

Posted 05 July 2012 - 08:42 PM

Can any help me?
surface_set_target(surface)//Set drawin surface
draw_clear_alpha(0,0); //Clear screen errors
with(xdat2_all_parent)//Choose Objects
{

//if not position_meeting(x,y-32,xdat2_all_parent)
draw_sprite_ext(sprite_index,image_index,x,y,image_xscale,image_yscale,image_angle,c_white,1)
draw_sprite_ext(sprite_index,image_index,x,y,image_xscale,image_yscale,image_angle,c_black,.7)
}
surface_reset_target()//restore surface to screen

The 2 sprites are drawn on the transparency of 0.7- Why? First draw it's on 1 and then on 0.7 alpha
I check the surface drawing alpha and image_alpha but dont work!
Please help me! Only happends on Surface!:unsure:

Edited by lester3857, 05 July 2012 - 09:13 PM.

  • 0

#2 Nocturne

Nocturne

    Nocturne Games

  • Administrators
  • 16823 posts
  • Version:GM:Studio

Posted 06 July 2012 - 10:36 AM

Surfaces are not drawn with a composite alpha, but rather takje the alpha of the last thing drawn on each pixel. It's a pain, but you will need to use a pre-multiplying technique...

surface_set_target(surface)//Set drawin surface
draw_clear_alpha(0,0); //Clear screen errors
with(xdat2_all_parent)//Choose Objects
{
//if not position_meeting(x,y-32,xdat2_all_parent)
draw_set_blend_mode_ext(bm_one, bm_inv_src_alpha);
draw_sprite_ext(sprite_index,image_index,x,y,image_xscale,image_yscale,image_angle,c_white,1)
draw_sprite_ext(sprite_index,image_index,x,y,image_xscale,image_yscale,image_angle,c_black,.7)
draw_set_blend_mode(bm_normal)
}
surface_reset_target()//restore surface to screen

Soemthing like that may work... For more information see this topic : http://gmc.yoyogames...howtopic=474273
  • 1

#3 lester3857

lester3857

    GMC Member

  • New Member
  • 14 posts

Posted 06 July 2012 - 07:44 PM

Surfaces are not drawn with a composite alpha, but rather takje the alpha of the last thing drawn on each pixel. It's a pain, but you will need to use a pre-multiplying technique...

surface_set_target(surface)//Set drawin surface
draw_clear_alpha(0,0); //Clear screen errors
with(xdat2_all_parent)//Choose Objects
{
//if not position_meeting(x,y-32,xdat2_all_parent)
draw_set_blend_mode_ext(bm_one, bm_inv_src_alpha);
draw_sprite_ext(sprite_index,image_index,x,y,image_xscale,image_yscale,image_angle,c_white,1)
draw_sprite_ext(sprite_index,image_index,x,y,image_xscale,image_yscale,image_angle,c_black,.7)
draw_set_blend_mode(bm_normal)
}
surface_reset_target()//restore surface to screen

Soemthing like that may work... For more information see this topic : http://gmc.yoyogames...howtopic=474273


thanks! Works Fine! Thanks man! :thumbsup: :biggrin:

Edited by lester3857, 06 July 2012 - 07:46 PM.

  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users