SFML community forums

Help => Graphics => Topic started by: Fire on April 03, 2013, 10:08:29 am

Title: Problem with RenderTexture
Post by: Fire on April 03, 2013, 10:08:29 am
Hello,

Not sure if I'm using RenderTexture incorrectly, but whenever the object goes out of scope I get an error:

Windows has triggered a breakpoint in SfmlTest.exe.
This may be due to a corruption of the heap, which indicates a bug in SfmlTest.exe or any of the DLLs it has loaded.
This may also be due to the user pressing F12 while SfmlTest.exe has focus.
The output window may have more diagnostic information.


sf::RenderWindow Window(sf::VideoMode(500,500, 32), "SfmlTest",sf::Style::Default);

{
        sf::RenderTexture texture;
        if (!texture.create(500, 500))
                return -1;
} //Error here. If I use a RenderTexture in a function I get the same problem
 

Do I somehow need to dispose RenderTexture before?

I'm using Sfml 2.0 RC, the debug dll's and the Debug configuration in VS2010
Title: Re: Problem with RenderTexture
Post by: Laurent on April 03, 2013, 10:27:29 am
This is most likely an environment/configuration issue. This code should not crash. But you seem to do everything right, so... I don't know, sorry :-\
Title: Re: Problem with RenderTexture
Post by: Fire on April 03, 2013, 10:47:42 am
Hmm, alright

Do you have an idea what I could try? I've tried to use the release libraries and release configuration but I get the same error.
If I run the program from the explorer rather than VS, it just crashes...

Oh also, RenderTexture itself works fine, just not when it goes out of scope :(
Title: Re: Problem with RenderTexture
Post by: Laurent on April 03, 2013, 10:56:47 am
You can try to recompile SFML. You can also try with static libraries.
Title: Re: Problem with RenderTexture
Post by: Fire on April 03, 2013, 11:28:49 am
I've just tried static libraries, but no success unfortunately :(
Recompiling SFML sounds like a complicated task to me :/ I might try that a bit later

Does nobody else experience this issue?
Title: Re: Problem with RenderTexture
Post by: Laurent on April 03, 2013, 11:38:27 am
Quote
Recompiling SFML sounds like a complicated task to me
It's not, if you follow the tutorial step by step.
Title: Re: Problem with RenderTexture
Post by: Fire on April 03, 2013, 12:26:15 pm
Recompiled it with dynamic debug dll's.
Same error :/
Title: Re: Problem with RenderTexture
Post by: Laurent on April 03, 2013, 12:50:36 pm
Can you launch the debugger to get more relevant information about the crash?
Title: Re: Problem with RenderTexture
Post by: Fire on April 03, 2013, 01:13:42 pm
I can start the debugger, but can't see the source. (Sorry, not too familiar with C++ programming)

However, I noticed that I don't get an error if I remove the line where the RenderWindow is created!
Does that mean something? (Of course that is not a useful workaround ;))
Title: Re: Problem with RenderTexture
Post by: Nexus on April 03, 2013, 01:17:04 pm
Can you describe stepwise and exactly what you did, from downloading SFML until executing the final project?

