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

Pages: [1] 2
1
General discussions / New graphics API ready
« on: December 03, 2011, 05:16:17 pm »
I really miss the sf::Sprite::GetSize() and Resize() functions :( Did you remove them just for tidiness?

2
Graphics / Blurred fonts in newest SFML2
« on: June 06, 2011, 12:12:45 am »
I have done several tests and decided that sometimes forced autohinting is better, sometimes worse.

Verdana 12px: forced autohinting is much clearer
Times 12px: default settings looks better
Comic Sans MS: forced ah 'wins'...

(default settings on the left, forced autohinting on the right)


I think you should add some kind of flag to allow us to select hinting method without modifying SFML source.

Until then, I stay with my mod :)

3
Graphics / Blurred fonts in newest SFML2
« on: May 29, 2011, 01:35:52 pm »
I Just changed 319 line in Graphics/Font.cpp to
Code: [Select]
if (FT_Load_Char(face, codePoint, FT_LOAD_FORCE_AUTOHINT) != 0)
 what fixed the problem for me. Now rendering is almost the same to the previous one. :)

4
Graphics / Blurred fonts in newest SFML2
« on: May 29, 2011, 12:33:14 am »
Well... It's caused by FreeType update in this commit:

https://github.com/SFML/SFML/commit/5e73228b5e10b0ebbde1d667b30097df95578be8

And minimal example:
Code: [Select]

////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
#include <SFML/Window.hpp>
#include <SFML/Graphics/Font.hpp>
#include <SFML/Graphics/Text.hpp>
#include <SFML/Graphics/RenderWindow.hpp>

////////////////////////////////////////////////////////////
/// Entry point of application
///
/// \return Application exit code
///
////////////////////////////////////////////////////////////
int main()
{
    // Create the main window
    sf::RenderWindow window(sf::VideoMode(200, 100, 32), "SFML Window", sf::Style::Default, sf::ContextSettings(32));

sf::Font font;

font.LoadFromFile("verdana.ttf");
sf::Text text("Test abcdefghijkl\nABCDEFGHIJKL\n1234567890",font,12);

    // Start the game loop
    while (window.IsOpened())
    {
        // Process events
        sf::Event event;
        while (window.GetEvent(event))
        {
            // Close window : exit
            if (event.Type == sf::Event::Closed)
                window.Close();

            // Escape key : exit
            if ((event.Type == sf::Event::KeyPressed) && (event.Key.Code == sf::Key::Escape))
                window.Close();

       }


        window.Clear();
window.Draw(text);


        // Finally, display the rendered frame on screen
        window.Display();
    }

    return EXIT_SUCCESS;
}


Just extract verdana.ttf from windows folder and compare the results ;)

I know that newest version should be better, but there we have noticeable regression in text quality...

5
Graphics / Blurred fonts in newest SFML2
« on: May 28, 2011, 06:24:41 pm »
Hello. I just updated ~5-month old SFML2 to the lastest revision in my project.

Unfortunately, something changed in sf::Text appearance.
Just look at the screen:


(verdana, size: 12)

Is there any way to restore the previous rendering? Everything is blurry now :(

6
Graphics / RenderImage drawing upside-down images
« on: May 18, 2010, 03:58:05 pm »
I was getting the same results when I forgot to call renderImg.Display(). You have to call this method after any modifications in your RenderImage (before drawing).
Code: [Select]

        rim.Draw(spr);
        rim.Display();
        sf::Sprite rimspr;
        rimspr.SetImage(rim.GetImage());
        App.Draw(rimspr);
       

        App.Display();

7
Graphics / [SFML2] RenderImage and Text problems
« on: April 28, 2010, 03:56:15 pm »
Well... I must have been using a broken one. I've just updated SFML to the newest revision and everything works correctly now.

So, the problem is solved :) Thanks.

8
Graphics / [SFML2] RenderImage and Text problems
« on: April 27, 2010, 07:50:33 pm »
Hello. I'm trying to draw some strings into sf::RenderImage . Unfortunately, it doesn't work.

Code: [Select]
#include <SFML/Graphics.hpp>


int main()
{
 // First of all: make sure that rendering to image is supported
 if (!sf::RenderImage::IsAvailable())
    return -1;

 // Create a new render-window
 sf::RenderWindow window(sf::VideoMode(800, 600), "SFML window");

 // Create a new render-image
 sf::RenderImage image;
 if (!image.Create(500, 500))
     return -1;

 // The main loop
 while (window.IsOpened())
 {
    // Event processing
    // ...

    // Clear the whole image with red color
    image.Clear(sf::Color::Red);



    // Draw stuff to the image

    sf::Text text("String test", sf::Font::GetDefaultFont(), 12);


    //image.Draw(sprite);  // sprite is a sf::Sprite
    //image.Draw(shape);   // shape is a sf::Shape
    image.Draw(text);    // text is a sf::Text


    // We're done drawing to the image
    image.Display();

    // Now we start rendering to the window, clear it first
    window.Clear();

    // Draw the image
    sf::Sprite sprite(image.GetImage());
    window.Draw(sprite);
    // Uncomment this line to draw text directly
    // window.Draw(text);

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

return 0;
}


The text doesn't appear. When I'm drawing it directy into sf::RenderWindow, it does.

In my more complex app I've got even more weird results:


...but it was when I forgot to call RenderImage::Display(). Now the result is the same.

So... Is it a bug or my mistake?

Thanks for any help :)

