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

Pages: 1 2 [3]
General discussions / New naming convention
« on: January 08, 2012, 04:25:42 pm »
Now that's going to be a lot of code to rewrite and it'll take a while for me to get used to it. ~_~
Hopefully I'll find a way to do this with regular expressions. I could never figure out how to use sed, a little help with this would be appreciated. :)

Graphics / Antialiasing via ContextSettings not working on Linux
« on: January 03, 2012, 10:01:14 pm »

the project I am working on uses vertex arrays and shapes a lot, but they aren't drawn with antialiasing, which makes them look quite ugly when they aren't made of axis-aligned lines. When I set ContextSettings' AntialisingLevel to 2 or 4 and create a RenderWindow with that, GetSettings().AntialisingLevel returns 0. I'm using CrunchBang Linux 10 and a rather recent version of SFML2. glxinfo and experience with various games on Linux tell me that my NVIDIA Linux drivers support antialiasing/multisampling up to level 4.
I have found something that might be related to the problem I'm having, but the thread is already over half a year old and the issue didn't seem to be solved yet: http://www.sfml-dev.org/forum/viewtopic.php?t=4462
Laurent described the situation as complicated, but the ability to enforce antialiasing through some function would be nice to have, though I have no idea how GLX, X11, Contexts and stuff like this work as I never worked with anything lying below SFML, so I might be underestimating the complexity in implementating something like this.

Any kind of help with or solution to this problem would be greatly appreciated.

General discussions / New graphics API ready
« on: December 12, 2011, 09:06:13 pm »
Ah, so that's what states are for. I'm rather new to hardware accelerated graphical programming and to the concept of Vertices in this context, so I was thinking it was some internal OpenGL stuff. Thank you for clearing it up! :)

General discussions / New graphics API ready
« on: December 12, 2011, 07:31:41 pm »

first of all, great job on the new API, it's looking great! I'm converting/rewriting my project for it right now, really looking forward to the speed boost once it's optimized.
There's something rather confusing about Vertices though: they allow you to set the coordinates of a texture, but I couldn't find any way to specify which texture a VertexArray should actually be rendered with. Am I overlooking something here or is that code just not written yet? A while ago, an example of the new API was posted, where sf::RenderTarget::SetTexture() or something like that was used, but that doesn't appear to be in the API (anymore).

Graphics / [SFML2] RenderTexture messes with Texture it should draw
« on: September 09, 2011, 08:35:24 pm »
It works perfectly now, thank you very much! :D

Graphics / [SFML2] RenderTexture messes with Texture it should draw
« on: September 09, 2011, 07:27:29 pm »

while working on my game I ran into a really strange issue: I'm using a standard map container to dynamically store 80x80 large blocks of the level. Another map container contains a texture-sprite pair which is pre-rendered when the associated block is loaded.
This has worked fine so far, but now I'm having problems with lighting. Light is calculated and drawn when a block loads: a 'global' RenderTexture is cleared, the lighting sprites are drawn onto it, and then it is copied into a Texture in a Sprite/Texture std-map. However, the RenderTexture seems to modify the Texture the lighting sprites use: they are turned into garbage, or parts of the actual level, but most of them do not display at all and the RenderTexture remains black. I wrote a minimal example program that reproduces the error, it uses the same method that I use in my game, just simplified:

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

int main() {
    sf::RenderWindow App(sf::VideoMode(800, 600), "SFML window");

    sf::Texture Tex;
    if (!Tex.LoadFromFile("test.png"))     // this can be any image file smaller than 100x100.
        return EXIT_FAILURE;
    sf::Sprite TestSpr(Tex);

    sf::RenderTexture RTex;

    std::map<std::pair<int,int>,std::pair<sf::Texture,sf::Sprite> > DrawMap;   // 2d-matrix of drawn sprites.

    for (int x=0; x<8; x++)
        for (int y=0; y<6; y++) {
            const std::pair<int,int> cur = std::make_pair(x,y);     // current entry in map.
            // Tex.LoadFromFile("test.png");
            RTex.Clear();           // clear rendertexture.
            RTex.Draw(TestSpr);     // draw test sprite.
            RTex.Display();         // update texture.
            DrawMap[cur].first.LoadFromImage(RTex.GetTexture().CopyToImage()); // copy rendertexture to texture in drawmap.
            DrawMap[cur].second.SetTexture(DrawMap[cur].first);     // define sprite.
            DrawMap[cur].second.SetPosition(x*100,y*100);           // position sprite.

    while (App.IsOpened()) {
        sf::Event Event;
        while (App.PollEvent(Event)) {
            if (Event.Type == sf::Event::Closed) App.Close();

        for (int x=0; x<8; x++)
            for (int y=0; y<6; y++)
                App.Draw(DrawMap[std::make_pair(x,y)].second);      // render map.
    return EXIT_SUCCESS;

Change "test.png" to any image smaller than 100x100 px. The result I am getting is that the texture gets smaller and smaller every time it is drawn. However, if you uncomment the line "Tex.LoadFromFile("test.png");", the image is drawn correctly every time. For my experiments, I used an 80x80 PNG image with an alpha channel, but it seems to happen with most files.

I am using CrunchBang Linux, the latest version of SFML2 (updated an hour ago), Code::Blocks w/ GCC 4.6, my video card is NVIDIA GeForce GTX 560Ti with driver version 280.13.

Any help with this strange issue would be greatly appreciated.

Pages: 1 2 [3]