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

Pages: [1] 2
1
General / Re: How to compile SFML in 64 bit with CMake
« on: July 10, 2013, 05:59:30 pm »
Ok. Basically that was easy I just had to update the external libraries' folder paths to the x64 ones in the properties of sfml-graphics.

2
General / [SOLVED] How to compile SFML in 64 bit with CMake
« on: July 10, 2013, 05:52:39 pm »
Hi,


I could not find a flag or a switch in CMake that would allow to compile the static libraries in 64 bit. I kind of did it manually within VS2010 but it fails when linked to another program, it can't find some symbols from glew mainly.


I could not find a tutorial about it. One guy said he had managed to do it but the URL he's giving seems to be kaput.

Is there a hidden flag somewhere in the CMake script to generate this?


Cheers

3
Indeed you're right I've reverted that again and it didn't do anything wrong.
I might have just hallucinated again and it was due to something else I hadn't noticed at that time I guess. Topic close.

4
Hi,


I was trying to use a RenderTexture as a drawing utility method and then binding the texture on a concurrent OpenGL context I'm getting from my application. It was working... until I got rid of a former RenderWindow attribute I was using previously in this class (but no longer using in the code itself).

To my surprise, all of a sudden the program stopped working and the texture was no longer rendered in my OpenGL context.
I've reverted and I've investigated on it.
It turns out that for some reasons there's a global initialization process which is called in sf::Window once and as long as this hasn't been triggered the rest won't just work.

So although I'm not using it I've got an object sf::RenderWindow in my class that ensures this global initialization is done once.

Am I right, and if yes is this intended?
Is there any workaround to work with RenderTexture objects in SFML without having to instantiate a sf::RenderWindow once at least?


Cheers all!

5
Ok that was pretty simple after all, cheers.

6
Hi,


I have a question regarding sharing lists (in our case just textures) with an external (not sfml) OpenGL context (rendered via a sf::RenderTexture):

Is there a proper way to share the lists with an external context?

