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

Pages: [1] 2
1
Graphics / RenderImage doesn't work
« on: December 19, 2010, 05:29:17 pm »
Hello again, I come here with another problem - the renderimage doesn't seem to draw anything.
In this minimal example we're supposed to see black window, with green rectangle (renderimage clear) with a red rectangle in it (renderimage draw).
But all I see is black screen...

Spec:
Linux with Arch Distribution
Msi wind u120 - intel integrated graphics
Sfml2
Drivers updated daily
RenderImage::IsAvailable() returns 1

Code: [Select]

#include <SFML/Graphics.hpp>

int main()
{
sf::RenderWindow Window(sf::VideoMode(100,100), "");
sf::RenderImage Image;
Image.Create(50,50);

while (true)
{
sf::Event Event;
while (Window.GetEvent(Event)) {}

Image.Clear(sf::Color(0,255,0));
Image.Draw(sf::Shape::Rectangle(0,0,25,25,sf::Color(255,0,0)));
Image.Display();

Window.Clear();
sf::Sprite Temp;
Temp.SetImage(Image.GetImage());
Window.Draw(Temp);
Window.Display();
}
}


Probably important edit:
I played a bit with valgrind (profiler, memory check etc.)
And it found that there are a few uninitialized variables used at this line:
Code: [Select]

Image.Draw(sf::Shape::Rectangle(0,0,25,25,sf::Color(255,0,0)));

errors profiler returned are:
Code: [Select]

==12276== Conditional jump or move depends on uninitialised value(s)
==12276==    at 0x4071948: sf::Renderer::SetShader(sf::Shader const*) (in /usr/lib/libsfml-graphics.so.2.0.0)
==12276==    by 0x40729B4: sf::RenderTarget::Draw(sf::Drawable const&) (in /usr/lib/libsfml-graphics.so.2.0.0)
==12276==    by 0x8049476: main (Temp.cpp:15)
==12276==
==12276== Conditional jump or move depends on uninitialised value(s)
==12276==    at 0x4071786: sf::Renderer::SetBlendMode(sf::Blend::Mode) (in /usr/lib/libsfml-graphics.so.2.0.0)
==12276==    by 0x4057AD1: sf::Drawable::Draw(sf::RenderTarget&, sf::Renderer&) const (in /usr/lib/libsfml-graphics.so.2.0.0)
==12276==    by 0x40729C7: sf::RenderTarget::Draw(sf::Drawable const&) (in /usr/lib/libsfml-graphics.so.2.0.0)
==12276==    by 0x8049476: main (Temp.cpp:15)
==12276==
==12276== Conditional jump or move depends on uninitialised value(s)
==12276==    at 0x4071898: sf::Renderer::SetTexture(sf::Image const*) (in /usr/lib/libsfml-graphics.so.2.0.0)
==12276==    by 0x4075994: sf::Shape::Render(sf::RenderTarget&, sf::Renderer&) const (in /usr/lib/libsfml-graphics.so.2.0.0)
==12276==    by 0x4057AE4: sf::Drawable::Draw(sf::RenderTarget&, sf::Renderer&) const (in /usr/lib/libsfml-graphics.so.2.0.0)
==12276==    by 0x40729C7: sf::RenderTarget::Draw(sf::Drawable const&) (in /usr/lib/libsfml-graphics.so.2.0.0)
==12276==    by 0x8049476: main (Temp.cpp:15)
==12276==
==12276== Conditional jump or move depends on uninitialised value(s)
==12276==    at 0x40718D2: sf::Renderer::SetTexture(sf::Image const*) (in /usr/lib/libsfml-graphics.so.2.0.0)
==12276==    by 0x4075994: sf::Shape::Render(sf::RenderTarget&, sf::Renderer&) const (in /usr/lib/libsfml-graphics.so.2.0.0)
==12276==    by 0x4057AE4: sf::Drawable::Draw(sf::RenderTarget&, sf::Renderer&) const (in /usr/lib/libsfml-graphics.so.2.0.0)
==12276==    by 0x40729C7: sf::RenderTarget::Draw(sf::Drawable const&) (in /usr/lib/libsfml-graphics.so.2.0.0)
==12276==    by 0x8049476: main (Temp.cpp:15)
==12276==
==12276== Conditional jump or move depends on uninitialised value(s)
==12276==    at 0x4071948: sf::Renderer::SetShader(sf::Shader const*) (in /usr/lib/libsfml-graphics.so.2.0.0)
==12276==    by 0x40729B4: sf::RenderTarget::Draw(sf::Drawable const&) (in /usr/lib/libsfml-graphics.so.2.0.0)
==12276==    by 0x804952A: main (Temp.cpp:21)
==12276==
==12276== Conditional jump or move depends on uninitialised value(s)
==12276==    at 0x4071786: sf::Renderer::SetBlendMode(sf::Blend::Mode) (in /usr/lib/libsfml-graphics.so.2.0.0)
==12276==    by 0x4057AD1: sf::Drawable::Draw(sf::RenderTarget&, sf::Renderer&) const (in /usr/lib/libsfml-graphics.so.2.0.0)
==12276==    by 0x40729C7: sf::RenderTarget::Draw(sf::Drawable const&) (in /usr/lib/libsfml-graphics.so.2.0.0)
==12276==    by 0x804952A: main (Temp.cpp:21)
==12276==
==12276== Conditional jump or move depends on uninitialised value(s)
==12276==    at 0x4071898: sf::Renderer::SetTexture(sf::Image const*) (in /usr/lib/libsfml-graphics.so.2.0.0)
==12276==    by 0x40768C7: sf::Sprite::Render(sf::RenderTarget&, sf::Renderer&) const (in /usr/lib/libsfml-graphics.so.2.0.0)
==12276==    by 0x4057AE4: sf::Drawable::Draw(sf::RenderTarget&, sf::Renderer&) const (in /usr/lib/libsfml-graphics.so.2.0.0)
==12276==    by 0x40729C7: sf::RenderTarget::Draw(sf::Drawable const&) (in /usr/lib/libsfml-graphics.so.2.0.0)
==12276==    by 0x804952A: main (Temp.cpp:21)