"Exactly" means, specify every build option you chose, every library you linked, etc. Be as verbose as possible. And make sure the informations are correct (i.e. don't say "I linked sfml-system" if you in fact linked "sfml-system-d.lib").
Title: Re: Problem with RenderTexture
Post by: Fire on April 03, 2013, 02:14:00 pm
Okay sure.

- installed VS2010 ultimate (not recently, it has been on my laptop for a while)
- downloaded SFML 2.0 RC (http://www.sfml-dev.org/download/2.0-rc/SFML-2.0-rc-windows-32-vc2010.zip)
- created a new C++ Project (Win32, Console, Empty Project)
- add new C++ File (main.cpp)
- Project Properties: C/C++ -> General -> Additional Include Directories: C:\SFML-2.0-rc\include
- Project Properties: Linker -> General -> Additional Library Directories: C:\SFML-2.0-rc\lib
- Project Properties: Linker -> Input -> Additional Dependencies:
sfml-graphics-d.lib
sfml-window-d.lib
sfml-system-d.lib
- main.cpp:
#include "SFML/Window.hpp"
#include "SFML/Graphics.hpp"
#include <iostream>

int main(){

        sf::RenderWindow Window(sf::VideoMode(800,600, 32), "SfmlTest",sf::Style::Default);

        {
                sf::RenderTexture texture;
                if (!texture.create(500, 500))
                        return -1;
        }

        std::cin.get();

        return 0;
}
- Copy sfml-system-d-2.dll, sfml-window-d-2.dll and sfml-graphics-d-2.dll from C:\SFML-2.0-rc\bin to my programs debug folder
- Press Debug

VoilĂ 

Windows has triggered a breakpoint in SfmlTest.exe.
This may be due to a corruption of the heap, which indicates a bug in SfmlTest.exe or any of the DLLs it has loaded.
This may also be due to the user pressing F12 while SfmlTest.exe has focus.
The output window may have more diagnostic information.


Title: Re: Problem with RenderTexture
Post by: eXpl0it3r on April 03, 2013, 02:42:26 pm
Works fine here with VS 2012 Ultimate and the RC...
Is your graphics card driver uptodate?
What OS specs?
Title: Re: Problem with RenderTexture
Post by: Fire on April 03, 2013, 02:59:04 pm
That's weird.

Anyways, I assumed there was no update because Windows Update didn't list it, but it turned out I could get the newest driver from the intel website.
But that wasn't the issue, the problem persists.

OS:
Windows 7 Professional 32 Bit SP1

Graphics:
Mobile Intel(R) 4 Series Express Chipset Family 8.15.10.2869
(rubbish :) )

OpenGL:
2.1.0 - Build 8.15.10.2869
Title: Re: Problem with RenderTexture
Post by: eXpl0it3r on April 03, 2013, 03:04:59 pm
So it might be, yet another Intel graphics card issue... :-\
This would need some deeper debugging, to figure out the cause.
Title: Re: Problem with RenderTexture
Post by: Fire on April 03, 2013, 03:11:29 pm
Can Laurent do something about that? Or is it something that I just have to accept? :-\
Title: Re: Problem with RenderTexture
Post by: Laurent on April 03, 2013, 03:15:36 pm
As far as I remember, all Intel issues are fixed now. But I'm not 100% sure. You should search on this forum for similar issues with RenderTexture and Intel drivers (but be careful: most of them are on Linux), and see if some are still unresolved.

Is this happening only with sf::RenderTexture? Have you tried the same kind of code with all other graphics classes?
Title: Re: Problem with RenderTexture
Post by: Fire on April 03, 2013, 03:23:07 pm
Haven't noticed any other problem like this.
I've tried Image, Texture and of course the RenderWindow.

What puzzles me is why it works as long as there is no open RenderWindow...
this code works too:
{
        sf::RenderWindow Window(sf::VideoMode(800,600, 32), "SfmlTest",sf::Style::Default);
}

{
        sf::RenderTexture texture;
        if (!texture.create(500, 500))
                return -1;
}
Title: Re: Problem with RenderTexture
Post by: Acrobat on April 04, 2013, 05:31:24 pm
I have a test computer with the same video card, windows 8, no issues.
Title: Re: Problem with RenderTexture
Post by: Fire on April 04, 2013, 07:07:42 pm
Uhh alright.
Maybe I should try to do a fresh windows 7 installation on another partition and see if it works there.

Title: Re: Problem with RenderTexture
Post by: Fire on June 21, 2013, 10:18:50 am
So recently I tried it again with a fresh Windows 7 installation. (same laptop)
It still doesn't work :/
Does anybody have an idea what I can do about it?
Title: Re: Problem with RenderTexture
Post by: The Hatchet on June 21, 2013, 09:06:39 pm
I also compiled and ran your code just fine.  Code::blocks 12.11, Intel Q965 graphics chipset.  it's gotta be something wonky with your system I'm thinking
Title: Re: Problem with RenderTexture
Post by: Fire on October 15, 2013, 03:31:31 pm
Alright, new laptop (windows 8, vs2012)
two graphics cards: Intel HD Graphics 4600 and NVIDIA GeForce GT 750M
same error for intel graphics card, but no error with geforce!!!

What exactly is causing this?
If I was gonna write a game with SFML, I don't want to restrict the game to more powerful (or whatever the reason is) graphics cards just because of this bug :/



Title: Re: Problem with RenderTexture
Post by: BaneTrapper on October 15, 2013, 11:06:01 pm
There are few things i can think off:
1: Check if the GPU memory capacity is enough to store 500x500.
2: In bios i think there will surely be somehere a checkBox of some sort to allow errors to pop up(to display) when they happen (on my system when one of my components reported error i got showed onto a blue screen with error, don't confuse it with BSOD)
That way i figured out my motherboard has front panel audio error but i don't remember how i exactly did it.
Little messing around bios needed, but if you can program it should be in line of work.
Title: Re: Problem with RenderTexture
Post by: Ixrec on October 15, 2013, 11:18:10 pm
@Fire: Before you ask, use sf::Texture::getMaximumSize() to do #1.
Title: Re: Problem with RenderTexture
Post by: Fire on October 17, 2013, 03:56:02 pm
@Fire: Before you ask, use sf::Texture::getMaximumSize() to do #1.
thanks ;)

There are few things i can think off:
1: Check if the GPU memory capacity is enough to store 500x500.
2: In bios i think there will surely be somehere a checkBox of some sort to allow errors to pop up(to display) when they happen (on my system when one of my components reported error i got showed onto a blue screen with error, don't confuse it with BSOD)
That way i figured out my motherboard has front panel audio error but i don't remember how i exactly did it.
Little messing around bios needed, but if you can program it should be in line of work.
intel returns 8192 and nvidia 16384.
I guess that's not the problem

I'll have a look what I can find in my bios
EDIT: I can't find any checkbox like that :/
Title: Re: Problem with RenderTexture
Post by: BaneTrapper on October 17, 2013, 09:32:33 pm
Quote
intel returns 8192 and nvidia 16384.
I guess that's not the problem

I'll have a look what I can find in my bios
EDIT: I can't find any checkbox like that :/
Yea its 8192x8192 and other one 16384x16384, that is not the problem.

For the bios, its usually the complicated thing... google it is the best way you can find out.
I cant remember how its called, but i know how to do it on my pc, cant help you out sorry.
Title: Re: Problem with RenderTexture
Post by: Ixrec on October 17, 2013, 10:40:40 pm
Since the only idea left is trying to get some error output from a lower level of the system, you might also try redirecting SFML's internal error stream to somewhere you can see it.

It's easier than it sounds. Details here: http://www.sfml-dev.org/documentation/2.1/group__system.php#ga7fe7f475639e26334606b5142c29551f
Title: Re: Problem with RenderTexture
Post by: Fire on October 20, 2013, 02:33:19 pm
Quote
intel returns 8192 and nvidia 16384.
I guess that's not the problem

I'll have a look what I can find in my bios
EDIT: I can't find any checkbox like that :/
Yea its 8192x8192 and other one 16384x16384, that is not the problem.

For the bios, its usually the complicated thing... google it is the best way you can find out.
I cant remember how its called, but i know how to do it on my pc, cant help you out sorry.
I did google quite a bit, and my bios seems to hide some menus, but if there is a checkbox, like the one you are describing, I don't know

Since the only idea left is trying to get some error output from a lower level of the system, you might also try redirecting SFML's internal error stream to somewhere you can see it.

It's easier than it sounds. Details here: http://www.sfml-dev.org/documentation/2.1/group__system.php#ga7fe7f475639e26334606b5142c29551f
thanks for the suggestion. However, the file is created but empty. I didn't see anything in the console before either though.

Also, I'm wondering why it hits me twice independently :P Is really nobody else having this issue with integrated graphics cards?
Title: Re: Problem with RenderTexture
Post by: Ixrec on October 20, 2013, 11:47:54 pm
Quote
Is really nobody else having this issue with integrated graphics cards?
Mine's integrated and I certainly don't have it.  My memory isn't that great, but the only other RenderTexture bugs I can think of were all caused by people declaring RenderTextures in global scope (ditto for RenderWindow).