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 - chehob

Pages: [1]
1
Graphics / sprite rendering problem
« on: June 14, 2011, 03:30:50 pm »
Quote from: "Laurent"
Weird... never seen this before :shock:

What's your OS? Graphics card? Are your graphics drivers up-to-date?

Windows 7, Intel GMA 3100, don't know about drivers. I'm at workstation now, will try same at home.

2
Graphics / sprite rendering problem
« on: June 14, 2011, 03:24:33 pm »
Quote from: "Laurent"
Is it really this code that produces this output??


Code that doesn't work normally:
Code: [Select]

#include <SFML/Graphics.hpp>

int main()
{
   sf::VideoMode videoMode = sf::VideoMode(400, 300, 32);
   sf::RenderWindow App(videoMode , "SFML Window");
   App.SetFramerateLimit(60);
     
   sf::Image Image;
   if (!Image.LoadFromFile("xolo.png"))
   {
      return EXIT_FAILURE;
   }

   sf::Sprite Cross;
   Cross.SetImage(Image);

   while (App.IsOpened())
   {
      sf::Event Event;
      while (App.PollEvent(Event))
      {
         // Window closed
         if (Event.Type == sf::Event::Closed)
            App.Close();

         // [Esc] pressed
         if ((Event.Type == sf::Event::KeyPressed) && (Event.Key.Code == sf::Key::Escape))
            App.Close();
      }

      App.Clear();

      App.Draw(Cross);

      App.Display();
   }

    return EXIT_SUCCESS;
}


This one does:
Code: [Select]

#include <SFML/Graphics.hpp>

int main()
{
   sf::VideoMode videoMode = sf::VideoMode(400, 300, 32);
   sf::RenderWindow App(videoMode , "SFML Window");
   App.SetFramerateLimit(60);
     
   sf::Image Image;
   if (!Image.LoadFromFile("xolo.png"))
   {
      return EXIT_FAILURE;
   }

   sf::Sprite Cross;
   Cross.SetImage(Image);

   sf::Shape Line = sf::Shape::Line(0, 0, 0, 0, 1, sf::Color(0,0,0,0));

   while (App.IsOpened())
   {
      sf::Event Event;
      while (App.PollEvent(Event))
      {
         // Window closed
         if (Event.Type == sf::Event::Closed)
            App.Close();

         // [Esc] pressed
         if ((Event.Type == sf::Event::KeyPressed) && (Event.Key.Code == sf::Key::Escape))
            App.Close();
      }

      App.Clear();

      App.Draw(Cross);
 App.Draw(Line);

      App.Display();
   }

    return EXIT_SUCCESS;
}

3
Graphics / sprite rendering problem
« on: June 14, 2011, 03:00:08 pm »
Source image:
Wrong:
Correct:

4
Graphics / sprite rendering problem
« on: June 14, 2011, 02:48:10 pm »
Hello,
Here is the code:

Code: [Select]

#include <SFML/Graphics.hpp>

int main()
{
sf::VideoMode videoMode = sf::VideoMode(400, 300, 32);
sf::RenderWindow App(videoMode , "SFML Window");
App.SetFramerateLimit(60);

sf::Image Image;
if (!Image.LoadFromFile("xolo.png"))
{
return EXIT_FAILURE;
}

sf::Sprite Cross;
Cross.SetImage(Image);

while (App.IsOpened())
{
sf::Event Event;
while (App.PollEvent(Event))
{
// Window closed
if (Event.Type == sf::Event::Closed)
App.Close();

// [Esc] pressed
if ((Event.Type == sf::Event::KeyPressed) && (Event.Key.Code == sf::Key::Escape))
App.Close();
}

App.Clear();

App.Draw(Cross);

App.Display();
}

    return EXIT_SUCCESS;
}

While running this program it doesnt draw the sprite, instead it draws a filled rectangle of sprite dimensions

BUT
when I add drawing the shape it actually works as supposed to be

Code: [Select]

sf::Sprite Cross;
Cross.SetImage(Image);

sf::Shape Line = sf::Shape::Line(0, 0, 0, 0, 1, sf::Color(0,0,0,0));
...

App.Clear();

App.Draw(Cross);
App.Draw(Line);

App.Display();


What's the problem here?
I'm using SFML 2.0

Pages: [1]
anything