BRT Community

Please login or register.

Login with username, password and session length
Advanced search  

News:

Welcome to the Bridgetek Community!

Please read our Welcome Note

Technical Support enquires
please contact the team
@ Bridgetek Support

Please refer to our website for detailed information on all our products - Bridgetek - Bridging Technology

Author Topic: BEGIN(RECTS) primitive and LINE_WIDTH  (Read 810 times)

durian

  • Newbie
  • *
  • Posts: 15
    • View Profile
BEGIN(RECTS) primitive and LINE_WIDTH
« on: November 10, 2021, 10:28:14 PM »

Section 2.10.4 of the AN_033 programming guide says the current line width is used to round the corners when using the BEGIN(RECTS) primitive. It says, "Line width size is used for corner curvature, LINE_WIDTH pixels are added in both directions in addition to the rectangle dimension".

How does one get square corners, then? It would seem setting LINE_WIDTH to 0 would create a rectangle with square corners at exactly the size specified by the VERTEX2F() coordinates. But when I try that, the rectangle isn't drawn at all. Do I need to use a LINE_WIDTH of 1 pixel and then shrink my rectangle by 0.5 pixel at each coordinate? That seems rather awkward.

Is it better to avoid using BEGIN(RECTS) entirely and instead use SCISSOR and CLEAR to create rectangles?
Logged

david

  • Newbie
  • *
  • Posts: 15
    • View Profile
Re: BEGIN(RECTS) primitive and LINE_WIDTH
« Reply #1 on: November 12, 2021, 05:11:10 PM »

That's what I am using:

Code: [Select]
BEGIN(RECTS)
if (roundedCorners) {
LINE_WIDTH(10 * 16)
} else {
LINE_WIDTH(1 * 16)
}
VERTEX2F(x * 16, y * 16)
VERTEX2F((x + width) * 16, (y + height) * 16)

And I get completely sharp corners (if you use the !roundedCorners version).
You said you would need to shrink it, do you still get rounded corners when you use 1 * 16 as width or did I misunderstand the question?
Logged

durian

  • Newbie
  • *
  • Posts: 15
    • View Profile
Re: BEGIN(RECTS) primitive and LINE_WIDTH
« Reply #2 on: November 22, 2021, 06:52:48 PM »

Hi David,
Thanks for the reply. I set up a test and created one rectangle using SCISSOR and CLEAR and compared it to a rectangle using BEGIN(RECTS) with a line width of 16 * 1. I see a little bleed into the surrounding pixels when I use BEGIN(RECTS). It's subtle, but the edges definitely aren't as crisp as when I use SCISSOR.

So I guess, if I want the sharpest possible rectangles (and I don't know if that is truly necessary), I need to use SCISSOR.

I should note that the output from my BT817 goes through a chip that converts the signal to HDMI where it is displayed on a small monitor. I'm not using the monitor's native resolution, either. I'm displaying at 480p and the monitor is native 720p. That said, I can always identify which rectangle was made with SCISSOR and which was made with BEGIN(RECTS), even when I swap their screen locations.

mike
Logged