DrawRect no fill

BlitzMax Forums/BlitzMax Programming/DrawRect no fill

shinkiro1(Posted 2011) [#1]
Has someone got a function to draw a non filled rectangle.

Thanks


Czar Flavius(Posted 2011) [#2]
There is one floating around. You need to draw four lines. A shame it didn't occur to add this mode.


shinkiro1(Posted 2011) [#3]
Thanks Czar Flavius. Sometimes it's better to do a google search with blitzbasic attached than a board search ^^

I found the following: http://www.blitzbasic.com/Community/posts.php?topic=41793#750486

It's OpenGL only. The advantage is if you have a lot Matrix calculation stuff (like camera zomming) this will work right out of the box.
You just need to enclose your drawing commands with 2 GL commands:

glPolygonMode(GL_FRONT_AND_BACK, GL_LINE)

DrawRect( (entity.position.x * cam.position.z) - (cam.position.x * cam.position.z) + cam.screen_center_x, (entity.position.y * cam.position.z) - (cam.position.y * cam.position.z) + cam.screen_center_y, entity.image.width, entity.image.height )

glPolygonMode(GL_FRONT_AND_BACK, GL_FILL)

That is how it looks in my code.

So thanks, problem solved.


Czar Flavius(Posted 2011) [#4]
I would do the four line drawing method. Then you are not limited to one graphics driver. It's doubtful your performance will depend on this one thing.


shinkiro1(Posted 2011) [#5]
You are right, but I can't figure out how to draw it correctly with rotation, zooming, translating, scaling all together. It's only a temporary solution. (also, it's just for an intern editor)


John G(Posted 2011) [#6]
FryGui has such a function but I believe I had some problems with translating.