Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Some help with RenderTexture  (Read 1414 times)

0 Members and 1 Guest are viewing this topic.

Kalantir

  • Newbie
  • *
  • Posts: 7
    • View Profile
Some help with RenderTexture
« on: March 04, 2014, 02:29:07 am »
Hi. I am trying to write an application that will make a collage out of images and save the collage to a file. I am having a couple problems and I was hoping you could help me.

1. When I call collage.getTexture().copyToImage().saveToFile("wallpaper.png"); it flips the image so that it is upside down. So far the only solution I can find is to flip all the images and adjust the coordinates of all the sprites I add to RenderTexture collage
EDIT: I have solved this problem. I found a related post that said I needed to call display() and that worked.

2. I cannot seem to load wallpapers above 2048x2048. I understand from reading the documentation that this limit is determined by my video card (in this case, integrated graphics). However, I formerly used a Windows application called ThetaWall on this same computer that was able to handle wallpapers of any size (it could handle all of my wallpapers, anyways). Is there some way to do this with the cpu instead and bypass this image size limit? If not, is there some other library you know of that will make this easier for me?
« Last Edit: March 04, 2014, 02:47:40 am by Kalantir »

zsbzsb

  • Hero Member
  • *****
  • Posts: 1409
  • Active Maintainer of CSFML/SFML.NET
    • View Profile
    • My little corner...
    • Email
Re: Some help with RenderTexture
« Reply #1 on: March 04, 2014, 02:44:34 am »
SFML really isn't designed for image manipulation, you should probably look for a library that is specifically designed for that. But to the point...

1. Read the documentation, you must call RenderTexture.display() just as if you were drawing on a window.

2. Your graphics card has a hardware limit on the maximum texture size that can be loaded, however it is possible to bypass this limit by first loading the image into the system memory and then splitting the texture up as you load it on the graphics card. Thor includes a couple classes to do this automatically for you.
Motion / MotionNET - Complete video / audio playback for SFML / SFML.NET

NetEXT - An SFML.NET Extension Library based on Thor

Kalantir

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: Some help with RenderTexture
« Reply #2 on: March 04, 2014, 05:46:23 pm »
So there is no way to do this without using the graphics card at all? I'm not worried about it being slow or resource intensive. I've looked into other libraries such as imagemagick but their documentation hasn't led me to believe it has the features I need to do this.

zsbzsb

  • Hero Member
  • *****
  • Posts: 1409
  • Active Maintainer of CSFML/SFML.NET
    • View Profile
    • My little corner...
    • Email
Re: Some help with RenderTexture
« Reply #3 on: March 04, 2014, 05:57:12 pm »
SFML only supports drawing using OpenGL, and OpenGL using the graphics card. The only thing SFML supports for modifying pixels on the CPU/System RAM side is the sf::Image class. And that only works with individual pixels.

On second thought, you could probably utilize Thor's BigSprite and BigTexture classes with your own BigRenderTexture class to do drawing on the graphics card, then copy that big rendertexture back to the RAM in sections and stitch it back together on the CPU.
« Last Edit: March 04, 2014, 06:10:24 pm by zsbzsb »
Motion / MotionNET - Complete video / audio playback for SFML / SFML.NET

NetEXT - An SFML.NET Extension Library based on Thor

Kalantir

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: Some help with RenderTexture
« Reply #4 on: March 04, 2014, 06:17:57 pm »
Thank you for the fast responses. I think I may have figured out a way to do this with ImageMagick. If that doesn't work out I'll try Thor next. The main reason I'm saving Thor as a last resort is because I don't want to have to distribute extra libraries with my application and Thor is not generally found in the official software repositories of most (if any) Linux distributions (if it were, all I'd have to do would be to name it as a dependency and then the package manager would download it automatically for the end user)

 

anything