• FEATURED

View more

View more

View more

\$10

### Image of the Day Submit

IOTD | Top Screenshots

## @SDL users, use OpenGL

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

92 replies to this topic

### #21/ Khaosifix   Banned

Posted 07 January 2005 - 06:40 AM

Quote:
Original post by PnP Bios
Quote:
 Original post by KhaosifixI do agree that it would be a great idea to use OpenGL over SDL for graphics but think about the people just starting out. Some of the things in OpenGL wouldn't make any sense to them at all. Examples of this include setting a orthogonal projection, alternating between matrix modes, etc.SDL is super simple that is why it doesn't support some of the advance features, like stretch-blitting, that DirectDraw so proudly supports.

Anybody using my library wouldn't even know that they are using OpenGL. Did you even look through the source?

No I don't need to. I'm comfortable with OpenGL. Thank you.
---http://www.michaelbolton.comI constantly dream about Michael Bolton.

### #22/ PnP Bios   Banned

Posted 07 January 2005 - 06:41 AM

Quote:
Original post by Khaosifix
Quote:
Original post by PnP Bios
Quote:
 Original post by KhaosifixI do agree that it would be a great idea to use OpenGL over SDL for graphics but think about the people just starting out. Some of the things in OpenGL wouldn't make any sense to them at all. Examples of this include setting a orthogonal projection, alternating between matrix modes, etc.SDL is super simple that is why it doesn't support some of the advance features, like stretch-blitting, that DirectDraw so proudly supports.

Anybody using my library wouldn't even know that they are using OpenGL. Did you even look through the source?

No I don't need to. I'm comfortable with OpenGL. Thank you.

If you have a point, make it quick.
HxRender | Cornerstone SDL TutorialsCurrently picking on: Hedos, Programmer One

### #23/ Khaosifix   Banned

Posted 07 January 2005 - 07:23 AM

You didn't have to rate me down for that. People like you make it less enjoyable to post on these forums. Good day.
---http://www.michaelbolton.comI constantly dream about Michael Bolton.

### #24/ owl   Banned

Posted 07 January 2005 - 07:28 AM

Quote:
 Original post by PnP BiosI registered it under LGPL with source forge. I hope that is good enough.I don't know jack shit about licensing, software law, or anything like that. You want it GPL, sure, I don't care. Just show me what to do.

You can copyright the code or just release it as you did here to the public domain, but you must add a notice with it saying that it is indeed free.

Quote:

Quote:
 Copyleft and the GNU GPL (Free Software enforced)The goal of GNU was to give users freedom, not just to be popular. So we needed to use distribution terms that would prevent GNU software from being turned into proprietary software. The method we use is called "copyleft".(1)Copyleft uses copyright law, but flips it over to serve the opposite of its usual purpose: instead of a means of privatizing software, it becomes a means of keeping software free.The central idea of copyleft is that we give everyone permission to run the program, copy the program, modify the program, and distribute modified versions--but not permission to add restrictions of their own. Thus, the crucial freedoms that define "free software" are guaranteed to everyone who has a copy; they become inalienable rights.

Your package must include what is mentioned here:
Quote:

Here the Free Software Fundation site

Here the LGPL text that should go with every package of your project.

[Edited by - owl on January 7, 2005 1:28:11 PM]

### #25/ PnP Bios   Banned

Posted 07 January 2005 - 07:50 AM

Khaosfix, if you want fun, stay in the lounge. Don't crap up threads. Thats all the more I will say about it.

Owl, thanks. I will get on this as soon as the next time I am in front of my code. I should hear back from SF on if I get a page for this before sunday, hopefully.
HxRender | Cornerstone SDL TutorialsCurrently picking on: Hedos, Programmer One

### #26Erluk  Members

Posted 07 January 2005 - 08:04 AM

Quote:
 Original post by PnP BiosI registered it under LGPL with source forge. I hope that is good enough.

I think LGPL is the right choice since SDL is LGPL as well.

### #27Drew_Benton  Members

Posted 07 January 2005 - 08:11 AM

Hey all! I'm here to add in my 2 cents [smile].

@PnP: sorry I haven't gotten back to you about this - I've moved back to college and do not have internet in my apt. - I'm in the library now :(.

Anyways I have a quite bit to say -

1. I used to think that starting out with SDL would be the best thing for a beginner. It basically does everything for you - so why not use it? You can concentrate on the game task in hand rather easily.

Now you may have read the word *used*, I know think that SDL is a dead end path for beginners (am I spelling that right - looks werid :/ ). Now this is coming from someone who has strongly advocated and has dedicated a large portion of time learning and using SDL, so that is not an empty statement.

I feel this way because once you are ready to move on to bigger projects that most likely will not use SDL, you really have no knowledge. Using SDL is a double edged sword - everything is easier, but you have no idea of the true inner workings of everything.

This is something I have come to realize over the past few days. I've been working on a game engine that most people would probabally deem 'nearly impossible' coming from someone as myself - but nevertheless its going good. bascially the engine is a plugin based that lets you choose what you want to use. I do not want to go talking about my stuff b/c this is not my thread, but you get the idea.

Now this is all revelant to SDL because when I was always using SDL - I would get input by using the SDL function to return the 256 array of keys. Thats it! Now, in my engine - I cannot simply do that, so I had to learn how to get input - which I asked about the mouse and keyboard in one forum if you remember.

The same pretty much goes for everything else - I had made some nice libraries for SDL and stuff - but its only good for SDL! Now that I am in non-SDL environments - none of that code is any good - neither is the majority of the experience learned making them.

2. Now with that said - If I would have began with let's say Win32 OpenGl - I would have a better understanding of everything that SDl so convinelty hid from me. Instead of having to learn this new stuff since I let SDL take care of it for me, I could have already known most of it by no choosing SDL. I'm not saying I reget starting with SDL - its just that if you have BIG plans, such as myself - taking the SDL route really is a dead end. Thus I agree with Rob [wink], we're on the same page buddy!

3. Ok now with that little monologue said [lol] time to move on to something...err I can't really remember what I was goign to say...anyways PnP goodjob! I will download this new version and try to get back to you. I try to make at least one library trip a day - that's why I'm not active anymote posting :(. best of luck and great work!

- Drew

### #28Gyrbo  Members

Posted 07 January 2005 - 09:53 AM

It's just my choice, but I don't think the LPGL is the best license for such a small library. It basically forces users to use it as a DLL. For larger libraries this isn't much of a problem because the overhead is small. But for a small library, you'll end up with a huge DLL with most of it having nothing to do with the library itself. A license that allows static linking always has my prefference.
You could go for something as liberal as the zlib, MIT or BSD license (which is pretty much what you initially said). Something less liberal but that still (from what I understand) allows static linking is the MPL or the Jabber PL.

### #29phantom  Members

Posted 07 January 2005 - 10:18 AM

Firstly, I'm with the above poster, LGPL is a tad too restrictive for what the library is ment todo, personally i'm a fan of zlib for stuff like this as really it only makes sense to statically link things like this in.

Secondly, i've taken a quick shifty at the code and I'd like to point out you dont need to include windows.h in your hxRender.h file as that file doesnt touch windows functions, instead include it in the source file with an include guard to stop it including on non-windows plaforms.

Finally, I'm not so sure about those statically allocated arrays of 256 values, i cant help feel you'd be better off with either a dynamically allocated system (which ofcourse would require an init function to set it up, maybe include it in the setupwindow function?). Can I ask how you arrived at that number?
Also, as apoint of reference, if you are using a 'bool' shouldnt to be setting the value to 'false' not '0' in your setupwindow function?

Aside from those minor issues I quite like it, if I ever get a chance then I might well use it to setup a 2D example of how to use my windowing framework [grin]

### #30/ PnP Bios   Banned

Posted 07 January 2005 - 10:42 AM

Ok, then what license should I use then? I... don't think I like pure GPL, I want people to be able to use it commercialy.

I'd rather go with public domain or gift ware... All I want is credit where credit is due. For me and for you guys.

_the_phantom, once I get a good distribution method, stuff like that will be easy enough to add.
HxRender | Cornerstone SDL TutorialsCurrently picking on: Hedos, Programmer One

### #31phantom  Members

Posted 07 January 2005 - 10:45 AM

i'd go with zlib, basically its still yours, people can change it but should always say where the orignal came from and they can use it for what they like.

### #32/ PnP Bios   Banned

Posted 07 January 2005 - 10:56 AM

Quote:
 Original post by _the_phantom_i'd go with zlib, basically its still yours, people can change it but should always say where the orignal came from and they can use it for what they like.

