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.


Topics - Daniel Schreiber Mendes

Pages: [1]
1
Graphics / How to create a VertexArray with a repeated texture
« on: December 13, 2019, 11:16:12 pm »
Hey,
how is the sf::Texture::m_isRepeated feature actually implemented? I looked at the source code but I don't know openGl yet and don't understand if the SFML library or openGl is doing this. Since I am using only vertexArrays for drawing and wanted to still use this feature without having to use a sf::Sprite or a sf::Drawable. I know how I would implement this feature with a vertexArray but I am wondering if there is any performance impact in case this is normally done by openGl.

Best regards,

Daniel Schreiber Mendes

2
Hey, why does this give me the following error?
sf::Texture t;
sf::Texture t2;
   
t.create(300, 300);
t2.create(100, 100);
   
t.update(t2);
 
error: no matching function for call to ‘sf::Texture::update(sf::Texture&)
     t.update(t2);
 
When this function definitely exists?
void sf::Texture::update(const Texture &texture)       
 

3
Hey my friends I have a really big spritesheet and wanted to ask about the performance difference between loading a lot of textures from parts of it and loading the full texture one time and setting the IntRect when giving it to a sprite. 
Like this pseudocode:
    loadFromFile(spritesheetPath, IntRect(184, 108, 13, 16));
   
    loadFromFile(spritesheetPath, IntRect(168, 108, 14, 18));
   
    loadFromFile(spritesheetPath, IntRect(634, 24, 122, 25));
   // and so on
 
vs.
    loadFromFile(spritesheet);
    sprite1.setTexture(spritesheet, IntRect(184, 108, 13, 16))
    sprite2.setTexture(spritesheet, IntRect(168, 108, 14, 18))
    sprite3.setTexture(spritesheet, IntRect(634, 24, 122, 25))
    // and so on
 
The second method would be very inconvenient because of the way my Resource Manager is structured but I don't want do loose too much performance when loading lots of textures.

Thanks for your Answers :)

Daniel

4
Window / Resolution Bug after creating window with valid mode
« on: October 14, 2019, 06:53:57 pm »
Hey,
 when I create a window with
sf::VideoMode::getFullscreenModes()[0]
 
everything is fine. But when I choose another index than 0, the following happens:
My screen turns black for a second and on the upper left corner the console is displayed for a fraction of a second. After that the window works fine with the wanted resolution. After I close the window though my whole desktop is getting displayed in the resolution that I've chosen for my window. I can reverse this by running the program again with the first fullscreen mode or by restarting.  The index is valid; there are about 44 valid fullscreen modes available.
What am I doing wrong?

The program is running on a quite old hp with Ubuntu 18.04 installed.

Thanks for all answers! :)

Daniel

5
Graphics / sf::Text is slightly off
« on: September 01, 2019, 10:20:48 pm »
Hello,
I just have a sf::Text named content and want to set its position but it seems to be off about 7 Pixels vertically all the time. What am I doing wrong?
content.setPosition(0, 0);
 
std::cout << content.getPosition().x << ", " << content.getPosition().y << std::endl;
 
gives me (0, 0); thats what it should be.
But it looks like this (ignore the label ):

I am not changing its position in any way despite the first line. So where does the offset come from?
Thanks for any help!

6
General / Should I use Vector2f or short int in terms of performance?
« on: July 29, 2019, 05:12:53 pm »
Hello guys, I was wondering whether I should use Vector2f or short int as member variable types. Short int makes it easier to understand the use of the variable, but then I have to convert them all the time when I call functions of the SFML library. Vector2f seems to be a pretty big type which I think can lead to a worse performance than short int but I don't have to convert them.  In terms of performance, which one should I use?

Pages: [1]