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

Pages: [1]
1
Graphics / Re: GLSL Texture mapping problems
« on: August 07, 2013, 08:30:02 am »
For me it is going pretty nice with shaders until now.
Did you use these functions (I assume you are using OpenGL):

sf::Shader shader;
...

// bind the shader
sf::Shader::bind(&shader);

// draw your OpenGL entity here...

// bind no shader
sf::Shader::bind(NULL);


2
Graphics / Re: Slow rendering?
« on: August 07, 2013, 05:28:53 am »
Thanks Laurent for the fast response. Good point, but since I can increase the FPS when decreasing the number of calls to the drawing function, I think that is not the case right? In other words, Am I correct to assume that if vsync was already activated by the card, I would never get more than 60 FPS?

I did some tests and the answer to my question is: no. It is not a slow rendering problem.
Just my notebook is limited to 112 FPS with 2 drawings (60 FPS when I increase the scale). If I scale the size of the window to be rendered, it decreases the FPS. I do not remember the OpenGL pipeline, but would not culling help somewhat in this rasterization process by eliminating the out of the screen object?
Is there something in the shader that can be done to help in this respect?

3
Graphics / Slow rendering?
« on: August 05, 2013, 05:55:53 pm »
Hi!

My objective is to have many (5 or so) textures plotted on the same place which have a dynamic (software set) alpha.
So here is a small test I did.
I am drawing a texture two times on the screen and I am getting 60FPS only (both have the alpha set entirely to 1, a better example would be one with alphas summing 1). From my experience this seems very slow.
My machine is running linux and SFML 2.0. I can add more details about it upon request.

My question is: Don't you think it is slow? Do you think multi-texturing with GLSL would be a faster solution?
Threads? This is another question I have (because it made my simple code unstable), but I think it would be better to post on the System tab. If anyone want to take a look at my code with threads it is posted here:
http://en.sfml-dev.org/forums/index.php?topic=12521.0

4
System / Re: Threads not working with simple window
« on: August 05, 2013, 05:49:53 pm »
Ah, I forgot to say (though if you read the code you will find the tests commented out),  using std::threads does not change the behavior.

5
System / Threads not working with simple window
« on: August 05, 2013, 05:47:29 pm »
Hi,

Going directly to the point, I wanted to try a rendering thread to decrease my the FPS count.
It ended up giving me strange results and unstable behavior. Sometimes I get:
XIO:  fatal IO error 11 (Resource temporarily unavailable) on X server ":0"
      after 104 requests (104 known processed) with 0 events remaining.

Sometimes, it almost work but I cannot change the window. If I do, I can not get back again.

By the error you should already know I am running Linux. I am using the 2.0 SFML version from the Gentoo ebuild.

My makefile is:
         g++ -o o main.cpp  -lsfml-graphics -lsfml-window -lsfml-system -std=c++0x -pthread
 

Below is my simple code:

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

#include<iostream>
#include <thread>

using namespace std;

#define DIR_MEDIA_TEXTURES "media/textures/"

sf::Sprite sprite;

//return if the number of frames should be reset
bool frameTiming(float number_of_frames, float accum_elapsed_seconds)
{
        if(accum_elapsed_seconds > 5.0)
        {
                cout << "FPS: " << number_of_frames/accum_elapsed_seconds << endl;
                return true;
        }
        return false;
}


void renderingThread(sf::Window* window)
{

        // activate the window's context
        window->setActive(true);

        sf::RenderWindow* render_window= (sf::RenderWindow*) window;

        // the rendering loop
        while (window->isOpen())
        {
                // draw...
                render_window->clear();
                //window.draw(shape);
                render_window->draw(sprite);
                //render_window->draw(sprite);

                // end the current frame -- this is a rendering function (it requires the context to be active)
                window->display();
        }
}

int main()
{
        sf::RenderWindow window(sf::VideoMode(1024, 800), "Triturus Project", sf::Style::Default);
        //sf::RenderWindow window(sf::VideoMode::getDesktopMode(), "Triturus Project", sf::Style::Fullscreen);
        window.setVerticalSyncEnabled(true);

        sf::CircleShape shape(100.f);
        shape.setFillColor(sf::Color::Green);
        sf::Texture texture;
        if (!texture.loadFromFile(DIR_MEDIA_TEXTURES"grass94.tga"))
        //if (!texture.loadFromFile("test.png"))
        //if (!texture.loadFromFile(DIR_MEDIA_TEXTURES"plant142.tga"))
        //if (!texture.loadFromFile(DIR_MEDIA_TEXTURES"stone240.tga"))
        {
                    // error...
                    cout << "Error: Failed loading texture" << endl;
        }

        texture.setRepeated(true);
        //texture.setSmooth(true);


        sprite.setTexture(texture);
        sprite.setScale(1,1);
        sf::IntRect rect(0,0,1000,1000);
        sprite.setTextureRect(rect);
        // deactivate its OpenGL context
        window.setActive(false);

        // launch the rendering thread
        sf::Thread thread(&renderingThread, &window);
        //std::thread render_thread( renderingThread, &window);
        //render_thread.join();
        thread.launch();



        sf::Clock clock;
        sf::Time accum_time;
        float number_of_frames;

        while (window.isOpen())
        {
                //------------- Event Handling -------------
                sf::Event event;
                while (window.pollEvent(event))
                {
                        if (event.type == sf::Event::Closed)
                                window.close();
                }


                //------------- Time -------------

                //get the time elapsed
                sf::Time elapsed = clock.restart();
                //updateGame(elapsed);
                //cout << elapsed.asSeconds() << endl;

                //frame counter
                accum_time+= elapsed;
                number_of_frames++;
                bool reset_frame_counter= frameTiming(number_of_frames, accum_time.asSeconds());
                if(reset_frame_counter==true)
                {
                        number_of_frames=0.0f;
                        accum_time= sf::seconds(0.0f);
                }

        }

        return 0;
}
 

6
Graphics / Re: GLSL Texture mapping problems
« on: August 05, 2013, 04:41:14 pm »
I understand you solved the problem.
But do you mean that you did not use the SFML framework for it?
In other words, you did not use the shader.loadFromMemory?

I only have experience with compiling in usual OpenGL. Still, I am interested in using GLSL with SFML and that is why I am asking.

Pages: [1]