==12276== is a process number, so you shouldn't worry about that.
As you can probably see the rest are callstacks.

I hope it helps you somehow

2
Graphics / Arch Linux, SFML2, Drawing sprites through static class
« on: December 12, 2010, 08:53:35 pm »
I have intel integrated 945gme so it's: i915 (checked in lsmod)
I update my system daily, which means the drivers too, and they are from Arches depos, so they're probably the stable ones.

3
Graphics / Arch Linux, SFML2, Drawing sprites through static class
« on: December 12, 2010, 06:56:03 pm »
After adding sf::Context Conext at the top of main() function of the minimal example, the problem still persists.

4
Graphics / Arch Linux, SFML2, Drawing sprites through static class
« on: December 12, 2010, 06:03:08 pm »
Look back at the topic name - it's SFML2 ;)

5
Graphics / Arch Linux, SFML2, Drawing sprites through static class
« on: December 12, 2010, 03:40:37 pm »
Quote from: "Laurent"

What kind of artifacts?


Sorry, don't have any image editor with me right now to crop it.

Quote from: "Laurent"
A global/static pointer to a sf::RenderWindow which is allocated in CWindow::Init?

Doesn't change anything.  Still the same as above.

Quote from: "Laurent"
What happens if you create the image and sprite after calling CWindow::Init? ...

Woah! Now it works as it should for some reason! Never fought that window is interconnected with Image :P

6
Graphics / Arch Linux, SFML2, Drawing sprites through static class
« on: December 12, 2010, 02:48:54 pm »
When drawing sprites on window which is in static class, you get really weird artifacts. Here's the download to minimal example which has a png and somewhat minimal code.
http://www.mediafire.com/?5gk2434jg3w2oo4

I'm working on a MSI Wind u120 with Arch Linux, and myself compiled and updated sfml2, no changes made to the source. The distro is up to date

If you want to have a quick glance at code:
Code: [Select]
#include <SFML/Graphics.hpp>

class CWindow
{
private:
static sf::RenderWindow Window;
public:
static void Init(unsigned int Width, unsigned int Height, int Style=sf::Style::Default)
{
Window.Create(sf::VideoMode(Width,Height), "", Style);
}
static bool IsOpened()
{
return Window.IsOpened();
}
static void Clear(sf::Color Color=sf::Color(0,0,0))
{
Window.Clear(Color);
}
static void Draw(const sf::Drawable &Drawable)
{
Window.Draw(Drawable);
}
static void Display()
{
Window.Display();
sf::Sleep(0);
}
static bool GetEvent(sf::Event& Event)
{
return Window.GetEvent(Event);
}
static void Close()
{
Window.Close();
}
};

sf::RenderWindow CWindow::Window;

int main()
{
sf::Image CornerImage;
CornerImage.LoadFromFile("Corner.png");
sf::Sprite Corner;
Corner.SetImage(CornerImage);

CWindow::Init(100,100);

while (CWindow::IsOpened())
{
sf::Event Event;
while (CWindow::GetEvent(Event))
{
if (Event.Type==sf::Event::Closed)
CWindow::Close();
}

CWindow::Clear(sf::Color(255,255,0));
CWindow::Draw(Corner);
CWindow::Display();
}
}

7
General / Linux segmentation fault on app start
« on: February 08, 2010, 03:35:23 pm »
Didn't have Sfml 1.5 at all, so that's out of question.

8
General / Linux segmentation fault on app start
« on: February 07, 2010, 11:32:41 pm »
Now for something totally unexpected! After removing ANYTHING containting sfml keyword from my computer, then downloading newest sfml2, after that making, and sudo making instal DESTDIR=/usr/, it works! Yay!
Also I think you may have an unrelated bug in your make install file, you have DESTDIR=/usr/local, which works when compiling. But when trying to start the compiled app (at least on Fedora), the terminal says it can't find sfml-system.so.2.0, it may be better if you changed DESTDIR to /usr/

9
General / Linux segmentation fault on app start
« on: February 07, 2010, 10:57:04 pm »
Bump as a really needed cry for help!

10
General / Linux segmentation fault on app start
« on: February 05, 2010, 04:53:55 pm »
Sorry, I didn't word it right. I got it from sourceforge svn,

11
General / Linux segmentation fault on app start
« on: February 04, 2010, 05:33:02 pm »
32bit, and as always it's sfml2. Got it from download page (from sourceforge to be more exact)

12
General / Linux segmentation fault on app start
« on: February 04, 2010, 11:18:50 am »
Glgears work fine, opengl, X, drivers etc. all work fine. Minimal example is quite basic:
Code: [Select]
#include <SFML/System.hpp>
int main()
{
}

And compiling with:
Code: [Select]
g++ -Wall -o sfml sfmlcheck.cpp -lsfml-system

13
General / Linux segmentation fault on app start
« on: January 24, 2010, 10:28:05 pm »
I've compiled sfml and samples smoothly on ubuntu 9/fedora 12 on MSI Wind u120, but when I try to run any app containing something from sfml it quits and "Segmentation Fault (Core Dumped)" gets written on stdout. Is it something with sfml, or my bad on linux side, since I'm new to compiling on linux?

14
Graphics / SFML Accessing null pointer
« on: January 14, 2010, 09:38:58 pm »
Well then, I checked the 1343, and it is the 1344 being the faulty one.

15
Graphics / SFML Accessing null pointer
« on: January 14, 2010, 09:27:37 pm »
But that's a lot more work involved, we should check only the ones with changes that have an impact on a window, that way - it was 4 revisions instead of 30

Pages: [1] 2