DrawOval, with less filling
BlitzMax Forums/BlitzMax Beginners Area/DrawOval, with less filling
| ||
Or no fill, to be exact. I don't want my ovals filled. Do I have to write a function to make this happen, or am I missing something? |
| ||
In OpenGL you can tweak the settings (using GL functions not found in BlitzMax's docs, but which can be found via third-party docs online and in the BlitzWiki here and here):SetGraphicsDriver GLMax2DDriver() Graphics 800, 600 glPolygonMode GL_FRONT_AND_BACK, GL_LINE DrawOval 100, 100, 200, 50 DrawRect 200, 200, 200, 50 glPolygonMode GL_FRONT_AND_BACK, GL_FILL Flip WaitKeyBut I don't know of a way to do it in DirectX. |
| ||
Have a look in the blitzmax code archives at the code I posted to draw filled or unfilled ovals. For example; http://www.blitzbasic.com/codearcs/codearcs.php?code=1479 |
| ||
Maybe you can use it.Graphics 400,400,0 Const PixSize=1 Const RadiusX=100 Const RadiusY=70 Const PosX=200 'center Const PosY=200 'center Local Rad:Float 'draw the circle---------------------------- For Rad = 0 To 360 Step .1 'step is the definition of the circle DrawRect PosX + (Sin(Rad) * RadiusX)-PixSize/2, PosY + (Cos(Rad) * RadiusY)-PixSize/2,PixSize,PixSize; Next '------------------------------------------- SetColor 0,255,0 DrawLine PosX-10,PosY,PosX+10,PosY DrawLine PosX,PosY-10,PosX,PosY+10 Flip WaitKey() |
| ||
Thanks all, but for now I'll just include this handy little graphics module I wrote. |
| ||
It isn't a module unless you specify it as such. It's also probably quite slow using Cos() and Sin(). |
| ||
Yeah, whoops, I guess it's just an included function. And about the Sin and Cos, I'd like to have them pre-calculated. How might I do this in an included file? Can I just define them as Const at the top? |
| ||
They aren't a constant. They are based on an angle each time, so you'd need an array of them. |
| ||
AngelDaniel. On a modern CPU, FP instructions (like Sin and Cos) are likely faster than a memory fetch. |
| ||
I didn't know those were built in FPU instructions these days. They used to have to require a software routine. |
| ||
so you'd need an array of them. Well I thought that was obvious. I guess I should have said it anyway. ;) I have also heard that doing realtime sin and cos is no problem for modern processors. But if you take a look, I've included a step parameter so that on average, only 10 or less calculations are done per circle. |