SFML community forums
Help => Graphics => Topic started by: vidjogamer on March 31, 2011, 08:58:08 am
-
Is there a limit on the size of a RenderImage?
Also, is this even stable in SFML 2 because im getting lots of strange behavior.
-
Is there a limit on the size of a RenderImage?
Yes, the same limit as sf::Image.
Also, is this even stable in SFML 2 because im getting lots of strange behavior.
There are indeed some bugs, but I'm working on it so wait a few days and it should be better.
However you can explain your problem, to make sure you didn't do anything wrong.
-
Yes, the same limit as sf::Image.
Out of curiosity, what would that be?
There are indeed some bugs, but I'm working on it so wait a few days and it should be better.
However you can explain your problem, to make sure you didn't do anything wrong.
I am doing everything in the documentation.
initialization:
renderImage.Create(1024,1024);
renderImage.SetSmooth(true);
render loop:
renderWindow->SetView(*scene->view);
renderWindow->Clear(sf::Color(25,122,200,255));
scene->renderImage->Clear(sf::Color(255,5,92,255));
//i do this for each tile
scene->renderImage.Draw(*tileSprite);
scene->renderImage.Display();
Sprite sprite;
sprite.SetImage(scene->renderImage->GetImage());
renderWindow->Draw(sprite);
renderWindow->Display();
What I get is a render image of the correct size in the correct position but only drawing a few of the tiles (the upper left quarter or so) when the exact same code on just the renderWindow draws all of the tileSprites.
-
Out of curiosity, what would that be?
http://www.sfml-dev.org/documentation/2.0/classsf_1_1Image.htm#acb15b7adf8aa6f2155e6f5ce3c11baf5
What I get is a render image of the correct size in the correct position but only drawing a few of the tiles (the upper left quarter or so) when the exact same code on just the renderWindow draws all of the tileSprites.
That's weird. What's your OS and graphics card? Are you able to produce this bug with a complete and minimal code (ie. outside your project)?
-
Yes, the same limit as sf::Image.
Out of curiosity, what would that be?
sf::Image::GetMaximumSize()
-
OS : WinXP
Graphics Card : Mobile Intel(R) 965 Express Chipset Family
Ill get back to with a minimal code project.[/code]
-
Intel chipsets can give very weird behavior. They freaked out Ruby while I was writing the bindings. Literally, the garbage collector tried to access memory Intel's drivers had deallocated or something, hard to know what it really was but it was terrifying to watch.
Also the ATI bug was also present on Intel cards. So this could be related to it just being an Intel card.
-
What is the ATI bug?
-
This does it as well. I see the blue background of the renderImage across the entire window but the images stop drawing approximately 600/700 pixels in?
int main(int argc, char *argv)
{
if (!sf::RenderImage::IsAvailable())
return -1;
sf::RenderWindow window(sf::VideoMode::GetDesktopMode(), "SFML window");
sf::RenderImage renderImage;
if (!renderImage.Create(2048, 2048))
return -1;
Image image;
image.LoadFromFile("image.png");
Sprite tileSprite(image);
while (window.IsOpened())
{
renderImage.Clear(sf::Color::Blue);
for(int x = 0; x<50; x++)
{
for(int y = 0; y<50; y++)
{
tileSprite.SetPosition(x*image.GetWidth(),y*image.GetHeight());
renderImage.Draw(tileSprite); // sprite is a sf::Sprite
}
}
renderImage.Display();
window.Clear();
sf::Sprite sprite(renderImage.GetImage());
window.Draw(sprite);
window.Display();
}
return 0;
}
-
What is the ATI bug?
Freeze at startup or crash at exit. So it has nothing to do with your problem. And it was fixed a few weeks ago anyway.
Your code looks good, so I think we should get back to this problem after I'm done changing the implentation.
-
I don't know if it's related but under xp I'have seen some strange bug with using vector2f or rect, if I set position of something or use contains whith a rect or vector creating with another vector, the result is a rect/vector with value that not those I have passed, if i create Rect/Vector with using member of vector/rect instead of passing it to function, it works.
For exemple :
sprite.SetPosition( object.GetPosition() );// Work on ubuntu but don't on xp.
sprite.SetPosition( object.GetPosition().x,object.GetPosition().y);// Work both ubuntu/xp;
Maybe there is a bug under xp with Vector.
If you check the size of renderImage after create, it give you the good size?
-
Maybe there is a bug under xp with Vector.
Honestly, this is unlikely to be true. The code is straight-forward maths and has nothing which is OS-specific.
I suspect there is something wrong on your side. I'd like to see a minimal and complete example that reproduces this kind of bug (open a new thread if you provide one).