Building a simple 2D graphics library in SDL
If you haven't discarded OpenGL just yet, glAArg (OpenGL AntiAliased rendering glue) will give you nice, fast, antialiased 2D rendering. I'm not sure if it is still under active development though.
No, it isn't.
Would be nice if I had time for Shoot More Things though.
Would be nice if I had time for Shoot More Things though.
Najdorf Wrote:How would you code a circle? personally i woud just take a big circle bitmap and then scale it at the right size. Otherwise use a gluDisk.
if not what, draw it "by lines"? (calculate the left_x and the right_x for every y and draw the horizonta line?) That would work in a "pixelated" enviroment, but wouldn't fit nicely in the more "abstract" opengl setting. Or just replicate a gluDisk?
Technically you only have to calculate 1/4 of it and then mirror the results 3 ways.
"Yes, well, that's the sort of blinkered, Philistine pig-ignorance I've come to expect from you non-creative garbage."
1/16, actually. 
[edit] just to be clear ->

[edit] just to be clear ->
Hehe.
Just for the record, I was being serious, with 1/8, all that is required is:
1. Generate a 1/8 segment.
2. Generate the second 1/8 segment simply swapping the x & y from the first segment.
3. Now you have a full 1/4, mirror horizontally & vertically as LSL said.
4. ???
5. Profit!
http://escience.anu.edu.au/lecture/cg/Ci...metry8.gif
http://escience.anu.edu.au/lecture/cg/Ci...es.en.html
Just for the record, I was being serious, with 1/8, all that is required is:1. Generate a 1/8 segment.
2. Generate the second 1/8 segment simply swapping the x & y from the first segment.
3. Now you have a full 1/4, mirror horizontally & vertically as LSL said.
4. ???
5. Profit!
http://escience.anu.edu.au/lecture/cg/Ci...metry8.gif
http://escience.anu.edu.au/lecture/cg/Ci...es.en.html
Haha! Tag. You're it! I challenge you to write the code for it. Replace:
static void DrawCircle(Entity *entity)
It's up just a little in the thread. I did it. You do it too!
c'mon, it's just a little function...
static void DrawCircle(Entity *entity)
It's up just a little in the thread. I did it. You do it too!
c'mon, it's just a little function...
Answering the main post although probably already answered anyway. If you got code already with SDL then might as well stick with it. OpenGL is not a magic bullet for everything and software rendering can be 'fast enough', and in the end may be saner to deal with. (Old school yeah!) There are a few libraries that already exist for SDL to draw primitives. libsdl.org has a pretty large list of libraries that work with it and some of the following seem to fill the desired task you are looking for.
http://sdl-draw.sourceforge.net/
http://www.ferzkopp.net/Software/SDL_gfx-2.0/
http://www.tempestgames.com/ryan/
http://freshmeat.net/projects/sge/
http://www.kyb.mpg.de/~gf/software
Or you develop them yourself as the algorithms are pretty well known.
http://sdl-draw.sourceforge.net/
http://www.ferzkopp.net/Software/SDL_gfx-2.0/
http://www.tempestgames.com/ryan/
http://freshmeat.net/projects/sge/
http://www.kyb.mpg.de/~gf/software
Or you develop them yourself as the algorithms are pretty well known.
Possibly Related Threads...
| Thread: | Author | Replies: | Views: | Last Post | |
| Free, Portable Graphics loading library/Header | Jones | 5 | 2,849 |
Feb 7, 2006 12:15 PM Last Post: Zekaric |
|
| Building SDL Framework & miniaturize fix | PowerMacX | 3 | 3,414 |
Oct 22, 2004 06:31 PM Last Post: PowerMacX |
|
| SDL Simple Graphics? | IBethune | 1 | 2,872 |
Jun 29, 2003 04:51 AM Last Post: OneSadCookie |
|