9
Graphics / Drawing huge amount of sprites
« on: September 28, 2009, 07:36:08 pm »
I know. But the maximum size of sf::Image is too small for the large map. Of course, I can split it into smaller pieces, but that metod still takes huge ammount of memory and isn't easy to implement (some sprites can be larger than grid)...

10
Graphics / Drawing huge amount of sprites
« on: September 28, 2009, 06:48:54 pm »
Quote
Drawing only the visible tiles is straight-forward, even with zooming. As long as you don't use rotation, the view is just an aligned rectangle, just like your tiles (I assume you have an axis-aligned grid of tiles).


Yes, but sometimes all the sprites will be drawn. When I zoom out, I'll notice a huge slowdown (especially on old computers). SFML does automatic batching, what gives me large speedup, but I still have to rebuild render queue, making a loop with 10 000 iterations in every frame. I think that it causes slowdowns.
It would be nice to see something, what'll allow me to fill render queue in static (maybe precompiled?) sprites with one call.

I was trying to render all map sprites into OpenGL list and display it by glCallList(). I reached huge speed improvement, but all sprites in list were blinking and disappearing after changing any of sf::View values...

11
Graphics / Drawing huge amount of sprites
« on: September 27, 2009, 07:10:26 pm »
Hello. I'm trying to find enough efficient way for drawing map in my game. I want to draw 10000 (100x100) small tiles (32x32px for now). Drawing it in every frame with loop is much faster in SFML 2, but it's still to slow. I'm getting only 60fps (without vsync) on modern computer (on my old laptop it's completely unplayable). So, is there any better way to do this? I was thinking about drawing only actually visible elements, but I'm going to implement zooming (sometimes all sprites will be drawn).
It would be nice to draw all sprites in one call like OpenGL lists, but I don't know how to implement this in SFML...

12
Graphics / Resizing sprite in SFML2
« on: September 27, 2009, 01:26:09 pm »
Ok, I downloaded the correct version. Everything (excluding fonts) in working now :)

13
Graphics / Resizing sprite in SFML2
« on: September 26, 2009, 10:36:07 pm »
Wel... I had downloaded the newest revision from http://sfml.svn.sourceforge.net/viewvc/sfml/trunk.tar.gz?view=tar

and compiled it with Code::Blocks (mingw). I also ran the batch-build script to link other libraries. Unfortunately, the problem still appears.

Can you find some time to test my compilation? I have no idea, what I'm doing wrong. I have included static version and the binary of example.
http://www.sendspace.com/file/0sf8pd

Thanks

14
Graphics / Resizing sprite in SFML2
« on: September 25, 2009, 10:52:47 pm »
Code: [Select]
#include <SFML/Graphics.hpp>

int main()
{
    // Create the main rendering window
    sf::RenderWindow App(sf::VideoMode(800, 600, 32), "SFML Graphics");

    // Load the sprite image from a file
    sf::Image Image;
    Image.SetSmooth(false);
    if (!Image.LoadFromFile("gui_button_c.png"))
        return EXIT_FAILURE;

    // Create the sprite
    sf::Sprite Sprite(Image);
    Sprite.SetSubRect(sf::IntRect(2,0,3,23));
Sprite.Resize(300,23);

    Sprite.SetPosition(0.f, 0.f);

    // Start game loop
    while (App.IsOpened())
    {
        // Process events
        sf::Event Event;
        while (App.GetEvent(Event))
        {
            // Close window : exit
            if (Event.Type == sf::Event::Closed)
                App.Close();
        }

        // Clear screen
        App.Clear(sf::Color::White);

        // Display sprite in our window
        App.Draw(Sprite);

        // Display window contents on screen
        App.Display();
    }

    return EXIT_SUCCESS;
}


And the sprite:
http://img148.imageshack.us/img148/9381/guibuttonc.png

The image should stick in the corner of the window...

15
Graphics / Resizing sprite in SFML2
« on: September 25, 2009, 08:58:48 pm »
Hello, I had migrated to the newest wersion of SFML and noticed a weird thing with positioning resized sprites.

The resized sprite looks to be moved at some pixels, what gives me unexpected results:
http://img143.imageshack.us/img143/573/wrong.png

In the previous SFML version (1.5) I've got the correct effect:
http://img143.imageshack.us/img143/5971/correct.png

Is there a bug in the new version of SFML? Or maybe i don't know about some changes in api? :)

Thanks for help.

Pages: [1] 2