So, I’m moving to a new place tomorrow and work on Gorgon v2 is going to halt for a bit until I get my life back in order. In the meantime, here’s a screenshot of the primitives (rectangles, lines, etc…) that have been making me insane (click it to see a larger version):
You can see the line (barely, I know, you can see it when it’s running for sure) and the rectangle, but I’ve gotten ellipses to work as well. Now, what’s the big deal you ask? (You are asking that, I demand it). And I’ll tell you. Unlike the previous incarnation where the primitives were generated one pixel at a time (very inefficient), this time it’s using polygons to generate the primitives. So a line is using the line drawing on the video card, the rectangle and unfilled ellipse are using the line drawing as well and the filled ellipse is using triangles. So all in all, they’re MUCH faster than the previous version. For more details click the thingy at the bottom there…
All primitives (except points, they don’t support texturing because, well, they’re points and there’s no… forget it) support texturing for their filled and outlined mode, and support line thickness and are now actual objects. You can create a line by calling CreateLine or what have you and you can reuse it as you wish. The advantage is that these objects now get a lot of the same functionality as a sprite, like anchoring, rotation, scaling (lines don’t though, they’re a little different). You don’t need to create explicit instances of primitives however, there’s also an interface that will draw the primitives directly to the target if you don’t need a lot of control.
There is one caveat: The quality of rendering for the ellipse object is adjustable, so if you want really smooth ellipses, then you’ll probably hit a performance penalty (more lines/triangles to draw). I’ve found a setting of 64 (which is the number of line segments used to draw the object) is pretty good.
The line thickness was a real fucker to get working. Basically it draws a line as a quad, and for non-textured, that’s fine, however for the texture coordinates… man, it was brutal. But I learned some neat things from Vortex 2D.Net (by Alex Khomich, and is a great library, I highly recommend it) and now it’s working better than I could have hoped.
To give a summary of the image:
- The “sprite” of the ball, is not a sprite, it’s actually a filled ellipse using the ball as a texture.
- The ball with the center cut out is an unfilled ellipse using a texture and a thickness of 3 pixels.
- I am fucking tired.
Anyway, that’s it for today. Hopefully it won’t take me too long to get back on track after the move.