RPGDXThe center of Indie-RPG gaming
Not logged in. [log in] [register]
 
 
Post new topic Reply to topic Goto page Previous  1, 2 
View previous topic - View next topic  
Author Message
LeoDraco
Demon Hunter


Joined: 24 Jun 2003
Posts: 584
Location: Riverside, South Cali

PostPosted: Tue Oct 07, 2003 5:47 pm    Post subject: [quote]

Janus wrote:
It doesn't even have a function to draw lines! (At least not that I could find in the api...)


Dude, GL comes with a line rendering mechanism:

Code:

glBegin( GL_LINES );
  glVertex...
  ...
glEnd();


As SDL is a wrapper for GL, you can use that base functionality of GL.

And come on: even if SDL didn't come with a line-rendering mechanism, Bressenham's isn't all that difficult to write. (Sure, your's wouldn't be hardware optimized, per se, but it would at least work.)
_________________
"...LeoDraco is a pompus git..." -- Mandrake


Last edited by LeoDraco on Tue Oct 07, 2003 9:19 pm; edited 1 time in total
Back to top  
Rainer Deyke
Demon Hunter


Joined: 05 Jun 2002
Posts: 672

PostPosted: Tue Oct 07, 2003 6:46 pm    Post subject: [quote]

Janus wrote:
More seriously, I haven't used Allegro, but I despise SDL. It doesn't even have a function to draw lines! (At least not that I could find in the api...)


There are add-on libs that provide line-drawing functionality. Why should it be included in the base API? I never had any need for it. (I do occasionally need horizontal and vertical lines, but that's just a special case of a filled rectangle, which SDL does provide.
Back to top  
Rainer Deyke
Demon Hunter


Joined: 05 Jun 2002
Posts: 672

PostPosted: Tue Oct 07, 2003 6:48 pm    Post subject: [quote]

LeoDraco wrote:
As SDL is a wrapper for GL, you can use that base functionality of GL.


SDL is not a OpenGL wrapper. SDL does provide access to OpenGL, but it also provides its own 2D rendering API which is built on the native 2D APIs. That's DirectDraw and GDI under Windows.
Back to top  
ishpeck
Pretty, Pretty Fairy Princess


Joined: 16 Sep 2003
Posts: 7
Location: Earth

PostPosted: Tue Oct 07, 2003 8:22 pm    Post subject: [quote]

Janus wrote:
More seriously, I haven't used Allegro, but I despise SDL. It doesn't even have a function to draw lines!


You're right. SDL's standard API does not have a way to draw lines. I've never missed it, though.
_________________
--
The Ishpeckian Network is part of this balanced breakfast.
http://www.ishpeck.net/
Back to top  
janus
Mage


Joined: 29 Jun 2002
Posts: 464
Location: Issaquah, WA

PostPosted: Tue Oct 07, 2003 11:51 pm    Post subject: [quote]

I just don't see how I should be required to write a function that locks my output buffer, clips my coordinates, converts my color to the correct bit depth and channel ordering, and then draws the line, just to draw a couple lines. It's not like there isn't a use for primitives like solid fills and lines.

As for the fact that GL can draw lines, I wasn't aware that SDL was just a wrapper for GL. I'm pretty sure it works without requiring you to use GL. Maybe I'm wrong?

It seems more like laziness to me than 'efficiency' or careful design that SDL doesn't even have the most simple primitives. It's not like SDL is a huge library. They could afford to waste a few KB to provide a solid fill function and a line function. Other stuff like circles isn't terribly necessary, but there are a lot of uses for lines and fills, neither of which I was able to figure out how to do in SDL without reimplementing the whole algorithm.

I guess if you don't mind writing half your graphics code, SDL is the way to go. ;) I mean, Allegro provides a half dozen decent primitives, and it's not that big. Even GDI and X Windows provide line drawing and solid fills.

Then there's the whole issue of GL compatibility and implementation differences (some implementations miss the first pixel of a line, some miss the last pixel, some draw an extra pixel, etc.) Don't even get me started there :)

