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

Pages: [1]
1
Graphics / CPU/Pixel based "Post processing"
« on: February 21, 2016, 07:18:28 pm »
I wonder if there's a more performant way of doing this:
        //Draw everything
        renderTex.clear(sf::Color(200,200,200));
        renderTex.draw(shape);
        renderTex.display();
       
        //Do "Post-Processing"
        window.clear();
       
        sf::Image img = renderTex.getTexture().copyToImage();
       
        //Manipulate the pixels in any way, this is just an example
        for(unsigned int i=0; i < img.getSize().x; i+=8)
        {
            for(unsigned int j=0; j < img.getSize().y; j++)
            {
                img.setPixel(i,j,sf::Color::White);
            }
        }
       
        //Draw result
        postTexture.loadFromImage(img);
        sf::Sprite sprite(postTexture);
        window.draw(sprite);
        window.display();
 

Full code:
(click to show/hide)

I am drawing everything to a RenderTexture, then I retrieve a copy of the underlying texture as an Image.
Then I manipulate the image (e.g. do xBRZ scaling) and render the result to the screen.

Rendering resolution will be around 660x360px.

The pixel manipulation will be done using the Uint8 array, not with setPixel.

And yes, I am not able to create the GLSL shader to do the resizing ... lack of knowledge atm  ::)

2
General discussions / [Script] Auto-Update SFML windows batch script
« on: February 20, 2016, 11:45:28 pm »
Hi,

I just set up a batch script to check for SFML updates on git Master and to auto build all the libraries I maybe need (Debug/Release, both static and dynamic).
I thought this could maybe come in handy for anyone, so I share it.

The script builds the MinGW Makefiles. If you want other Makefiles, you have to exchange the specific lines.
Type
cmake --help
to see all the options and call the specific commands for your build environment.

Git, compiler and cmake should be in the PATH  of your OS to work out of the box.
Tested with Windows 10.

The batch script
(click to show/hide)

Usage:
- Open git bash
- Clone SFML via git:
git clone https://github.com/SFML/SFML.git
 

- This will create a new folder "SFML" with all the sources in the working directory.
- Copy this batch file in the working directory (same level as the SFML folder!!!)

Anytime you want to check for updates, run the script.
After pulling the latest version, the script will ask you, if you want to build all the libraries.
Type "y" or "n" to do it or not :)
If you are "up-to-date" you don't need to build the libs, unless you didn't already.

Hope it helps!

Regards,
AncientGrief

3
Graphics / [SOLVED] sf:Glsel::Vec2 won't compile
« on: February 20, 2016, 12:24:32 am »
Hi,

I am trying to learn GLSL with SFML, but this line won't compile:

shader.setUniform(sf::Glsl::Vec2(800.0f,600.0f));
 

What am I missing?!

This is the error I get form MinGW on Windows 10
Code: [Select]
main.cpp:22:52: error: no matching function for call to 'sf::Shader::setUniform(sf::Glsl::Vec2)'

Regards
AncientGrief

P.S. This is the tutorial I am going through:
http://gamedevelopment.tutsplus.com/tutorials/a-beginners-guide-to-coding-graphics-shaders--cms-23313

4
General / Which branch is the next major release?!
« on: January 14, 2016, 11:03:19 pm »
Atm I am using the master to get the latest SFML version. Is there another branch I am missing?! I read stuff about SFML 3.0?! Main got last updated a month ago, just wondering :)

5
Graphics / Maximum X coordinate. Size of float
« on: January 29, 2014, 07:53:15 pm »
Hi everyone,

I just wondered how far away from the origin I can draw a sprite. I guess the maximum is FLT_MAX (1E+37)?

//The maximum I can enter without getting warnings and display errors
float x = 99999999999999999999999999999999999999.f;
sprite.setPosition(x ,-25.f);
 

So on my computer, this should be the highest X-Coord possible I guess?! Or am I missing something (I sure am missing something! Sounds too enormous to me...I could let my character walk to the right for a long time without worrying about an overflow.)?

Thanks in advance  :)

Pages: [1]