• Create Account

## @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

### #41Roboguy  Members

794
Like
0Likes
Like

Posted 07 January 2005 - 08:08 PM

I had to do a few of things to get it to compile on my machine:
1) #include <cstring> in hxSDL.cpp
2) #include <cstdlib> in hxrender.cpp
#ifndef NULL#define NULL 0L#endif
in hxrender.cpp
4) change #include <sdl.h> to #include <SDL.h>, some filesystems are case sensitive(such as the ones commonly used with linux)

### #42 PnP Bios   Banned

494
Like
0Likes
Like

Posted 08 January 2005 - 02:30 AM

Quote:
 Original post by RoboguyI had to do a few of things to get it to compile on my machine:1) #include in hxSDL.cpp2) #include in hxrender.cpp3) add#ifndef NULL#define NULL 0L#endifin hxrender.cpp4) change #include to #include , some filesystems are case sensitive(such as the ones commonly used with linux)

um, what compiler are you using?
HxRender | Cornerstone SDL TutorialsCurrently picking on: Hedos, Programmer One

### #43Roboguy  Members

794
Like
0Likes
Like

Posted 08 January 2005 - 03:41 AM

Quote:
Original post by PnP Bios
Quote:
 Original post by RoboguyI had to do a few of things to get it to compile on my machine:1) #include in hxSDL.cpp2) #include in hxrender.cpp3) add#ifndef NULL#define NULL 0L#endifin hxrender.cpp4) change #include to #include , some filesystems are case sensitive(such as the ones commonly used with linux)

um, what compiler are you using?
GCC 3.3, I said you should define NULL just in case they try to compile with gcc instead of g++(gcc doesn't define it, g++ does). As for the other things(except 4, that is only required for case-sensitive filesystems, but I recommend you do change it), they would probably be required no matter what machine you compile it on

### #44 PnP Bios   Banned

494
Like
0Likes
Like

Posted 08 January 2005 - 04:10 AM

Roboguy, will do.

I found a free wiki to use as a documentation site. As soon as I get a template going, I'll set you guys loose on it.
HxRender | Cornerstone SDL TutorialsCurrently picking on: Hedos, Programmer One

### #45Spudder  Members

385
Like
0Likes
Like

Posted 08 January 2005 - 04:21 AM

I've got a Linux version (static lib) if anyone wants to use it - available from here

### #46 PnP Bios   Banned

494
Like
0Likes
Like

Posted 08 January 2005 - 04:29 AM

Quote:
 Original post by SpudderI've got a Linux version (static lib) if anyone wants to use it - available from here

You built the whole thing as one library?
Not what I had in mind, but, if it works..

Can I build static libraries for linux (.a files) using dev-c++?
HxRender | Cornerstone SDL TutorialsCurrently picking on: Hedos, Programmer One

### #47Roboguy  Members

794
Like
0Likes
Like

Posted 08 January 2005 - 04:41 AM

Quote:
 Original post by PnP BiosCan I build static libraries for linux (.a files) using dev-c++?
Probably, if it comes with ar(the UNIX archiving program which makes .a files). Also, you'll need the header files in addition to the library file for it to work. This is how you would make an archive with ar(if your using ar.exe, change 'ar' to 'ar.exe'):
ar lib<library name>.a <object files>

it should work on linux, assuming the object files are in the right format(OSX doesn't use the same format, but I can compile an OSX one for you). If it doesn't you could try using the gcc that comes with cygwin

### #48Spudder  Members

385
Like
0Likes
Like

Posted 08 January 2005 - 05:47 AM

From my experience compiling static libs with Dev-C++ for use under Linux has it problems, all I did was compile the source files into object files then archive them into an .a file. You still need to link to any third party libs like SDL with this file though.

### #49Cherez  Members

175
Like
0Likes
Like

Posted 08 January 2005 - 06:40 AM

Trying to compile under Linux....I'll give a quick summary of changes I had to make.

hxrender.cpp
Changed gl/gl.h to GL/gl.h and gl/glu.h to GL/glu.h
Include cstdlib

In hxiNextPowerOfTwo the pow(2, i) is ambiguous, and becasue i is an integer I just changed pow(2, i) to 1 << i

hxSDL.cpp:
Changed sdl.h to SDL.h
Included cstring

hxUtility.cpp:
Changed gl/gl.h to GL/gl.h and gl/glu.h to GL/glu.h

hxrender.h:
Removed extra code after #endif ignored but produces a warning on GCC.

Since these are .cpp files I changed the C headers to C++ style (cmath instead of math.h etc.)
I might have forgotten a change though...
I also made a very very basic Makefile and put it in a tarball. If you want it online I'll be glad to send it to you.

### #50 PnP Bios   Banned

494
Like
0Likes
Like

Posted 08 January 2005 - 07:39 AM

Quote:
 Original post by CherezTrying to compile under Linux....I'll give a quick summary of changes I had to make.hxrender.cppChanged gl/gl.h to GL/gl.h and gl/glu.h to GL/glu.hInclude cstdlibIn hxiNextPowerOfTwo the pow(2, i) is ambiguous, and becasue i is an integer I just changed pow(2, i) to 1 << ihxSDL.cpp:Changed sdl.h to SDL.hIncluded cstringhxUtility.cpp:Changed gl/gl.h to GL/gl.h and gl/glu.h to GL/glu.hAdded cstringhxrender.h:Removed extra code after #endif ignored but produces a warning on GCC.Since these are .cpp files I changed the C headers to C++ style (cmath instead of math.h etc.)I might have forgotten a change though... I also made a very very basic Makefile and put it in a tarball. If you want it online I'll be glad to send it to you.

It seems like a bunch of people have made ports for this. Everybody who has made a port, or significant changes to the library, email them to me as zipped attachments.

pnpbios at hotmail dot com

I will post them all on my web site, get everything compatable with the zlib license, and make it so we can vote on who want's which port.

I am going to do some more work on the wiki today, like build a function template and stuff. It looks like this one is also flexable enough to handle tutorials as well as function explinations.
HxRender | Cornerstone SDL TutorialsCurrently picking on: Hedos, Programmer One

### #51 PnP Bios   Banned

494
Like
0Likes
Like

Posted 08 January 2005 - 07:53 AM

Function Definition template

What do you think?

xWiki rocks.
HxRender | Cornerstone SDL TutorialsCurrently picking on: Hedos, Programmer One

### #52 PnP Bios   Banned

494
Like
0Likes
Like

Posted 08 January 2005 - 09:08 AM

Temporary hosting has been put up.
Much thanks to Steven Wallace and David young for the fast action on getting me some linux and mac ports.

temporary hosting page.

Nothing is final right now. Lets make this thing the best we can. I will wait for a while. Still need to hear back from sorce forge, but we will get something going.
HxRender | Cornerstone SDL TutorialsCurrently picking on: Hedos, Programmer One

### #53Melekor  Members

379
Like
0Likes
Like

Posted 08 January 2005 - 01:06 PM

Quote:
 From the sourceint hxiNextPowerOfTwo(int val){ int rv = 0; for(int i = 0; i < 32; i += 1) { if(pow(2,i) >= val) return (int)pow(2,i); } return rv;}.

And this coming after all those threads on this very forum about making a good NextPowerOfTwo function...

### #54 PnP Bios   Banned

494
Like
0Likes
Like

Posted 08 January 2005 - 01:34 PM

If you are going to be building a new sprite every pass, then you deserve slow performance. What works, works. Submit it as a change, and i'll fix it.
HxRender | Cornerstone SDL TutorialsCurrently picking on: Hedos, Programmer One

### #55 PnP Bios   Banned

494
Like
0Likes
Like

Posted 08 January 2005 - 02:00 PM

Not programming for linux, I want to know what the big deal about using cstring and cstdlib are. And why not header files? I'm not a c++ programmer.
HxRender | Cornerstone SDL TutorialsCurrently picking on: Hedos, Programmer One

### #56Xipher  Members

122
Like
0Likes
Like

Posted 08 January 2005 - 04:00 PM

SDL actually has the ablitity to work side by side with OpenGL if you didn't notice. SDL can be used for stuff like input and timing (heck if you throw one ofthe SDL networking libraries into the mix you can do that too), while OpenGL is used for the rendering. As far as I know this is actually what at least one game does (at least I suspect so) that is a comercial product. Now simply using OpenGL for 2D I don't think would be much different, and has been said lets you take advantage of the hardware accel.

### #57 PnP Bios   Banned

494
Like
0Likes
Like

Posted 08 January 2005 - 04:15 PM

Quote:
 Original post by XipherSDL actually has the ablitity to work side by side with OpenGL if you didn't notice. SDL can be used for stuff like input and timing (heck if you throw one ofthe SDL networking libraries into the mix you can do that too), while OpenGL is used for the rendering. As far as I know this is actually what at least one game does (at least I suspect so) that is a comercial product. Now simply using OpenGL for 2D I don't think would be much different, and has been said lets you take advantage of the hardware accel.

don't mean to be rude... but did you read any of the posts? Did you look at the code?
HxRender | Cornerstone SDL TutorialsCurrently picking on: Hedos, Programmer One

### #58Cherez  Members

175
Like
0Likes
Like

Posted 08 January 2005 - 04:43 PM

Quote:
Original post by Melekor
Quote:
 From the sourceint hxiNextPowerOfTwo(int val){ int rv = 0; for(int i = 0; i < 32; i += 1) { if(pow(2,i) >= val) return (int)pow(2,i); } return rv;}.

And this coming after all those threads on this very forum about making a good NextPowerOfTwo function...

I've got another version in my Linux port that just uses << instead of pow. I would recommend stealing one from http://www.gamedev.net/community/forums/topic.asp?topic_id=229831&PageSize=25&WhichPage=1

### #59Cherez  Members

175
Like
0Likes
Like

Posted 08 January 2005 - 04:47 PM

Quote:
 Original post by PnP BiosNot programming for linux, I want to know what the big deal about using cstring and cstdlib are. And why not header files? I'm not a c++ programmer.

It's no big deal, Roboguy and I are just major purists. C headers were popular before C++'s standardization (in 1999 I believe) when it was agreed to wrap all the standard library in the std namespace and c was prefixed to all the C headers and .h was dropped. Your way still works to mainting C compatability, we just did it the *official* way.

Note: I am not good qwith historyi n any sense so I could be totally confused on this. Just what I've picked up in C++ chat rooms.

### #60Kylotan  Moderators

6546
Like
0Likes
Like

Posted 08 January 2005 - 04:56 PM

I think there's a bit of an issue in that VC6 provides the new C++ headers for the C library, but doesn't place the contents in the std:: namespace. Watch out for that if these changes go in.

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.