Lines aren't terribly necessary for games, but I find them *quite* useful when debugging things.
Back to top  
Rainer Deyke
Demon Hunter


Joined: 05 Jun 2002
Posts: 672

PostPosted: Wed Oct 08, 2003 1:24 am    Post subject: [quote]

Janus wrote:
I just don't see how I should be required to write a function that locks my output buffer, clips my coordinates, converts my color to the correct bit depth and channel ordering, and then draws the line, just to draw a couple lines. It's not like there isn't a use for primitives like solid fills and lines.


I have never had a use for non-vertical non-horizontal lines. Vertical and horizontal lines are easy enough with SDL_FillRect.

And, as I already stated, there are add-on libraries which provide line-drawing for SDL.

Quote:
I wasn't aware that SDL was just a wrapper for GL.


It isn't.
Back to top  
LeoDraco
Demon Hunter


Joined: 24 Jun 2003
Posts: 584
Location: Riverside, South Cali

PostPosted: Wed Oct 08, 2003 2:01 am    Post subject: [quote]

Janus wrote:
As for the fact that GL can draw lines, I wasn't aware that SDL was just a wrapper for GL. I'm pretty sure it works without requiring you to use GL. Maybe I'm wrong?

It seems more like laziness to me than 'efficiency' or careful design that SDL doesn't even have the most simple primitives. It's not like SDL is a huge library. They could afford to waste a few KB to provide a solid fill function and a line function. Other stuff like circles isn't terribly necessary, but there are a lot of uses for lines and fills, neither of which I was able to figure out how to do in SDL without reimplementing the whole algorithm.


Again, you can do lines and filled rectangles in GL. It's real easy.

Quote:
Then there's the whole issue of GL compatibility and implementation differences (some implementations miss the first pixel of a line, some miss the last pixel, some draw an extra pixel, etc.) Don't even get me started there :)


GL compatibility? If you're talking about drawing differences, I won't argue, but it you're talking API portability, you're barking up the wrong tree. While a GL program might not look the same on every OS/hardware configuration out there, you're pretty much garuanteed that it will compile and run on modern architectures.

And what I meant for wrapper was a tad bit misleading: SDL is a wrapper for creating a rendering context, which it then passes off to whatever library add-ons it uses.
_________________
"...LeoDraco is a pompus git..." -- Mandrake
Back to top  
ishpeck
Pretty, Pretty Fairy Princess


Joined: 16 Sep 2003
Posts: 7
Location: Earth

PostPosted: Wed Oct 08, 2003 10:06 pm    Post subject: How Important Are Lines, Really? [quote]

What modern games ever use single-pixle-wide, monotone lines? If anyone ever doesn't use 3D, their 2D stuff is loaded with sprites.
_________________
--
The Ishpeckian Network is part of this balanced breakfast.
http://www.ishpeck.net/
Back to top  
janus
Mage


Joined: 29 Jun 2002
Posts: 464
Location: Issaquah, WA

PostPosted: Thu Oct 09, 2003 7:42 am    Post subject: Re: How Important Are Lines, Really? [quote]

ishpeck wrote:
What modern games ever use single-pixle-wide, monotone lines? If anyone ever doesn't use 3D, their 2D stuff is loaded with sprites.

Almost any shape breaks down into lines.
Circles, polygons, squares, triangles, almost all shapes can be broken down into monotone, single-pixel wide or multiple-pixel wide lines. Having at least a single pixel wide line function would make drawing all of those primitives a lot easier. But no, all you get is filled rectangles, blits, and locked surfaces, unless you want to use OpenGL, which is not exactly the simplest thing in the world (even though it's not bad!).

I've always been in favor of simplicity, though, so I don't think SDL-style libraries will ever please me. They do at least get the job done.
Back to top  
Post new topic Reply to topic Page 2 of 2 All times are GMT
Goto page Previous  1, 2 



Display posts from previous:   
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum