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.

Topics - Haikarainen

Pages: [1] 2 3 4
SFML projects / Critters devlog
« on: February 14, 2015, 01:21:52 pm »

Hello people!

I have created a development log for my TD game critters. It's written in C++ using Ogre as a renderer, SFML for Audio, and OIS for input! I am creating graphics in Blender and Gimp and coding it all as well. Sound is created by Stormwave Audio.

First entry here here: http://www.fredrikhaikarainen.se/devlog-entry-001-introduction/
Second entry here: http://www.fredrikhaikarainen.se/devlog-entry-002-shading-tweaks-lut-based-color-grading-and-ui-work/


Third entry: http://www.fredrikhaikarainen.se/devlog-entry-003-realtime-shadows-bloom-mortar-turret/

Graphics / Issue with 2D normal maps
« on: December 28, 2013, 05:00:24 am »
I'm attempting to create a lighting system for a 2d platformer, which will include normal mapped textures(to give a sense of depth and detail in the textures). However I've ran across an issue, it's a really hard issue to explain so I created a minimal example of what I've got so far regarding normal maps.

To try and explain the problem; It's like the light direction for the normals is static to the whole texture, when I want it to be pixelperfect. I really cant explain it better than that, you have to see the examples.

Minimal example: https://gist.github.com/haikarainen/4c4ab515d9c13a7f467b
Windows Binaries and textures of example: haikarainen.dotgeek.org/release.7z

Any help is hugely appreciated as my math sucks.


I am using SFML for 2D-drawing and easy texture/shader-management in pretty much all of my projects that need it, and yesterday I came across the limitations of the sf::Shader::setParameter-implementations: It is VERY 2d-oriented (like much else in SFML), but a general Shader-class shouldnt really be 2d-oriented imho.

Anyway I added an implementation that can take a/several 4x-matrices as an argument (you need this for any proper 3d-application really). find it here: http://pastebin.com/05h9Y0af

Also I understand if you want to keep the library 2d-oriented, and I get if you REALLY dont want to create sf::Transforms etc that is 3d-oriented, but I would really appreciate if you loosened up on a few things to make it easier for us who is not strictly 2D to use SFML to its full potential. (I use both shaders and rendetextures a _LOT_ and it makes my life way easier by not having to fiddle around with FBO's etc and try to combine them with SFML's awesome 2d-drawing).

It would also make me able to release my software and not having to link statically or include my custom sfml-versions.


Graphics / [FIXED] RenderTexture on Intel GPU's. Let's fix this problem!
« on: September 14, 2012, 05:21:52 pm »
This issue was solved faster than anyone could think! Thanks to everyone involved, great effort!
At the time of writing you still need the git-version of sfml2 for the fix to be applied

This has been a known problem for a while now and it is really annoying, since RenderTexture is a huge asset to the SFML library.

I would like to gather all information possible on this problem and fix this once in for all (on linux at least, dont know if it happens on windows). I know a lot of people have been working hard debugging this problem, as have I, and I would really love it if we could gather all the people who are willing to work on this and actually fix it.

If you think you can help in any way, reply in this thread. If you need some sort of inspiration, please let it be known that Intel engineers are working fullspeed on fixing their drivers for other issues, mostly because of the Valve-Intel-cooperation on porting Steam to Linux.

The information I've gathered so far, by debugging:

I get error
intel_do_flush_locked    No such file or directory
When calling RenderTexture::display(). On my unoptimized testbed it is always the third call of one instance.

gdb does not return any sigtrap/segfault or any other error.

I have tried forcing SFML to use the fallback mechanism (context from hidden window) instead of FBO by forcing priv::RenderTextureImplFBO::isAvailable() to return false, did not do any difference.

Tried both SNA and UXA acceleration.

I have tried to track down the error down to the XFree86's Intel drivers sourcecode(2.20.7) http://cgit.freedesktop.org/xorg/driver/xf86-video-intel/, and I think it's related to the function intel_batch_do_flush on line 119 of file intel_batchbuffer.c:

static void intel_batch_do_flush(ScrnInfoPtr scrn)
        intel_screen_private *intel = intel_get_screen_private(scrn);
        struct intel_pixmap *priv;

        list_for_each_entry(priv, &intel->batch_pixmaps, batch)
                priv->dirty = 0;

I am not sure though, I cant find any file that contains parts of the error I get, so it's a tough nut to crack. Given that it is a "No such file"-error it should be an easy fix though.

I will set up a virtualbox instance a partition on my laptop with a custom linuxsetup as a proper testbed, create a minimal reproduction of the error with the latest SFML so I can truly debug both SFML code as well as driver-code without messing up my box.

Any information hugely appreciated, current set up for these results:

ArchLinux Kernel 3.5.3-1-ARCH x86_64
Intel Core i7 3610-QM
Intel Graphics HD 4000 running xf86-video-intel-sna driverpackage from official arch repos.
4 GB Memory DDR3 (Shared with GPU)
SFML 2.0

Network / Is there any planned improvements on the network package?
« on: June 19, 2012, 07:03:08 pm »
The biggest lack in SFML is, if you ask me, the networkpackage. IIRC the UDP-socket-class has no guarantee-functionality whatsoever that the packets will get where they are headed. Also it doesn't really feel complete. Take this for example:
Socket::Status SocketImpl::getErrorStatus()
    switch (WSAGetLastError())
        case WSAEWOULDBLOCK :  return Socket::NotReady;
        case WSAECONNABORTED : return Socket::Disconnected;
        case WSAECONNRESET :   return Socket::Disconnected;
        case WSAETIMEDOUT :    return Socket::Disconnected;
        case WSAENETRESET :    return Socket::Disconnected;
        case WSAENOTCONN :     return Socket::Disconnected;
        default :              return Socket::Error;

This is the case for the windows- and linux-implementations, I feel like we are missing out on A LOT of neccessary error messages here.

I would be joyed to see some improvements on the network library and I hope it is highly prioritized!

Graphics / Positioning a sprite after another sprites rotation?
« on: June 15, 2012, 04:03:17 am »
In another project of mine, utilizing only opengl and my own code, I have "sprites" in a sense of nodes and entities(kindof like ogre3ds nodesystem, except it's 2d). In this system every node can have both childrennodes and entities(entities being drawn stuff, like a texture, nodes being positions etc).

As an example of what I want to achieve with SFML; in this system I can have 1 rotating node, with a box drawn to it, and then a subnode with an offset(below the parentnode for example) with another box drawn to it. When I draw the nodes, I draw them from a top-to-bottom-hierarchical way, wich includes all the nodes transforms. So when the parentnode is rotating, the childnode is rotating with it(as well as positioning itself with its offset correctly). Kind of looks like this:

NodeSystem->Draw() // <- draws all the nodes

        ParentNode->ApplyRotation() // <- calls glRotatef(0,0,1,rotation)
                ChildNode->ApplyRotation() // This isnt rotated,  but it parentnodes rotationtransofrmation is still in effect so it will be
                        //  No children to be drawn
        ParentNode->DeleteRotation() // calls glRotatef(0,0,-1,rotation);

This way it has made it really easy for me to attach stuff logically and just have them work with eachother automatically, and not care so much about the math behind it. Now I want to do this in SFML, I have a rocket-tower with attached rockets, but cant rotate the tower with the rockets properly using only sprites, I guess it is doable with some cos/sin/tan-magic but I'm not the brightest nut in the toolbox regarding this. Is there any easier and perhaps more automated way?

Graphics / OpenGL Problems: GL_OUT_OF_MEMORY, ensureGlContext?
« on: June 06, 2012, 01:31:05 am »
I don't know if the problem is related to SFML at all, but i'm posting it here either way!

A project of mine is using SFML to create a window as well as load imagefiles, and so far this has been going great! I'm currently working on drawing  planet earth using highresolution textures and shaders, currently I have 3 textures I want to use, all of wich are 8192x4096:
  • Normal/Daylight
  • Night-texture
  • Cloudmap

Regardless of the order I'm loading these in, the third one always fails with GL_OUT_OF_MEMORY after the methodcall gluBuild2DMipmaps. Remember I dont use sf::Texture or sf::Shader here, only sf::RenderWindow and sf::Image. The program still runs but the third texture seems to contain no pixeldata, making it transparent.

If I load the  night-texture last: https://legacy.sfmluploads.org/cache/pics/243_earthclouds.png
If I load the cloud-texture last: https://legacy.sfmluploads.org/cache/pics/244_earthnight.png

I suspect it being a missing glcontext or something, therefore I wanted to use ensureGlContext to ensure it but noticed that method is protected :/ Is there anyone who knows what it might be?

The max texture size on my system is 16K, so that passes.

Full code to create a  texture:

de::Texture::Texture(de::Base* r, std::string name,std::string path){
        std::cout << "Loading texture from " << path.c_str() << "..";
        this->Root = r;
        this->Name = "__not_ready";
        this->Handle = 0;
        this->IsReady = false;
        sf::Image c;
                glGenTextures(1, &this->Handle);
                glBindTexture(GL_TEXTURE_2D, this->Handle);
                gluBuild2DMipmaps(GL_TEXTURE_2D, GL_RGBA, c.getSize().x, c.getSize().y, GL_RGBA, GL_UNSIGNED_BYTE, c.getPixelsPtr());
                glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);

                        glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, this->Root->GetGLSystem()->GetHardware()->Anisotrophy);
                this->IsReady = true;
                this->Name = name;
                std::cout << "Created texture!" << std::endl;
                std::cout << "Couldn't load texture from file." << std::endl;
                throw(de::Exception("Couldn't create a texture, image not valid!"));

de::Texture::Handle is a GLuint

SFML website / Site sends spam to email?
« on: April 23, 2012, 02:58:59 pm »
I got this message sent to me, is this site sending out spam?

Code: [Select]
Delivered-To: *@gmail.com
Received: by with SMTP id zf7csp21218ieb;
        Mon, 23 Apr 2012 03:57:22 -0700 (PDT)
Received: by with SMTP id o66mr9780502wei.14.1335178642287;
        Mon, 23 Apr 2012 03:57:22 -0700 (PDT)
Return-Path: <bounce-id=D114=U56003.90plan.ovh.net=1335178643347317541@81.mail-out.ovh.net>
Received: from 81.mail-out.ovh.net (81.mail-out.ovh.net. [])
        by mx.google.com with SMTP id e9si8273891wiw.42.2012.;
        Mon, 23 Apr 2012 03:57:22 -0700 (PDT)
Received-SPF: pass (google.com: best guess record for domain of bounce-id=D114=U56003.90plan.ovh.net=1335178643347317541@81.mail-out.ovh.net designates as permitted sender) client-ip=;
Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of bounce-id=D114=U56003.90plan.ovh.net=1335178643347317541@81.mail-out.ovh.net designates as permitted sender) smtp.mail=bounce-id=D114=U56003.90plan.ovh.net=1335178643347317541@81.mail-out.ovh.net
Received: (qmail 31867 invoked by uid 0); 23 Apr 2012 10:57:25 -0000
Received: from gw0.ovh.net (HELO 90plan.ovh.net) (
  by 81.mail-out.ovh.net with SMTP; 23 Apr 2012 10:57:23 -0000
Received: from localhost.localdomain (localhost.localdomain [])
by localhost.domain.tld (Postfix) with ESMTP id 3D79E3F45B
for <fredrik.haikarainen@gmail.com>; Mon, 23 Apr 2012 12:57:19 +0200 (CEST)
Received: by 90plan.ovh.net (Postfix, from userid 56003)
id 132583F45D; Mon, 23 Apr 2012 12:57:19 +0200 (CEST)
To: *@gmail.com
Subject: KnRAsshiveYb
From: "bsgtzk@dmekas.com" <laurent@sfml-dev.org>
Reply-To: <bsgtzk@dmekas.com>
Date: Mon, 23 Apr 2012 10:57:18 -0000
X-Mailer: SMF
Mime-Version: 1.0
Content-Type: multipart/alternative; boundary="SMF-0a817b5c5eec048750e5bde766b1f484"
Content-Transfer-Encoding: 7bit
Message-Id: <20120423105719.132583F45D@90plan.ovh.net>
X-Ovh-Tracer-Id: 3860429307667617224

SAeAa2  <a href="http://sbxbvfgfydna.com/">sbxbvfgfydna</a>, [url=http://bxaitakczfqd.com/]bxaitakczfqd[/url], [link=http://sdamqfjbhjbp.com/]sdamqfjbhjbp[/link], http://aawudhivznkj.com/
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

SAeAa2  <a href="http://sbxbvfgfydna.com/">sbxbvfgfydna</a>, [url=http://bxaitakczfqd.com/]bxaitakczfqd[/url], [link=http://sdamqfjbhjbp.com/]sdamqfjbhjbp[/link], http://aawudhivznkj.com/

DotNet / .NET samples crash, problem with installing
« on: February 12, 2012, 06:05:59 pm »
I'm basically a newborn when it comes to .net / visual studio etc. and I'm having problems both running the precompiled samples as well as using the .NET-binding in Visual Studio 10.

The samples just simply crash at startup, every single one of them. And for the using them; I try to add them to my toolbar but it complains about not having components in it that can be added to the toolbar. Haven't found a single guide on the subject.

Can anyone point me in the right direction plx?

DotNet / Any news on SFML Render-context as a WPF Control?
« on: February 07, 2012, 07:28:41 pm »
My goal is to be able to have a SFML rendercontext in a WPF-application. Is this possible? How easy would it be to make it happen?

New to WPF, pretty experienced with WinForms and SFML, as well as programming in general.

What I want is to just drag out a "box" in the visual designer, wich I can draw to and stuff just as I would draw to a RenderWindow/RenderTexture.

Working with C# in Visual Studio 10.

DotNet / Is it possible to get a 2.x version of the .NET bindings?
« on: January 31, 2012, 06:11:51 pm »
EDIT; Didn't see the other post, laruent feel free to stabrape this post to oblivion!  :oops:

Graphics / sf::RectangleShape Texture clamps/tile?
« on: January 12, 2012, 08:14:28 pm »
Is there anyway to set behaviour methods on a rectangleshape defining how the texture will be drawn? Perhaps setting your own texturecoords?

What I want to achieve is drawing a tiled texture on a single shape, something like setting texture coords to 0.25 instead of 1.

If this hasn't been implemented yet, it REALLY should. Why? it will allow me to draw thousands of tiles on a single shape, instead of thousands of tiles on, thousands of sprites/shapes. this would speed up my mapeditor SIGNIFICANTLY, as well as the game itself.

General / What is that "SFML_API" I'm seing in every class d
« on: December 10, 2011, 11:52:19 pm »
This question isn't directly related to SFML as I've seen it elsewhere, but it sure is related to C++.

So what is that SFML_API I see in every class definition anyway? I've tried to find a term about what it is, and what it might do, but with no luck. Not even the most advanced tutorials out there brings this up.

Tried googleing, scavenging general c++ tutorials, getting clues by trying to get compiler errors. But nothing.

I'm really curious about this, and been for a long while, Want to know how I can use this for my own good.

Graphics / Destructible terrain, best way w/ SFML?
« on: December 09, 2011, 02:32:32 am »
Think something like worms. How to do this in a fast and effiecent way is hard for me to think about, when limited to SFML (sf::Image is out of question since the slow pixelacces)

Thinking about having a sf::RenderTexture for the terrain, and then just render circles where I want to reshape the terrain(blow it up). Problem is, can you render transparent pixels to an sf::RenderTexture and have the alphachannel override (set instead of add) the old pixels? If not, I should probably have a colormask (like 255,255,0 is transparent), but then, how would you render that mask transparent?

Also a rendermask would also be awesome, so that you can render "edges" of the blown up circles, but only contain them to where it used to be terrain.


Window / Illegal symbol index in relocs. tickStat has no section.
« on: November 10, 2011, 08:31:27 pm »
Code: [Select]
Linking console executable: bin\Debug\noname-editor.exe
mingw32/bin/ld.exe: warning: c:\Libraries\SFML2\lib/libsfml-window-s-d.a(dcjgs00048.o): local symbol `tickStat' has no section
mingw32/bin/ld.exe: BFD (GNU Binutils) 2.19.1 assertion fail ../../binutils-2.19.1/bfd/cofflink.c:2270
mingw32/bin/ld.exe: c:\Libraries\SFML2\lib/libsfml-window-s-d.a(dcjgs00048.o): illegal symbol index -855608464 in relocs

I get this when trying to build one of my projects (that have built perfectly earlier). The thing I change is I link using -lsfml-* prefixes instead of directly to the libfiles (libsfml) and these errors show up.  This is weird since I'm used to linking using the prefixes and not paths. This is actually my preffered behaviour.

I set my search directories in my IDE options and not the Project options in the IDE. I use the exact same directories and libnameprefixes in other projects wich build perfectly.

I don't have any duplicate lib files laying around (searched my drives like 3 times), the libfiles ld is trying to link are the exact same i link to when using direct filenamepaths as well. I am stumped.

Any help?

Pages: [1] 2 3 4