vdweller
Member
Bros,
I have the following issue: I am working on a list menu where essentially the elements (buttons with text) are packed together in vertical columns. I want to use a rectangle shape as a border for each element. So I am using
draw_rectangle_color(x1,y1,x2,y2,cba,cba,cba,cba,1);
Buuut...as you can see, the rectangle is bloated by 1 pixel or so:
I am *perfectly* sure the coordinates are correct: using a draw_sprite_ext to stretch a white pixel across an element's dimensions and 0.5 alpha fills the area perfectly. If each box coordinates overlapped then doing that would produce "lines" across the box borders, where two 0.5 alphas overlap.
So, instead of draw-rectangle_color, I try
draw_set-color(color); draw_rectangle(blah);
And the display is, this time, correct:
Sooo...I am aware from older posts that when it comes to shapes, you can't please every graphics driver. Sure, I could probably manually alter the offset, but will this be consistent across all other PCs? I tested these methods on my older PC too, the result is the same, but this isn't a large enough sample to be sure that draw_rectangle_color behaves like that at all times across all systems.
Moreover...it's a matter of speed: I have no problem setting the color then drawing a rectangle like in my second method, but I am not sure it's the faster way and I don't want to benchmark this on my (rather fast) GPU since results will probably vary with each GPU implementation of drawing such shapes. I want to use this menu on a very resource intensive environment (a colony simulation game) so every batch break counts...
So do you have any insight on this? Is this a universal thing? Should I abandon draw_rectangle_color altogether? Should I use it with manually correcting the coords because it behaves the same across all systems? Any alternatives?
EDIT: For the sake of reference, on my system draw_rectangle color appears to be ~2x faster than { draw_set_color(); draw_rectangle(); }. Moreover, the second method takes 1 vertex batch more than the first (25 batches for 10 menu boxes in method #1 became 35 in method #2).
EDIT2: I am using only integer coordinates and no views.
EDIT3: OK my PC is probably on drugs but drawing 4 stretched pixel as rectangle borders is faster even than draw_rectangle_color(), about 2 times faster.... wtf
I have the following issue: I am working on a list menu where essentially the elements (buttons with text) are packed together in vertical columns. I want to use a rectangle shape as a border for each element. So I am using
draw_rectangle_color(x1,y1,x2,y2,cba,cba,cba,cba,1);
Buuut...as you can see, the rectangle is bloated by 1 pixel or so:
I am *perfectly* sure the coordinates are correct: using a draw_sprite_ext to stretch a white pixel across an element's dimensions and 0.5 alpha fills the area perfectly. If each box coordinates overlapped then doing that would produce "lines" across the box borders, where two 0.5 alphas overlap.
So, instead of draw-rectangle_color, I try
draw_set-color(color); draw_rectangle(blah);
And the display is, this time, correct:
Sooo...I am aware from older posts that when it comes to shapes, you can't please every graphics driver. Sure, I could probably manually alter the offset, but will this be consistent across all other PCs? I tested these methods on my older PC too, the result is the same, but this isn't a large enough sample to be sure that draw_rectangle_color behaves like that at all times across all systems.
Moreover...it's a matter of speed: I have no problem setting the color then drawing a rectangle like in my second method, but I am not sure it's the faster way and I don't want to benchmark this on my (rather fast) GPU since results will probably vary with each GPU implementation of drawing such shapes. I want to use this menu on a very resource intensive environment (a colony simulation game) so every batch break counts...
So do you have any insight on this? Is this a universal thing? Should I abandon draw_rectangle_color altogether? Should I use it with manually correcting the coords because it behaves the same across all systems? Any alternatives?
EDIT: For the sake of reference, on my system draw_rectangle color appears to be ~2x faster than { draw_set_color(); draw_rectangle(); }. Moreover, the second method takes 1 vertex batch more than the first (25 batches for 10 menu boxes in method #1 became 35 in method #2).
EDIT2: I am using only integer coordinates and no views.
EDIT3: OK my PC is probably on drugs but drawing 4 stretched pixel as rectangle borders is faster even than draw_rectangle_color(), about 2 times faster.... wtf
Last edited: