Building a simple 2D graphics library in SDL

Moderator
Posts: 771
Joined: 2003.04
Post: #31
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.
Quote this message in a reply
Sage
Posts: 1,232
Joined: 2002.10
Post: #32
No, it isn't.

Would be nice if I had time for Shoot More Things though.
Quote this message in a reply
Moderator
Posts: 529
Joined: 2003.03
Post: #33
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."
Quote this message in a reply
Moderator
Posts: 771
Joined: 2003.04
Post: #34
1/8, actually. Wink
Quote this message in a reply
Moderator
Posts: 3,577
Joined: 2003.06
Post: #35
1/16, actually. Wink

[edit] just to be clear -> Wink Wink
Quote this message in a reply
Moderator
Posts: 771
Joined: 2003.04
Post: #36
Hehe. Smile 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
Quote this message in a reply
Moderator
Posts: 3,577
Joined: 2003.06
Post: #37
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! Rasp

c'mon, it's just a little function...
Quote this message in a reply
Member
Posts: 131
Joined: 2004.10
Post: #38
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.
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Free, Portable Graphics loading library/Header Jones 5 3,093 Feb 7, 2006 12:15 PM
Last Post: Zekaric
  Building SDL Framework & miniaturize fix PowerMacX 3 3,720 Oct 22, 2004 06:31 PM
Last Post: PowerMacX
  SDL Simple Graphics? IBethune 1 3,203 Jun 29, 2003 04:51 AM
Last Post: OneSadCookie