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

Pages: [1]
1
Graphics / [solved] sf::Image::LoadFromFile get error text
« on: April 18, 2011, 09:37:43 pm »
Just a little modification for people that may look for an answer later : std::cerr was not the correct stream. Here is the code with the good one for SFML errors :
Code: [Select]

#include <SFML/System.hpp>
[...]
std::ostringstream output;
sf::Err().rdbuf(output.rdbuf());

    if (!image->LoadFromFile("..."))
    {
std::string error = output.str();
std::cout<< "erreur!"<<error <<std::endl;
    }


Thanks a lot for the help.

2
Graphics / [solved] sf::Image::LoadFromFile get error text
« on: April 18, 2011, 09:16:46 pm »
Ok thanks! It would indeed be really be useful to have something like sf::Image::GetError or something like that, but while I have something that works, i'm happy  :P thanks for the trick that's useful (and as far as i have seen, it seems to be handy in lots of other contexts)

3
Graphics / [solved] sf::Image::LoadFromFile get error text
« on: April 18, 2011, 08:50:07 pm »
Hello,
When loading some images, sometimes it could not work (wrong file format, image too big, or anything else...). When it doesn't work, is there a way to get the error as a string, in order to display it in a message box?

4
Graphics / RenderImage : unexpected segfault...
« on: April 08, 2011, 05:37:07 pm »
I'm using Make and gcc on an quite up to date Ubuntu Linux... It shouldn't be like that, that is definitly weird :/

I tried to make a minimal cmakelist.txt
Code: [Select]

set(CMAKE_BUILD_TYPE CMAKE_CXX_FLAGS_DEBUG)
project(Programme)

find_package(SFML REQUIRED COMPONENTS graphics)

add_executable(
Programme
main.cpp
)

target_link_libraries(Programme ${SFML_GRAPHICS_LIBRARY_DEBUG})

INSTALL_TARGETS( /bin Programme)

5
Graphics / RenderImage : unexpected segfault...
« on: April 08, 2011, 05:02:37 pm »
@Hiura : yeah it does the same segfault!

So, does anyone know what am i doing wrong? Or is it a sfml bug?

Laurent i haven't found the shader example your talking about --'

I've upgraded my sfml version yesterday or the day before. I can upgrade it again, if it is helpful.

I downloaded a snapshot with a folder inside called "LaurentGomila-SFML-cb1f938". I think it's the version number that you want.

6
Graphics / RenderImage : unexpected segfault...
« on: April 08, 2011, 02:11:10 pm »
it does exactly that
Code: [Select]

$ ./Programme
avant appel
debutFonction
finFonction
Segmentation fault


even with adding:
Code: [Select]
sf::Event Event;
while (App.GetEvent(Event))
{
// Process event
}


into the loop

