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

Pages: [1]
1
Graphics / How does draw work?
« on: July 08, 2015, 05:55:06 pm »
I'm new to programming in general and so I don't really understand a lot of things but I've been working on a general star background generator and came up with a method that works nicely. The problem I have is that a lot of stars seems to slow it down greatly. A lot of stars being around 30,000 or more. Seeing as there are much more complex and numbered textures in video games I feel like this should be easy for a modern computer. I tried commenting out various parts of the code and narrowed it down specifically to the draw call. At first I thought maybe my stars vector was copying instead of passing by references, but I tried to change it specifically to references and got it working but that didn't make it any faster. I'm only using a small png with a few star shapes for a template and only load it once and just apply it to multiple sprites so I didn't think the resource itself should be slowing it down since it's just one reference used multiple times. Am I missing something important in how draw works? Thanks for any help, tips, etc!

The short: How does draw work and why is it slow when redrawing from a single resource reference of a small png? Is it just a limitation for the number of draws it can do efficiently or am I just probably doing something wrong?


void Stars::render(sf::RenderWindow *temp)
{
    for(size_t i=0;i<starsVec.size();i++)
    {
        temp->draw(starsVec);
    }
}

2
I'm using CodeBlock with Mingw on Window 8 with SFML 2.1 with nvidia graphics card. I wasn't sure if it was something to do with the graphics or the window module so I just put it in general. Hope that's ok!

The problem is that a 1 pixel wide outline shows up around my sprite the moment I do a sprite.rotate() or a view.zoom(). It doesn't happen if I turn off setSmooth on the texture. The outline appears to be magenta, which I mask out from the original bmp image. Doing a sprite.move() does not make the outline appear, however.

I searched and found similar topics of the exact problem but in them it indicated that it was fixed in SFML 2 so I was wondering if the problem somehow has returned or if I am missing something. The sprite looks like crap without setSmooth on so I'd like to be able to use it if possible!

Edit: I created a PNG with built in transparency and it still gets a pink outline when sprite.rotate or view.move is setSmooth is enabled for it!

Thanks!
Joe

Pages: [1]