| xander333 (622) | |
|
'ello everybody, At the moment I'm creating my own little games in pure OpenGL. In the future I'd like to use a complementary lib for that. So the obvious choice: SDL vs SFML. Pretty much everywhere I went, people recommended me SFML. I tried it recently, and there seems to be an issue with the ATI drivers for the 1.6 version... This bug *should* get fixed by 2.0 I saw there was already a beta out from SFML 2, anyone knows how complete it is? Xander314, you maybe? Cheers, Xander | |
|
|
|
| computerquip (1892) | |
|
SFML 2 is easily usable. I use it myself. Btw, if you plan on wrapping around your multimedia library (SFML, SDL), SDL is easily a competitor. I personally use SDL over SFML any-day. | |
|
|
|
| Xander314 (1383) | |
| I would definitely use SFML 2.0 over 1.6. I've had very few bugs with it and the public interface is different in places so I don't really see the point in learning the old one now. | |
|
|
|
| computerquip (1892) | |
| The tutorials and documentation aren't quite up to date on a few things but if you get some weird bugs such as incorrect function decelerations, look in the headers before complaining on the forums about it. | |
|
|
|
| Xander314 (1383) | |
|
I find that in an IDE like MSVC++ with decent (ish) intellisense, it's possible to work out that kind of thing as you go. EDIT: And of course, if you have a chance, you can just run doxygen over the source yourself ;) | |
|
Last edited on
|
|
| xander333 (622) | |
|
At the moment I'm leaning more towards SDL, but I can't seem to find tutorials who use it with OpenGL. They all rely on SDL for the rendering... | |
|
|
|
| Xander314 (1383) | |
|
Here's a SDL/OpenGL tutorial: http://www.sdltutorials.com/sdl-opengl-tutorial-basics/ I'm pretty sure once you do this kind of thing, the rest is just the same as if you were using OpenGL by itself. | |
|
Last edited on
|
|
| xander333 (622) | |
|
Thanks so much Xander! I have another question. I've never compiled libraries myself. How do I go about compiling SFML 2 (in C::B) for own use? I'm going to try a bit of both and see what I like best! | |
|
|
|
| Xander314 (1383) | |
|
You download the source, from the downloads page, generate a Code::Blocks project with CMake and then open it in CMake and build. If you want static & dynamic builds + debug & release, you will need to make each of these as a separate project using CMake. The official tutorial: http://sfml-dev.org/tutorials/2.0/compile-with-cmake.php And I hesitate to advertise my blog/etc. on here, but if you want a video you could try mine :P http://www.youtube.com/watch?v=NmUN87zIB3M (it's the first video a search would find anyway...) EDIT: Please forgive the fact that I say import libraries are static libraries (it didn't seem worth rerecording the whole video for). | |
|
Last edited on
|
|
| xander333 (622) | |||
|
I'm following your textual tutorial and I'm stuck already... CMake shows this:
I also get the error (about 5 times !?) libgmp-10.dll is missing! While it's obviously there in C:\Program Files\CodeBlocks\MinGW\bin
| |||
|
|
|||
| Xander314 (1383) | |
|
I have just tried to replicate your error, and have done so inconsistently :/ I suggest therefore that you try deleting the sfml2 folder and replacing it, before retrying with CMake. Is your Code::Blocks + MinGW installed in an irregular location? Actually, what is your OS? It looks like CMake is looking for everything in Program Files (x86) and you say Code::Blocks is installed in Program Files. Maybe this is the problem? You could (:S) try reinstalling Code::Blocks in the Program Files (x86) directory, although one would imagine that CMake is clever enough to check both... PS: You accidentally called your build directory 'buildd' - thought you might like to know ;) | |
|
|
|
| xander333 (622) | |||
Ok I changed it all around. I set up C::B to use another version of MinGW (int C:\MinGW).Everything works fine, I can still compile everything in C::B. So I had another go with CMake. This time I just chose "MinGW Makefiles", so no more C::B. Now I get this error:
FYI: I did include C:\MinGW in the Path variable...
| |||
|
|
|||
| Xander314 (1383) | ||
As in your downloaded and installed MinGW separately? And you chose "MinGW Makefiles" rather than "Codeblocks - MinGW Makefiles"? If you want to build with Code::Blocks, you are going to have to pick the second one. | ||
|
|
||
| xander333 (622) | |
|
Indeed, and I don't want to build with Codeblocks. What could cause the error? | |
|
|
|
| xander333 (622) | |
|
Ok I finally got it working (with yet another version of MinGW -.-) So how do I link it now in C::B? I mean, I don't have an include folder or something like that generated... EDIT: got it all working, FINALLY! I'd like to thank you all for taking the time to help me, especially Xander ;) | |
|
Last edited on
|
|
| Xander314 (1383) | ||
Hah! I'm not sure I really helped at all :/ In fact, I'd be interested to hear how you fixed everything in the end, if you have the time to post. It would be useful for me to add any relevant bits to my tutorial. :) EDIT: I'm guessing you got hold of MAKE and ran that with the makefile CMake gives you. I think I might read up on this stuff a bit and write some "Building SFML 2.0 with MinGW|Visual Studio Makefiles" tutorials, as it is probably better to do it that way than to use IDEs as I have previously done. | ||
|
Last edited on
|
||
| xander333 (622) | |
|
Ok this is how I did it: Instead of the MinGW distro at nuwen.net (which includes boost, SDL and other handy libs) I downloaded the tDragon one: http://tdm-gcc.tdragon.net . I STILL got errors, but then I thought of something. I moved that MinGW BEFORE the other in the PATH variable. From then on everything went smooth! I could even choose C::B w/ MinGW Makefiles :) (at first I thought it would compile it with the compiler specified in C::B, which it doesn't, it just creates a project!) So I compiled it, et voila! One more question though. I complied "all". I got .dll and .a files. My program only works if I link it to sfml-system instead of (in all the tuts it's like this) -lsfml-system with sometimes -d attached for the debug or static. How do I generate those files?Compile it again? Cheers, Xander | |
|
|
|
| Xander314 (1383) | |
|
So in the end you generated a Code::Blocks workspace and built the libraries using that? From my experience, although Code::Blocks supports multiple configurations, the SFML project generated by CMake doesn't have them. If you want to have the '-d' then you have to reopen CMake and look at the options highlighted in red after you have configured. One should be called "BUILD_SHARED_LIBS". Checking this gives you the dlls and import libraries, whereas unchecking it gives you the static -s libraries. There is another, but I can't remember what it's called - I'm at school and don't have CMake to hand right now. But it's value by default is "Release". You can change it to "Debug". If you change either of these, and re generate your project file, you can rebuild to get the corresponding libraries with -d extension, which you should be using for debug builds. As for the 'l' at the start, I think (but am not sure as I don't build on the command line) that this is just an artifice of the command line argument format, and lsfml-system will in fact link sfml-system.Regards, Xander314 | |
|
|
|
| xander333 (622) | |||
|
Alright so I built them all now... Dynamic release and dynamic debug both work. Static, none of them does... This is the error:
It really don't get it... when I try the debug static ones it says it cant find them, while they ARE in the folder with the rest of the libs.... | |||
|
|
|||
| Xander314 (1383) | |||
The first problem is because to link statically to SFML, one must define the preprocessor macro SFML_STATIC. One should do it either in IDE settings or on the command line (i.e. don't use #define).
Are you writing, e.g. sfml-graphics-d-s rather than sfml-graphics-s-d? Just a guess... | |||
|
|
|||