nonsolid rect again

BlitzMax Forums/BlitzMax Programming/nonsolid rect again

Curtastic(Posted 2005) [#1]
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



tonyg(Posted 2005) [#2]
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



AntonyWells(Posted 2005) [#3]
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.)


Curtastic(Posted 2005) [#4]
ok thanks. how would you decide to use DX or GL?


Bot Builder(Posted 2005) [#5]
?macOS
SetGraphicsDriver GLMax2DDriver()
?Linux
SetGraphicsDriver GLMax2DDriver()
?


ImaginaryHuman(Posted 2005) [#6]
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