7
Graphics / RenderImage : unexpected segfault...
« on: April 08, 2011, 02:01:32 pm »
hoping it is as minimal as expected! (at least it's complete I think ;) )

thank you very much for your help!

main.cpp
Code: [Select]

#include <SFML/Graphics.hpp>
#include <SFML/System.hpp>
#include <iostream>
sf::Image getFlatennedImage()
{
std::cout<< "debutFonction" <<std::endl;
sf::RenderImage RI;
RI.Create(800,600);
RI.SetActive();
    RI.Clear();
RI.Display();
std::cout<< "finFonction" <<std::endl;
return RI.GetImage();
}


int main()
{
    // Create the main window
    sf::Window App(sf::VideoMode(800, 600, 32), "SFML Window");

    // Start main loop
    bool Running = true;
    while (Running)
    {
std::cout<< "avant appel" <<std::endl;
        getFlatennedImage();
std::cout<< "apres appel" <<std::endl;
        App.Display();
    }

    return EXIT_SUCCESS;
}


cmakelists.txt (not really needed, but may be helpful)
Code: [Select]
# explications qt = http://www.marcossantamaria.com/tutorialdata.php?id=3
cmake_minimum_required(VERSION 2.8)
set(CMAKE_CXX_FLAGS "-Wall -W -ansi -pedantic -g")

set(CMAKE_BUILD_TYPE CMAKE_CXX_FLAGS_DEBUG)

#Déclaration du projet
project(Programme)


find_package(SFML REQUIRED COMPONENTS graphics window system)


#Déclaration de l'exécutable
add_executable(
Programme
main.cpp
)


target_link_libraries(Programme ${SFML_SYSTEM_LIBRARY_DEBUG} ${SFML_AUDIO_LIBRARY_DEBUG} ${SFML_GRAPHICS_LIBRARY_DEBUG} ${SFML_WINDOW_LIBRARY_DEBUG})

INSTALL_TARGETS( /bin Programme)

8
Graphics / RenderImage : unexpected segfault...
« on: April 08, 2011, 01:43:06 pm »
Actually, i succeed easily to use gdb... here is the backtrace, directly from the console :
Code: [Select]
(gdb) backtrace
#0  0x0166d675 in xcb_writev () from /usr/lib/libxcb.so.1
#1  0x01488dec in _XSend () from /usr/lib/libX11.so.6
#2  0x01488f90 in _XReply () from /usr/lib/libX11.so.6
#3  0x0147c867 in XSync () from /usr/lib/libX11.so.6
#4  0x013ac205 in ?? () from /usr/lib/fglrx/libGL.so.1
Backtrace stopped: previous frame inner to this frame (corrupt stack?)

What does mean the last line? Is it the source of the problem?

9
Graphics / RenderImage : unexpected segfault...
« on: April 08, 2011, 01:39:45 pm »
I will try, but it may take some time because i never did that and i have to learn how it works.
Is there a way to ensure that i am using the debug libraries?
I have compiled sfml in debug and changed my project's cmakelists.txt file to :

Code: [Select]
[...]
target_link_libraries(Programme ${SFML_SYSTEM_LIBRARY_DEBUG} ${SFML_AUDIO_LIBRARY_DEBUG} ${SFML_GRAPHICS_LIBRARY_DEBUG} ${SFML_WINDOW_LIBRARY_DEBUG} ${GTKMM_LIBRARIES})
[...]

10
Graphics / RenderImage : unexpected segfault...
« on: April 08, 2011, 01:25:38 pm »
ok, I did that, but it doesn't change anything... I still have this segfault. In my mind, it is at the destruction of the renderImage... Something in the destructor of renderImage that bugs, maybe because of my code. But I might be wrong

11
Graphics / RenderImage : unexpected segfault...
« on: April 08, 2011, 12:17:07 pm »
Sorry i'm such a newbie but i never did that kind of things! I'm using cmake. How could i change the libraries for the debug versions?

There are the concerned parts of my cmake file :

Code: [Select]

find_package(SFML REQUIRED COMPONENTS graphics window system)

target_link_libraries(Programme ${SFML_SYSTEM_LIBRARY} ${SFML_AUDIO_LIBRARY} ${SFML_GRAPHICS_LIBRARY} ${SFML_WINDOW_LIBRARY} ${GTKMM_LIBRARIES})


i tried
Code: [Select]
target_link_libraries(Programme ${SFML_SYSTEM_LIBRARY} ${SFML_AUDIO_LIBRARY} ${SFML_GRAPHICS_LIBRARY_DEBUG} ${SFML_WINDOW_LIBRARY} ${GTKMM_LIBRARIES})

but it doesn't works...

12
Graphics / RenderImage : unexpected segfault...
« on: April 08, 2011, 12:08:26 pm »
Gdb doesn't want to display the call stack ! I'm using the GDB geany plugin. It seems so strange to me to can't succeed to display a call stack in that case... :(

Indeed, it looks like it is during the destruction of the renderimage, because if I create it via a pointer (i don't know how this is really called), it works, but the renderimage is not destroyed!

Code: [Select]

sf::RenderImage* RI = new sf::RenderImage();

13
Graphics / RenderImage : unexpected segfault...
« on: April 08, 2011, 01:24:50 am »
Hello! I get an error while using sf::RenderImage. Here is my minimal code :
Code: [Select]
std::cout<< "debutExport" <<std::endl;
m_app->canvasWindow->canvas->getFlattenedImage();
std::cout<< "finExport" <<std::endl;

Code: [Select]
sf::Image CE_Group::getFlattenedImage()
{
std::cout<< "start" <<std::endl;
sf::RenderImage RI;
RI.Create(800,600);
    RI.Clear(sf::Color(200,200,200));
RI.Display();
    sf::Image img = RI.GetImage();
std::cout<< "end" <<std::endl;
    return img;
}


I really don't understand because this what the programs displays :
Code: [Select]
debut export. total of frames:1000
debutExport
start
end
Segmentation fault

Does anyone have an idea about what i did wrong? The point is that the error is at the end of the method... I really don't understand why it occurs after the "return"...
Thanks in advance.

14
General / sf::Image::SaveToFile() freezes my computer
« on: March 29, 2011, 07:29:19 pm »
Hello,
I'm having some trouble with one function is SFML. I'm developing one software since september, and i need to export an animation frame by frame. I have a loop, and in this loop i redraw an sfml window for displaying the frame, and i export it with the SaveToFile method, from sf::Image.

My code works perfectly, it makes the frame by frame animation and put it into one folder. But when i have to compute lots of frames, it simply freezes the computer completely! it does not seems to be because i uses all the available memory, because it is not laggy or nothing like that. For It works perfectly until the 29th frame, and at the 30th my computer is completely frozen. I can't do anything, even move the cursor.

I'm using Linux Ubuntu, and SFML 2.0, and it does seems to be normal...

Does anyone had that kind of trouble with SFML???

[EDIT] this is the code executed in each loop who seems to be problematic :
Code: [Select]

m_app->canvasWindow->canvas->setViewFromFrame(counter);
std::cout<<counter<<std::endl;
std::string numFrame;
std::stringstream numFrameSS;
numFrameSS << counter;
numFrame = numFrameSS.str();
m_app->canvasWindow->canvas->getFlattenedImage().SaveToFile("res/out/"+numFrame+".bmp");


It cames directly from my project, which is quite huge, so sorry if my code is not reader-friendly and messy...

Pages: [1]