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.


Messages - -Nautilus-

Pages: [1]
1
Graphics / Re: Faster drawing for multiple shapes
« on: August 25, 2016, 02:50:19 am »
Ok thanks.
Still 1 question: imagine i have to draw the same shape/whatever alot (rly alot) of times.
what option would be faster: Shape or VertexArray?

2
Graphics / Faster drawing for multiple shapes
« on: August 23, 2016, 03:17:04 am »
I have to draw alot of times the same set of shapes, and i would like to know if there is a way to group those together so that i would only need to perform grouping once and that i could draw that on a RenderWindow faster.

3
General / Re: Problem with running a big-array-of-pixels app
« on: July 22, 2016, 11:22:13 pm »
ok now i get it, i was just ignoring the fact texture and sprite would take space in the stack, im really sorry...
i know this question has nothing to do with sfml, but you said i could store the array in the heap, but i should better use vector cause its safe.

what do u mean by 'safe'? i guess you mean std::vector is still stored in the stack, and it is still safer than an array stored in the heap.

1 more question: most of the time, a function that takes an array or an array pointer can also take a vector or a vector pointer?

4
General / Re: Problem with running a big-array-of-pixels app
« on: July 21, 2016, 01:18:10 am »
Thanks alot, the pointer worked.
I'll try to see those compiler stuff, but I was trying not to go really deep into that.

So, basically, it is always best to use a std::vector instead of array, right?
I guess that could be translated to reality as "No-one uses arrays of pixels, just vectors". it is very important to know what are the current standard ways to do stuff. For instance, i first met arrays and then vectors, but as soon as i met vectors i abandoned arrays, as vectors would do the same as arrays and they are more dynamic. so now even for fixed arrays, i replace arrays for vectors.

Another question... As some funny pic states, programmers say "It doesnt work. Why? / It works. Why?"
So why doesnt an array of pixels work?

5
General / Re: Problem with running a big-array-of-pixels app
« on: July 20, 2016, 07:37:08 pm »
I have replaced that statement by std::vector<sf::Uint8> pixels(W*H*4);, but it says:
"error: no matching function for call to 'sf::Texture::update(std::vector<unsigned char>&)".

(actually, sf::Texture::update has no overload for std::vector<>, but only for sf::Uint8, Image and Window)

Also, I've experimented an isolated sf::Uint8 array, and memory is not the problem, since I've tested declarating such an array with 2000*2000*4 elements, and it works fine.

Also, i've tracked the problem to the statement texture.update(pixels);. Still dont understand why.

btw, that statement is not illegal since i've used it in the app i'm developing and it worked fine up to 716*716*4.

6
General / Problem with running a big-array-of-pixels app
« on: July 20, 2016, 06:34:38 pm »
So, this is obviously not my real app, but i managed to isolate it to this piece of code.

#include <SFML/Graphics.hpp>
#include <SFML/Window.hpp>
#include <SFML/System.hpp>
#include <cstdio>

int main()
{
    long int W;
    scanf("%d", &W);
    const long int H = W;

    sf::Texture texture;
    sf::Sprite sprite;

    if(!texture.create(W, H)) throw "ERR";

    sf::Uint8 pixels[W*H*4];
    texture.update(pixels);
    sprite.setTexture(texture);

    return 0;
}


In the actual program, I'm manipulating an array of pixels pixel-by-pixel.
I've tested for W=716 and lower values, and it presented the standard "Status 0" stuff at the end.
But for W=717 and larger values, a box pops up, where you can read:

"ProblemProject.exe stopped working
Windows is searching for a solution to the problem..."

and then another one saying:

"ProblemProject.exe stopped working
Windows is collecting information about the problem. This process might take several minutes..."

and finally one saying:

"ProblemProject.exe stopped working
A problem led to the program to stop working correctly. Windows will close the program and warn you if there is a possible solution."

I click a "Close program" button, and the Console presents the message:

"Process returned 255 (0xFF)   execution time : 9.685 s
Press any key to continue."

I've tested the code for a full-window (red-coloured xd) rectangle shape and it worked fine for every value of W.

I'm using static (and static debug as well) versions of all the SFML 2.3.2 libraries (both with -s and -s-d i get the same thing), and using
CodeBlocks Release 13.12 rev 9501 (2013/12/25 19:25:45) gcc 4.7.1 Windows/unicode - 32 bit

I'm working on Windows10, and my GPU is NVIDIA GEFORCE GTX 950M.

Please help me, I'm almost certain it must be a begginer's issue, but I still couldn't find any related post.

Pages: [1]