I'll have to look into that then. thanks.
HxRender | Cornerstone SDL TutorialsCurrently picking on: Hedos, Programmer One

### #33/ owl   Banned

Posted 07 January 2005 - 10:58 AM

Quote:
 Original post by _the_phantom_i'd go with zlib, basically its still yours, people can change it but should always say where the orignal came from and they can use it for what they like.

as long (at least technically) as he copyrights it. If he doesn't copyright the lib, then anyone can take the lib exactly as he provided it, close it, and sell it as a commercial product without having to credit anyone. That's what public domain means. It belongs to everybody and everybody can do whatever they want with it, no rules.

### #34maximAL  Members

Posted 07 January 2005 - 10:58 AM

what is wrong with using SDL for input? or letting it do the system initialisation stuff? the sound should also be enough for the first beginner games.
the video part is simple and slow, yes. but really, it is so basic, that it wouldn't hurt much to switch to openGL (/whatever) - as long, as you designed your code properly...

### #35graveyard filla  Members

Posted 07 January 2005 - 12:42 PM

the thing that worries me about these "3d 2d libraries" is efficency. can your library really stuff my "surfaces" into vertex arrays, display lists, keep GL calls to a minimum, sort by texture, etc? because if you dont do any of these, you might find software actually running faster then hardware, at least on some systems.

### #36Boder  Members

Posted 07 January 2005 - 12:47 PM

Here is the current, classic BLITing function in hxRender.

//	Function:		hxBlitSurface//	Author:			Joel Longanecker//	Version:		1.5//	Description:	This is the core function. This draws the object on the screen.//	Chages:			blend color has been removed. It has been moved to its own functionvoid hxBlitSurface(hxSurface *source, hxRect sRect, hxRect dRect){	float sx;	float sy;	float sw;	float sh;	sx = (float)sRect.x/(float)source->wPad;	sy = (float)sRect.y/(float)source->hPad;	sw = (float)(sRect.x+sRect.w)/(float)source->wPad;	sh = (float)(sRect.y+sRect.h)/(float)source->hPad;		glBindTexture(GL_TEXTURE_2D, hxiTexList[source->texID]);	glBegin(GL_QUADS);		glTexCoord2f(sx, sy);	glVertex2i(dRect.x, dRect.y);		glTexCoord2f(sw, sy);	glVertex2i(dRect.x + dRect.w, dRect.y);		glTexCoord2f(sw, sh);	glVertex2i(dRect.x + dRect.w, dRect.y + dRect.h);		glTexCoord2f(sx, sh);	glVertex2i(dRect.x, dRect.y + dRect.h);	glEnd();			return;}

### #37Puzzler183  Members

Posted 07 January 2005 - 01:26 PM

For the record - each has its place. I use SDL for input and for windowing and OpenGL for rendering. OpenGL is not an SDL replacement and should not be viewed as one.

### #38Kylotan  Moderators

Posted 07 January 2005 - 02:13 PM

Firstly, well done PnP Bios for writing this and making it available. Incidentally I found some time recently to clean up my attempt at a similar library. I'd be ready to release it but I've been considering removing the SDL dependency, or at least separating it out so that you can use it with anything that gives you the appropriate OpenGL setup.

I'd also recommend the zlib license. That way you keep the copyright but people can use the library pretty much as they please.

I'd also not worry about the vertex arrays vs. glBegin/glEnd argument. In response to similar criticism and benchmarks posted on the thread about my library, I added a little buffering class to my library that batches up sprite drawing requests and then does them all in one go. I found absolutely no difference whatsoever on my (admittedly slow) hardware, and software rendering doesn't come close to either method. That's not to say that others won't notice a difference, so I'm gonna keep the functionality. But the main point is that even the glBegin/glEnd approach totally destroys SDL's DirectDraw-based approach in terms of performance, especially when you're looking at any sort of blending. It's like arguing about the difference between C++ and ASM when you've just moved from javascript. The one exception might be if you used a different texture for every blit.

### #39shemsuheru2064  Members

Posted 07 January 2005 - 06:09 PM

I am currently working on translating this into pascal, to be compatible with Delphi and Kylix. Perhaps, it might be added to the JEDI-SDL package.

### #40/ PnP Bios   Banned

Posted 07 January 2005 - 07:12 PM

pascal, wow. um, sure, go for it.
HxRender | Cornerstone SDL TutorialsCurrently picking on: Hedos, Programmer One

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.