Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Pap

Pages: [1]
1
General / Re: Getting SFML working on Ubuntu based Linux
« on: August 24, 2013, 12:53:09 pm »
I wrote two simple scripts that facilitate installing/uninstalling SFML, and I post  them here in case someone else finds them useful (as I do.)
Once you installed the libraries needed (as described in http://www.sfml-dev.org/tutorials/2.1/compile-with-cmake.php, you can run this script to install SFML:

#!/bin/bash
separator=--------------------------------------------------------------------------------
install_prefix=/usr/local
zip_dir=/home/pap/Downloads
editor=emacs
echo Installing SFML \(install prefix: $install_prefix\).

echo $separator
echo \(1\) Unzipping SFML source file.
unzip -q $zip_dir/SFML-*-sources.zip -d $install_prefix/share

echo $separator
cd $install_prefix/share/SFML*
source_dir=$(pwd)
echo \(2\) Switching working directory $source_dir.

echo $separator
echo \(3\) Changing doxygen settings.
echo You need to modify $source_dir/doc/doxyfile.in so that the
echo SEARCHENGINE flag must be YES.
echo
read -p "Press any key to edit doxygen settings." -n1
$editor $source_dir/doc/doxyfile.in

echo $separator
echo \(4\) Running cmake.
echo You need to change flags SFML_BUILD_DOC and SFML_BUILD_EXAMPLES to TRUE.
echo
read -p "Press any key to run cmake." -n1
cmake -i

echo $separator
echo \(5\) Compiling SFML.
echo
read -p "Press any key to start compiling SFML." -n1
make

echo $separator
echo \(6\) Installing SFML.
echo
read -p "Press any key to install SFML." -n1
make install

echo $separator
doc_index=$install_prefix/share/SFML/doc/html/index.htm
echo \(7\) Fixing javascript issue in searchable documentation.
echo You need to add the following lines:
echo \<script type="text/javascript" src="search/search.js"\>\</script\>
echo \<link href="search/search.css" rel="stylesheet" type="text/css"/\>
echo to the header of the main documentation file $doc_index
echo
read -p "Press any key to edit documentation index file." -n1
$editor $doc_index

echo $separator
echo SFML installed.

The script takes care of instaling everything, including doxygen documentation and also lets you enable search engine (very useful). All you need to do is to change two parameters in the top of the script: zip_dir (where SFML source zipped file was downloaded) and editor (your preferred editor, which will be used to do the necessary changes in doxygen.in and documentation index.) You might also change install_prefix, in case you want to install SFML to a different place than the default.

To uninstall SFML, for example in order to install a newer version, use this script:

#!/bin/sh
separator=--------------------------------------------------------------------------------
install_prefix=/usr/local
echo Uninstalling SFML \(install prefix: $install_prefix\)
echo $separator
echo Removing directory $install_prefix/include/SFML
rm -f -r $install_prefix/include/SFML
echo Removing entries in $install_prefix/lib/
rm -f $install_prefix/lib/libsfml*
echo Removing entries in $install_prefix/lib/pkgconfig/
rm -f $install_prefix/lib/pkgconfig/sfml*
echo Removing directories in $install_prefix/share/
rm -f -r $install_prefix/share/SFML*
echo $separator
echo SFML uninstalled.

Again, you might need to change install_prefix, in case you installed SFML to a different place than the default.
Both scripts should work on any Linux distribution (not necessarily Ubuntu or other Debian-based distros.)

2
General / Re: Changes since version 2RC
« on: June 10, 2013, 11:51:16 am »
To force software rendering you should be able to simply set an environment variable, something like:
LIBGL_ALWAYS_SOFTWARE=1 ./your_binary
It works, in the sense there is a significant boost in fps, together with the usual drawback of software rendering, namely glitches. Better than nothing, I guess. Thank you for the tip :)

So, if I understand well, it is impossible to switch to software rendering using SFML itself?

3
General / Re: Changes since version 2RC
« on: June 09, 2013, 11:02:18 am »
After several experiments, I can verify what I was suspecting: OpenGL works perfectly in this laptop, but for some reason the Intel driver for the graphics card (which is the official one) is not cooperating well with SFML, hence the very low frame rate.
Is there any way to switch to software rendering? Something similar to ClanLib's CL_SetupSWRender? This should increase frame rate significantly, I suppose. As it is now, I can develop an application that might work as expected in a given PC, but being very slow on another, just because of a driver issue. The user would then conclude my application is bugged or something. Switching to software rendering should be an option in such cases.

As far I know, software rendering in SFML was discussed in the past, but I'm not sure if it is implemented or planned.

4
General / Re: Changes since version 2RC
« on: May 07, 2013, 03:23:11 am »
Some more data, in case they would help detecting the problem:
  • Laptop pc, Fujitsu Lifebook A-series.
  • Operating system: Debian 7.0 ("Wheezy"), pure 64-bit (no "multi-architecture", only 64-bit libraries installed).
  • Installed versions of dependencies (some of them probably irrelevant to the problem but for the sake of completeness):
    libraryversionheader file
    libc6-dev2.13-38/usr/include/pthread.h
    libx11-dev2:1.5.0-1/usr/include/X11/Xlib.h
    mesa-common-dev8.0.5-4/usr/include/GL/gl.h  etc
    libglew-dev1.7.0-3/usr/include/GL/glew.h  etc
    libxrandr-dev2:1.3.2-2/usr/include/X11/extensions/Xrandr.h
    libfreetype6-dev2.4.9-1.1/usr/include/freetype2/freetype/freetype.h
    libjpeg8-dev8d-1/usr/include/jpeglib.h
    libsndfile1-dev1.0.25-5/usr/include/sndfile.h
    libopenal-dev1:1.14-4/usr/include/AL/al.h
  • SFML2 was compiled from source without any warnings or errors.
  • All SFML examples also compile and run without warnings/errors.
  • Graphics driver does not force vertical synchronization.
  • System is able to run 3D games that use OpenGL extensively without any problem on speed or whatever else; I can get frame rates 100+; apparently, graphics driver works very well.
Still, even compiling the simple test program I posted earlier, I get a very poor frame rate, so poor that I initially thought even keyboard was not responding properly. I use the laptop pc very frequently, and any programming using SFML will give results way slower than expected. Since graphics driver works very well, and SFML itself is fast, I cannot think of anything else than something is wrong concerning how those two cooperate. I might be wrong, but can't think of anything else causing the very low frame rate.

Any help on solving the problem is more than welcome.

5
General / Re: Changes since version 2RC
« on: May 06, 2013, 04:52:38 pm »
Never said SFML is slow, it definitely isn't. On the other hand, my laptop's  graphics card is not bad at all (like I said I can play heavy 3D games without any problem). I am just guessing, but it seems that, in that specific computer, SFML windows are rendered slowly because there is an issue that must have to do with how SFML communicates with installed OpenGL, or vice-versa. I really don't know what else to do about that. Is there any way to get rid of the problem?

Note: not sure how I can check framerate, but I can run 3D games with 50-100+ framerate on that very computer (depends of the situation).


6
General / Re: Changes since version 2RC
« on: May 06, 2013, 04:04:11 pm »
It turns out it has to do with my environment, as Laurent said, but in a way I didn't expect: it seems that, for some reason, SFML renders windows very slowly on the my laptop (which is a more than decent computer otherwise). The following simple program should show a rotating red rectangle in a 800x600 window. The user can increase/decrease rotation speed by the up/down arrow keys, respectively:
#include <SFML/Graphics.hpp>

int main() {
  int delay=1;
  sf::RenderWindow window(sf::VideoMode(800,600),"Test");
  sf::RectangleShape square(sf::Vector2f(100,100));
  sf::Event event;
  window.clear();
  window.display();
  square.setOrigin(50,50);square.setPosition(400,300);
  square.setFillColor(sf::Color(255,0,0));
  while (window.isOpen()) {
        while (window.pollEvent(event)) {
          if (event.type==sf::Event::KeyPressed)
                switch(event.key.code) {
                case sf::Keyboard::Escape:window.close();break;
                case sf::Keyboard::Up:delay>0?delay--:delay;break;
                case sf::Keyboard::Down:delay++;break;
                default:break;
                }
          else if (event.type==sf::Event::Closed) window.close();
        }
        square.rotate(1);
        window.clear();
        window.draw(square);
        window.display();
        sf::sleep(sf::milliseconds(delay));
  }
  return EXIT_SUCCESS;
}
 
Normally, the rectangle should rotate very fast initially - so fast that you couldn't even realize it is a rectangle (on my desktop computer (with a Nvidia GPA) it looks like a circle, as the rotation speed is initially very high. Unfortunately, this is not the case on my laptop: even if I remove the line sf::sleep(sf::milliseconds(delay)); (so no delay at all between frames), it is still rotating very slowly. I can't think of any other reason than slow window rendering.
I suspect it has to do with the driver for my graphics card (an integrated Intel GPA). Note, however, that this laptop is able to run "heavy" 3D games that use OpenGL extensively, without any problem. So I am guessing something is wrong with the way SFML cooperates with OpenGL in that specific graphics card.

Attached, please find the log file from Xorg, in case it helps identifying the problem.

[attachment deleted by admin]

