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.


Topics - JDieskau

Pages: [1]
1
Graphics / Why is displaying a sf::Sprite so incredible slow? [DONE]
« on: April 02, 2009, 05:08:33 pm »
Code for testing:
Code: [Select]
#include <iostream>
#include <SFML/Graphics.hpp>

int main( int argc, char **argv )
{
  sf::RenderWindow App;
  App.Create( sf::VideoMode::GetDesktopMode(), "Test", sf::Style::Close );

  sf::Image img;
  if ( !img.LoadFromFile ( "test.png" ) ) {
    return false;
  }

  sf::Sprite spr;
  spr.SetImage( img );


  while ( true ) {
    App.Draw ( spr );

    App.Display();
    App.Clear();

    std::cout << 1.f / App.GetFrameTime() << std::endl;
  }
}

Quote
$file test.png
test.png: PNG image data, 1024 x 1024, 8-bit/color RGB, non-interlaced

I've got 6-7 fps on a 2,16Ghz Core2Duo with a GeForce 9600M GT....
What is wrong here? I use sfml 1.4 on Gentoo Linux.

EDIT: Ok, its apparently a bug in the nvidia-driver or xserver. If I turn dualview off, it works pretty good (2000fps).

2
Graphics / Mysterious error when loading an image and use sf::String
« on: April 02, 2009, 02:23:50 pm »
At first, sorry for my bad english. I hope someone understand me.

Here is a little test-code:
Code: [Select]
#include <iostream>
#include <SFML/Graphics.hpp>

int main( int argc, char **argv )
{
  sf::RenderWindow App;
  sf::String str ( " Test " );

  App.Create( sf::VideoMode::GetDesktopMode(), "Test", sf::Style::Close );

  while ( true ) {
    App.Draw ( str );
   
    App.Display();
    App.Clear();
  }


}

It draws a string in the left upper corner and should look like this:


Allright? Good. Now my problem. I extend the code to this:
Code: [Select]
#include <iostream>
#include <SFML/Graphics.hpp>

int main( int argc, char **argv )
{
  sf::RenderWindow App;
  sf::Image img;

  if ( !img.LoadFromFile ( "test.png" ) ) {
    return false;
  }

  sf::String str ( " Test " );

  App.Create( sf::VideoMode::GetDesktopMode(), "Test", sf::Style::Close );

  while ( true ) {
    App.Draw ( str );
   
    App.Display();
    App.Clear();
  }
}

Annotation:
Quote
$ file test.png
test.png: PNG image data, 50 x 50, 8-bit/color RGB, non-interlaced


And now it looks like shit:

In my opinion, the code is right. Whats wrong here?
Btw. if I instantiate the sf::String first, then it looks like picture 1 - all right. But something goes definitive wrong. Any idea?


I use Gentoo Linux. My tested sfml versions are: 1.4, trunk svn und brunch 2.0 svn

EDIT 1: With the svn version i get this error message:
Quote
Failed to create image, its internal size is too high (300x230)

Its an texturesize ore somesthing like that? OpenGL? But 300x230? I have a NVidia GeForce 9600M GT and the newest stable driver -> 180.29

Pages: [1]
anything