Or do we have to get the buffer from the texture and upload it a texture of the external context and so on... But it could lead to performance issues so I'm trying to find out whether it's possible (perhaps we have to alter SFML's source code?)


Cheers!

7
Graphics / Re: Cannot bind a sf::Texture to a simple GL_QUADS
« on: June 27, 2013, 04:10:47 pm »
Hi,

Further to your advice I just added these lines before drawing the quads and it seems to be working now.

Thank you very much Laurent!

window.clear();
sf::Texture::bind (&renderText.getTexture ());
glMatrixMode (GL_PROJECTION);
glLoadIdentity ();
glOrtho (0, 1, 1, 0, -1, 1);
glBegin(GL_QUADS);
        glTexCoord2f(0.f, 1.f);
        glVertex2f(0.0f, 1.0f);
        glTexCoord2f(1.f, 1.f);
        glVertex2f(1.0f, 1.0f);
        glTexCoord2f(1.f, 0.f);
        glVertex2f(1.0f, 0.0f);
        glTexCoord2f(0.f, 0.f);
        glVertex2f(0.0f, 0.0f);
glEnd();

8
Graphics / Re: Cannot bind a sf::Texture to a simple GL_QUADS
« on: June 27, 2013, 01:33:32 pm »
Right, I thought this was enabled right away by default actually. My bad.
I put it right after the initializing the RenderWindow (previous post EDITED).... Close enough...
but there're still unexpected re-scaling and translation that occurs between (though different from the first result I had above).



Cheers!

9
Graphics / Re: Cannot bind a sf::Texture to a simple GL_QUADS
« on: June 27, 2013, 12:16:22 pm »
That's great. I'm still tinkering some stuffs here anyway.

I'm sure it can't be more than an stupid easy slip somewhere due to my lack of OpenGL concepts' understanding overall (I'm a DSP dood normally so I'm no more than a fresher still...).

At least what I've learnt so far is that OpenGL can turn out to be quite ticklish; that easy things can be insanely complicated to achieve albeit it usually makes tricky stuffs quite easier.

10
Graphics / Re: Cannot bind a sf::Texture to a simple GL_QUADS
« on: June 27, 2013, 11:50:22 am »
Hi Laurent!


It's the entire program. The rest's just the usual main bracketing stuff.

Quote
Why did you think it was necessary?

That link mainly but now I understand how much wrong I was. Hum, sorry about that.

In sf::Texture::bind it seems that the flag texture->m_pixelsFlipped is always set to true if it could be of any help.

11
Graphics / Re: Cannot bind a sf::Texture to a simple GL_QUADS
« on: June 27, 2013, 10:56:18 am »
Yes sorry those push and pop were ruins of a former version I had.

The expected result is correct, it's from the official tutorial and it's what I've got if I just do a regular window.draw() call.

Nevertheless I guess I got you wrong because now the result's just worse! :)
I've removed the push-pop block, added renderText.display() before the rendering loop, removed the glTexImage2D (although I'm not sure to understand why is it wrong? And since I've seen this call on many other examples).

But now here's what I've got:



        sf::RenderWindow window(sf::VideoMode (w, h), "SFML window");
        glEnable(GL_TEXTURE_2D);
        sf::RectangleShape rectangle;
        rectangle.setSize(sf::Vector2f(100, 50));
        rectangle.setOutlineColor(sf::Color::Red);
        rectangle.setOutlineThickness(5);
        rectangle.setPosition(10, 20);
        sf::RenderTexture renderText;
        renderText.create(w, h);
        renderText.draw(rectangle);
        renderText.display();

        // The main loop - ends as soon as the window is closed
        while (window.isOpen())
        {
                // Event processing
                sf::Event event;
                while (window.pollEvent(event))
                {
                        // Request for closing the window
                        if (event.type == sf::Event::Closed)
                                window.close();
                }
                window.clear();
                sf::Texture::bind (&renderText.getTexture ());
                glBegin(GL_QUADS);
                        glTexCoord2f(0.f, 1.f);
                        glVertex2f(0.0f, 1.0f);
                        glTexCoord2f(1.f, 1.f);
                        glVertex2f(1.0f, 1.0f);
                        glTexCoord2f(1.f, 0.f);
                        glVertex2f(1.0f, 0.0f);
                        glTexCoord2f(0.f, 0.f);
                        glVertex2f(0.0f, 0.0f);
                glEnd();
                // End the current frame and display its contents on screen
                window.display();
        }
 

12
Graphics / Re: Cannot bind a sf::Texture to a simple GL_QUADS
« on: June 26, 2013, 06:52:31 pm »
Ok I've updated my code I'm getting closer but there's a weird rescaling happening now.

13
Graphics / [SOLVED] Cannot bind a sf::Texture to a simple GL_QUADS
« on: June 26, 2013, 05:47:54 pm »
Hi everyone,

I'm trying to render shapes off-screen and then to bind the resulting texture to a simple OpenGL texture.

Unfortunately despite all my efforts (and the numerous snippets I've found on the internet) I just can't make it work properly. I assume it might be an easy slip I've made somewhere and perhaps an external look could help me to sort this out.

Expected result & Current result




        sf::RenderWindow window(sf::VideoMode (240, 240), "SFML window");

        sf::RectangleShape rectangle;
        rectangle.setSize(sf::Vector2f(100, 50));
        rectangle.setOutlineColor(sf::Color::Red);
        rectangle.setOutlineThickness(5);
        rectangle.setPosition(10, 20);
        sf::RenderTexture renderText;
        renderText.create(240, 240);
        renderText.draw(rectangle);

        // The main loop - ends as soon as the window is closed
        while (window.isOpen())
        {
                // Event processing
                sf::Event event;
                while (window.pollEvent(event))
                {
                        // Request for closing the window
                        if (event.type == sf::Event::Closed)
                                window.close();
                }
                window.clear();
                window.pushGLStates ();
                sf::Texture::bind (&renderText.getTexture ());
                glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, renderText.getTexture ().copyToImage ().getPixelsPtr ());
                glBegin(GL_QUADS);
                glTexCoord2f(0.f, 1.f);
                glVertex2f(0.0f, 1.0f);
                glTexCoord2f(1.f, 1.f);
                glVertex2f(1.0f, 1.0f);
                glTexCoord2f(1.f, 0.f);
                glVertex2f(1.0f, 0.0f);
                glTexCoord2f(0.f, 0.f);
                glVertex2f(0.0f, 0.0f);
                glEnd();

                window.popGLStates ();
                // End the current frame and display its contents on screen
                window.display();
        }
 

What am I doing wrong here?


Thank you!

14
As I said, I've been trying to do this for 3 days now. Here is what I did:

1) If I do my own window with all the properties I need the creation won't fail.
2) If I do my own window, create it and set that extended property afterward it won't fail.
3) If I hack the code of WindowsImplWin32 and make sure the window is created with this property it won't fail.
4) If I don't hack the code and get the SystemHandle and change the property then it fails.

I don't know what else I could try.
I've got the feeling that if this property isn't initialized at the very beginning then it can't be done afterward.... Although it works just fine with the example 1. Hum I guess there's a slight change I don't see here. I'll continue my investigation and let you know if I find anything.

15
I've spent the last four days struggling with that until I came to modifying the source code itself.
I wonder whether it's because the window is created without any extended window style. I think I just give up for now and keep with the altered version of SFML I've just made.

Pages: [1] 2
anything