7
General / Re: Changes since version 2RC
« on: May 05, 2013, 05:19:19 pm »
Are you sure that it's not your environment that changed?
I am actually using two computers right now, both have the exact same Linux version installed, and the exact same version of gcc and libraries required by SFML. One of them has SFML 2 installed, the other one has version 2RC. The difference on sf::sleep(sf::milliseconds(1000)) is more than apparent (lasts more than double the time it lasts in 2RC), and the compiled code doesn't respond on sf::Keyboard::Equal or sf::Keyboard::Dash, while several other keys do work. Note that the computer that has version 2 installed had version 2RC before, and the code worked exactly as in the other computer. I doubt it is a matter of environment.

The code is too complicated to be used as an example here, will try to make a simpler code demonstrating the differences mentioned above.

8
General / Changes since version 2RC
« on: May 05, 2013, 04:59:13 pm »
Just installed version 2 (from source code, on a Linux 64-bit box), and, recompiled some code made with version 2RC. I noticed there are some changes. Specifically, sf::sleep(sf::milliseconds(1000)) seems to last much more than in 2RC.
Also, for some reason, sf::Event::KeyPressed.event.key.code doesn't seem to detect sf::Keyboard::Equal, or sf::Keyboard::Dash, while it still detects sf::Keyboard::Escape, for example, or arrow keys.

So the exact same code that used to run on version 2RC doesn't run as expected when recompiled with version 2. I noticed in the version 2 announcement that there is no change log yet, but I wanted to ask if other people also noticed the facts mentioned above, or maybe others I am not aware of yet.

9
SFML website / Re: Searchable documentation?
« on: April 19, 2013, 08:15:04 pm »
I am happy I can experiment with SFML using that search box, it makes life way easier. Thanks to anyone who helped :)

10
SFML website / Re: Searchable documentation?
« on: April 19, 2013, 07:08:39 pm »
The main problem here is, that SFML uses it's own header, which doesn't include the search JavaScript file and thus, all JavaScript calls fail.
If however you add
<script type="text/javascript" src="search/search.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
to the header it works, but it isn't really integrated into the design.
Indeed it works. Not the best solution ever I guess, but way better than no search at all. Thank you :)

11
SFML website / Re: Searchable documentation?
« on: April 19, 2013, 06:11:55 pm »
Yes, that's all you need to change. And you don't have to recompile the library, just compile the documentation (make doc)
Merci Laurent :)
Unfortunately, it doesn't seem to work. I now get a search box in /usr/local/share/SFML/doc/html/index.htm but it is dead, whatever I type there doesn't have any effect. I am using Debian's Iceweasel, which is actually Firefox. Javascript is enabled. Note that the rest of the compiled SMFL 2 works perfectly.

12
SFML website / Re: Searchable documentation?
« on: April 19, 2013, 04:58:10 pm »
Anyway, if the end of doxyfile.in I noticed a tag, "SEARCHENGINE", which is disabled by default. Is that all I need to change?
Test and find out.™ ;)

Well, nobody wants to recompile a big library with several dependencies just because *maybe* changing a tag will fix the problem. Looking at the doxyfile doesn't make it clear at all by the way, not to mention most people don't have prior need to use doxygen to even know where to look. Sorry if I wasted your time, but I thought it wouldn't hurt to ask in the forums before recompiling everything, and I admit I expected an answer. A simple "yes" or "no" would waste less of your time anyway, instead of "try it out", "it's simple to do it" but no hint.

I use Mozilla on a 64-bit Debian system, so I guess javascript won't be an issue. And yes, search enabled on the website is mandatory, in my opinion.

13
SFML website / Re: Searchable documentation?
« on: April 19, 2013, 12:33:37 pm »
In the documentation you build, you can change the Doxygen options to enable a search field.
I am not familiar with Doxygen (and I wonder why such a search field is not enabled by default). Anyway, if the end of doxyfile.in I noticed a tag, "SEARCHENGINE", which is disabled by default. Is that all I need to change?

14
SFML website / Searchable documentation?
« on: April 19, 2013, 03:51:12 am »
Dear SFML community,
after some testing of the available multimedia libraries (namely SDL, allegro, Clanlib, SFML of course, and a few other "minor" ones), I decided to stick with SFML, as it seems to me easier to use and at the same time full of features. I compiled version 2 (RC) from sources and already experimenting with it. Documentation is, without any doubt, an absolutely necessary companion. Documentation (either the online version in the website or the offline generated one) is well organized in modules/classes/files, but unfortunately it lacks a "search" option (similar to the one found in SDL), which would be very handy. Is there such a feature, say in an alternative website documenting SFML?

Pages: [1]