Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » Strange artifacts...

Credits go to SiegeLord for helping out!
This thread is locked; no one can reply to it. rss feed Print
Strange artifacts...
J-Gamer
Member #12,491
January 2011
avatar

I noticed that there is a Python port, so I decided to test it out(since we've just finished our Python course at uni).

I made a little Pong game, but there are some rendering issues... When drawing the paddles, there seems to some tearing with the blending. Here's my paddle drawing code:

def draw(self):
        # Fill
        al_draw_filled_rounded_rectangle(self.x, self.y, self.x + self.w, self.y + self.h, 6, 6, self.color)
        # Highlight
        al_draw_filled_rounded_rectangle(self.x+2, self.y+2, self.x + self.w/2, self.y + self.h-5, 6, 6, al_map_rgba_f(0.2,0.2,0.2,0.2))

Here's my current output:
{"name":"605076","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/a\/8\/a83044138b031d1b775b0f0c6f3f844e.png","w":800,"h":600,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/a\/8\/a83044138b031d1b775b0f0c6f3f844e"}605076

Any ideas why this is happening?

" There are plenty of wonderful ideas in The Bible, but God isn't one of them." - Derezo
"If your body was a business, thought would be like micro-management and emotions would be like macro-management. If you primarily live your life with emotions, then you are prone to error on the details. If you over-think things all the time you tend to lose scope of priorities." - Mark Oates

SiegeLord
Member #7,827
October 2006
avatar

The width of your rounded rectangle is smaller than the sum of the radii of the rounds. Here's a blowup of what is happening:

{"name":"605078","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/e\/9\/e9ab6bf8d8ebbcaf59133c3e206e3b2c.png","w":404,"h":330,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/e\/9\/e9ab6bf8d8ebbcaf59133c3e206e3b2c"}605078

I'd just decrease the radius of the rounds (to like 5 or 4 or something).

"For in much wisdom is much grief: and he that increases knowledge increases sorrow."-Ecclesiastes 1:18
[SiegeLord's Abode][Codes]:[DAllegro5]:[RustAllegro]

J-Gamer
Member #12,491
January 2011
avatar

Thanks, that fixed it!

" There are plenty of wonderful ideas in The Bible, but God isn't one of them." - Derezo
"If your body was a business, thought would be like micro-management and emotions would be like macro-management. If you primarily live your life with emotions, then you are prone to error on the details. If you over-think things all the time you tend to lose scope of priorities." - Mark Oates

Go to: