Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!


1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


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

  • This topic is locked This topic is locked
92 replies to this topic

#41 Roboguy   Members   -  Reputation: 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
3) add

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

Sponsor:

#42 PnP Bios   Banned   -  Reputation: 490

Like
0Likes
Like

Posted 08 January 2005 - 02:30 AM

Quote:
Original post by Roboguy
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
3) add

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


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

#43 Roboguy   Members   -  Reputation: 794

Like
0Likes
Like

Posted 08 January 2005 - 03:41 AM

Quote:
Original post by PnP Bios
Quote:
Original post by Roboguy
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
3) add

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


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   -  Reputation: 490

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

#45 Spudder   Members   -  Reputation: 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   -  Reputation: 490

Like
0Likes
Like

Posted 08 January 2005 - 04:29 AM

Quote:
Original post by Spudder
I'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

#47 Roboguy   Members   -  Reputation: 794

Like
0Likes
Like

Posted 08 January 2005 - 04:41 AM

Quote:
Original post by PnP Bios
Can 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

#48 Spudder   Members   -  Reputation: 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.

#49 Cherez   Members   -  Reputation: 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
Added cstring

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   -  Reputation: 490

Like
0Likes
Like

Posted 08 January 2005 - 07:39 AM

Quote:
Original post by Cherez
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
Added cstring

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.


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'm glad to see so many people excited about this.

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   -  Reputation: 490

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   -  Reputation: 490

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

#53 Melekor   Members   -  Reputation: 379

Like
0Likes
Like

Posted 08 January 2005 - 01:06 PM

Quote:
From the source

int 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   -  Reputation: 490

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   -  Reputation: 490

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

#56 Xipher   Members   -  Reputation: 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   -  Reputation: 490

Like
0Likes
Like

Posted 08 January 2005 - 04:15 PM

Quote:
Original post by Xipher
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.


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

#58 Cherez   Members   -  Reputation: 175

Like
0Likes
Like

Posted 08 January 2005 - 04:43 PM

Quote:
Original post by Melekor
Quote:
From the source

int 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

#59 Cherez   Members   -  Reputation: 175

Like
0Likes
Like

Posted 08 January 2005 - 04:47 PM

Quote:
Original post by PnP Bios
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.


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.

#60 Kylotan   Moderators   -  Reputation: 3346

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.



PARTNERS