Non-filled rect?

BlitzMax Forums/BlitzMax Beginners Area/Non-filled rect?

TeaVirus(Posted 2004) [#1]
Is there currently a way to draw a rect that isn't filled (besides 4 lines)? DrawRect seems to be missing the last parameter of the Blitz rect command. How about a non-filled oval or poly for that matter? Hopefully I'm just missing something simple.


N(Posted 2004) [#2]
No, there isn't. You'll have to write your own procedure for it (best to do only one state change instead of four).


skidracer(Posted 2004) [#3]
here's one from the bpaint sample
Function DrawBox(x#,y#,w#,h#)
	DrawRect x,y,w,1
	DrawRect x,y+h-1,w,1
	DrawRect x,y+1,1,h-2
	DrawRect x+w-1,y+1,1,h-2
End Function



Diordna(Posted 2004) [#4]
Yes, but what about ellipses?


TeaVirus(Posted 2004) [#5]
Ok, cool. I just wanted to make sure I wasn't overlooking a built in command or something. Thanks all.


TeaVirus(Posted 2004) [#6]
Diordna
This circle function from the code arcs could be used. Not sure how fast it is though.

http://www.blitzmax.com/codearcs/codearcs.php?code=428


Shagwana(Posted 2004) [#7]
Another one of my babys :)


ImaginaryHuman(Posted 2004) [#8]
Maybe looks at the modules for BMX's graphics, e.g. GLMax2d, Max2D, BlitzGL or whatever ... see what they do in there to draw a filled ellipse. You could modify it to draw a line between each vertex instead of filling the polygons.


Matt Merkulov(Posted 2007) [#9]
And why Mark do not included these drawing commands in BMax?


Curtastic(Posted 2007) [#10]
I don't know. It doesn't make sense, I thought blitzmax was supposed to be easy to use. It could be this whole design idea:
Blitz3D includes many commands to help you out with game creation - but not too many! Rather than confuse you with tons of commands, Blitz3D's command set has been carefully designed to provide maximum flexibility for minimum effort.



tonyg(Posted 2007) [#11]
Question :
As it appears in the Wiki can we assume there will NEVER be an unfilled option and we should use the polygon mode workaround?

Answer from Mark :

If there's a demand for something (and esp. if it's easy!) it'll probably get done eventually. This one's easy so look out for it soon.

taken from 2 year old thread
I think Mark is doing so many things that the simple stuff has been left FAR behind.


Dreamora(Posted 2007) [#12]
If you restrict the graphics to opengl, you can simply set the drawmode to line before drawing and set it back to filled after drawing.

But that would perhaps be an idea: SetDrawMode <Mode>
<Mode>: DRAW_POINT, DRAW_LINE, DRAW_FILLED

If someone implements it they are most likely going to include it. My prob is mainly that I do not understand enough of DX7 to do it on that side. (and on the OGL side it isn't hard to do)


ImaginaryHuman(Posted 2007) [#13]
I still think this is an oversign on BRL's part, why they thought they could add filled rects etc but not hollow ones I do not know. Such features have been a part of most API's for years, even back to Amos Basic and beyond in the 90's.


tonyg(Posted 2007) [#14]
DirectDrawSurface7 has a DrawBox method which is 'transparent' by default and can be changed by SetFillStyle. Unfortunately, Bmax uses IDirectDrawSurface7
which doesn't seem to have the same method.. unless I have missed something.


GfK(Posted 2007) [#15]
taken from 2 year old thread

Just like this one, then? ;)


tonyg(Posted 2007) [#16]
Maybe we've actually been transported back to 2005. Reminds me 'Life on Mars' starts again next week.


ImaginaryHuman(Posted 2007) [#17]
Didn't they add the flag to the end of the DrawLine command so that, when you draw four lines either clockwise or anticlockwise the last pixel won't be drawn so that it doesn't overlap the starting pixel, to make an unfilled box?


rdodson41(Posted 2007) [#18]
For OpenGL,
set drawing mode to outline of points: glPolygonMode(GL_FRONT_AND_BACK, GL_POINT)
set drawing mode to outline of lines: glPolygonMode(GL_FRONT_AND_BACK, GL_LINE)
set drawing mode to filled: glPolygonMode(GL_FRONT_AND_BACK, GL_FILL)
EDIT: little function here
Const DRAW_POINT:Int = GL_POINT
Const DRAW_LINE:Int = GL_LINE
Const DRAW_FILL:Int = GL_FILL

Function SetDrawMode(mode:Int)
    glPolygonMode(GL_FRONT_AND_BACK, mode)
EndFunction