Source Code Corner Boxes in OpenGL

Hexui Undetected CSGO Cheats PUBG Accounts

Meow

Gimme food hooman.
Meme Tier VIP
Fleep Tier Donator
Apr 24, 2020
262
6,438
7
Game Name
N/A
How long you been coding/hacking?
3 years / few months
Since these are pretty popular here's my version of corner boxes (corner boxes?) in opengl. If someone translates it to cpp consider posting it here aswell.

corners.png


Code:
proc cornerBox(x, y, width, height: float, color, outlineColor: array[0..2, float32], lineWidth: float = 1) =
  template drawCorner =
    glBegin(GL_LINES)
    # Lower Left
    glVertex2f(x, y); glVertex2f(x + lineW, y)
    glVertex2f(x, y); glVertex2f(x, y + lineH)

    # Lower Right
    glVertex2f(x + width, y); glVertex2f(x + width, y + lineH)
    glVertex2f(x + width, y); glVertex2f(x + width - lineW, y)

    # Upper Left
    glVertex2f(x, y + height); glVertex2f(x, y + height - lineH)
    glVertex2f(x, y + height); glVertex2f(x + lineW, y + height)

    # Upper Right
    glVertex2f(x + width, y + height); glVertex2f(x + width, y + height - lineH)
    glVertex2f(x + width, y + height); glVertex2f(x + width - lineW, y + height)
    glEnd()

  let
    lineW = width / 4
    lineH = height / 3

  glLineWidth(lineWidth + 2)
  glColor3f(outlineColor[0], outlineColor[1], outlineColor[2])
  drawCorner()
  glLineWidth(lineWidth)
  glColor3f(color[0], color[1], color[2])
  drawCorner()
 
Last edited:
Community Mods