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

Pages: [1]
1
Graphics / sf::Shader - Vertex Attributes
« on: January 24, 2012, 05:27:53 pm »
hello there!

as i can see there is no support for vertex attributes in sf::Shader. am i just blind or is this really the case?

cheers!

2
Graphics / How can I use OpenGL commands for drawing on RenderTexture?
« on: January 24, 2012, 05:12:32 pm »
Quote from: "Laurent"
Quote
I solved that problem

How?


i think he used glViewport(0,0,width,height). i had a similiar issue these days and could solve it by updating the opengl viewport before drawing to a texture.

3
Graphics / [SOLVED] Possible Bug with RenderTexture coordinates?
« on: January 17, 2012, 02:06:27 pm »
OK, that makes sense. I hope this thread will help somebody in the future. :)

4
Graphics / [SOLVED] Possible Bug with RenderTexture coordinates?
« on: January 17, 2012, 01:35:09 pm »
Quote from: "Laurent"
The first row is the number 0, why would you expect coordinate 0 to be out of the target?

So the problem is that your Y-axis primitive is not shown, actually.

You should avoid integer coordinates when you draw lines. If you want a 1-pixel wide line that fills the first row or column of pixels, ie. the range [0, 1], it's coordinate must probably be 0.5 since it represents the "center" of the line.

Try this and let me know if it solves your problem.


that's not the problem. i don't want to draw the lines along the axes right at the border at all. i just discovered this strange behavior while playing around and wanted to report it. :)

just try to draw a horizontal line at x(0.f) and a vertical line at y(0.f). you'll see the horizontal line but not the vertical one if you draw them to a texture. there must be something wrong.

i hope you understood my intention now. ;)

5
Graphics / [SOLVED] Possible Bug with RenderTexture coordinates?
« on: January 17, 2012, 12:26:05 pm »
on the one hand, if you draw a simple line (x-axis) at P1(0, 0), P2(width, 0) there should be no line at all but the line appears at P1(0, 1), P2(width, 1). on the other hand, the line (y-axis) at P1(0,0), P2(0, height) is not shown, as supposed. if you move the line along the x-axis by 1 pixel, it gets visible.


another example:

x-axis line: P1(1,1), P2(width,1)
y-axis line: P1(1,1), P2(1,height)

you would expect both lines to be drawn in the first row (x-axis) and in the first column (y-axis) of the target. but the x-axis is drawn in the 2. row, thats the problem. :)

this happens only with RenderTexture. if you draw the same vertices directly to the window, everything is OK.

6
Graphics / [SOLVED] Possible Bug with RenderTexture coordinates?
« on: January 17, 2012, 11:15:32 am »
by the way, i built this code on a x86_64 windows 7 machine at work. i did not test it on my gentoo box, yet.

7
Graphics / [SOLVED] Possible Bug with RenderTexture coordinates?
« on: January 17, 2012, 10:53:26 am »
yes, sir. ;)

Code: [Select]

/* INCLUDES
***********************************************************************************************************************/
#include <SFML/Graphics.hpp>


/* MAIN
***********************************************************************************************************************/
int main()
{
    // create window
    sf::RenderWindow window;
    sf::VideoMode videoMode;
    window.Create( videoMode.GetFullscreenModes()[0], "Test", sf::Style::Fullscreen );

    // create texture target
    sf::RenderTexture textureTarget;
    textureTarget.Create( window.GetWidth(), window.GetHeight() );

    // create primitives
    sf::VertexArray lines( sf::Lines, 4 );

    lines[0].Position = sf::Vector2f( 0, 0 );
    lines[1].Position = sf::Vector2f( window.GetWidth(), 0 );

    lines[2].Position = sf::Vector2f( 0, 0 );
    lines[3].Position = sf::Vector2f( 0, window.GetHeight() );

    // draw primitives once
    textureTarget.Clear( sf::Color(57,57,57) );
    textureTarget.Draw( lines );
    textureTarget.Display();

    // create sprite
    sf::Sprite sprite;
    sprite.SetTexture( textureTarget.GetTexture() );

    // main loop
    while( window.IsOpen() )
    {
        // process input
        sf::Event event;
        while(window.PollEvent(event))
        {
            if ( event.Type == sf::Event::KeyPressed && event.Key.Code == sf::Keyboard::Escape) {
                window.Close();
            }
        }

        // clear first
        window.Clear(sf::Color::Blue);

        // draw the sprite
        window.Draw( sprite );

        // display
        window.Display();
    }

    return EXIT_SUCCESS;
}

8
Graphics / [SOLVED] Possible Bug with RenderTexture coordinates?
« on: January 17, 2012, 10:26:32 am »
Hello there!

i think, i have found a bug today. first of all, the code snippet:

Code: [Select]

...

sf::VertexArray primitives( sf::Lines, 4 );

// x-axis
primitives[0].Position = sf::Vector2f( 0, 0 );
primitives[1].Position = sf::Vector2f( width, 0 );

// y-axis
primitives[2].Position = sf::Vector2f( 0, 0 );
primitives[3].Position = sf::Vector2f( 0, height );

...

// draw to texture first
texture.Draw( primitives );

...

// then draw it to the window
window.Draw( spriteWithMyTexture );

...



i expected to see nothing, but the x-axis primitive is shifted exactly 1 pixel down. if i draw the primitives directly to the window everything is ok. this is how it looks like:


9
Window / Resizing (Qt) does not work
« on: October 27, 2011, 03:45:32 pm »
hi,

i have troubles resizing the context inside my Qt-window. at first the relevant code-snippet which does the resizing: (ignore the LOG(...) stuff, thats just for testing)

Code: [Select]

void SFMLWidget::resizeEvent(QResizeEvent *e)
{
    LOG("ResizeEvent -> Qt: " << e->size().width() << "x" << e->size().height() );

    SetSize(e->size().width(), e->size().height());

    LOG("ResizeEvent -> SFML: " << GetWidth() << "x" << GetHeight() );
}


SetSize(...) does not have any effect. didnt try that on windows though. the only thing that works, is recreating the entire context, what is a bad idea in this case since the resizeEvent is fired all the time while resizing. native sfml-window works perfectly.

i've uploaded some images to illustrate the problem. the green corners are the window-cornerns, the black area is the window itself. changing the clear-color affects the wohle black area. thats just weird to me. :)




10
General / sfml16.qch for qt-creator :)
« on: September 16, 2011, 10:18:43 pm »
hello guys!

today i created a qch-file for sfml v1.6 which you can use with qt-creator. now you can use context-sensitive help while developing cool stuff with sfml. just move your mouse over an identifier ( e.g. sf::Clock ) and press F1, exactly as you know from the official qt-stuff.

sfml2 will follow as soon as it is released officially.

http://uploaded.to/file/7yo5pmeb

feel free to distribute. enjoy. :)

Pages: [1]
anything