nonsolid rect again

BlitzMax Forums/BlitzMax Programming/nonsolid rect again

Why doesn't this work anymore since I got the update?
It shows a filled rect
Graphics 800,600

glpolygonmode(GL_BACK,GL_LINE)
DrawRect 99,99,99,99

Flip
Delay 4000
End


Because the default driver is now the DX driver...
SetGraphicsDriver GLMax2DDriver()
Graphics 800,600

glpolygonmode(GL_BACK,GL_LINE)
DrawRect 99,99,99,99

Flip
Delay 4000
End


it'll probably be faster to roll your own, since wireframe is really slow in gl usually.

function ORect( x,y,width,height )
    line x,y,x+width,y
    line x+width,y,x+width,y+height
    line x,y+height,x+width,y+height
    line x,y,x,y+height
end function


(In retrospect, you probably could have coded that yourself without my help.)

ok thanks. how would you decide to use DX or GL?

?macOS
SetGraphicsDriver GLMax2DDriver()
?Linux
SetGraphicsDriver GLMax2DDriver()
?

Try using this for an unfilled rectangle (untested), it has half as many vertices as using `Line` 4 times.

Function HollowRect(x:Float,y:Float,width:Float,height:Float)
   glBegin (GL_LINE_STRIP)
      glVertex2f x,y
      glVertex2f x+width,y
      glVertex2f x+width,y+height
      glVertex2f x,y+height
   glEnd
End Function