eVoid Development Weblog Burn The Land And Boil The Sea But You Can't Take The Sky From Me

23Aug/100

Imposters

After a few weeks of being mostly occupied by applying certain interpersonal design patterns on real life, I've finally gotten the goddamn imposters to behave as required today >.<

Speaking of an application that renders a point cloud consisting of 100.000 vertices as shown by the screenshot above: When only small / slow local area movement is performed - which means only few imposters need to be updated every frame - the framerate stays stable around 400 FPS on a GeForce GTX 260 - To be precisely, this value is mostly affected not by the actual number of vertices, but by the number of octtree nodes being drawn. When moving much faster, it drops to a value between 100 and 150 FPS.

  • Share/Bookmark
5Aug/100

Pimpl + RAII + Exceptions

The acronym RAII stands for Resource Acquisition Is Instanciation. Basicly this means that resources are allocated in the constructor of a class and released in the destructor. What the Pimpl idiom is I've described earlies this day. When using RAII, constructors that may throw exceptions are unavoidable. But this isn't a problem at all when RAII is applied consequently, for when an exception is being thrown before the constructor of an object isn't fully processed, the destructors of all statically allocated members will be called automatically. How to deal with dynamically allocated objects? Simply allocate a scoped pointer like std::auto_ptr statically and reference it to the dynamically allocated object. The problem about this method in combination with Pimpl is: The compiler will throw a warning for the code line "std::auto_ptr<MyClassImpl> pImpl;" that the destructor of MyClassImpl won't be invoked since the type of MyClassImpl is unknown. Once more, the solution is quite simple:

class __BaseImpl
{
public:
    virtual ~__BaseImpl()
    {
    }
}; // class __BaseImpl

Afterwards, simply use "std::auto_ptr<__BaseImpl> pImpl;". The only problem about this is that you will have to cast pImpl everytime you are going to access the object's implementation.

  • Share/Bookmark
5Aug/100

The Pimpl Pattern

Today I want to blog about a design pattern that is called "pImpl",which I am using widely. If used consequently, almost all inclusions inside of headers can be replaced by forward declarations, only except those which are required for inheritance. So, compile time reduction is one great advantage of that pattern. Much more significant is the improved abstraction: Classes that are defined in header files are reduced to what they originally were meant to be, namely interfaces, whose implementation is totally irrelevant. Anyway, note that excessive appliance of the "pImpl" pattern might lead to some disadvantages. It is at it has always have been concerning patterns, it is highly useful to keep them in mind, but you should never apply them just for the sake of appliance.

  • Share/Bookmark
5Aug/100

Personal Ubuntu Setup Apt Line

Just a notice to myself (and anyone other who appreciate it) a list of Ubuntu packages I keep installing after every fresh Ubuntu installation:

  • vim - my favorite text editor
  • mesa-utils - contains glxinfo and glxgears
  • rxvt-unicode - fast, lightweight and flexible terminal emulator
  • qtcreator - my favorite IDE for C++
  • nmap - network analysis
  • subversion - provides a svn client
  • git-core - provides a git client
  • ubuntu-restricted-extras - provides Flash support, MP3 and many more
  • g++ - simply the GNU C++ compiler
  • libboost-all-dev - development files for all boost libraries

Copy&paste apt command line:

sudo aptitude install vim mesa-utils rxvt-unicode qtcreator nmap subversion git-core ubuntu-restricted-extras g++ libboost-all-dev
  • Share/Bookmark
28Jul/102

LOD Octtree Implementation

Just a few not much saying ;) screenshots from the debugging of a work-in-progress level-of-detail based implementation of the octtree algorithm I've presented a few weeks ago:

Anyone who can guess what screenshot #3 precisely shows..? Winner is gonna receive a cookie :P Anyway, took me 'bout 48 hours to figure out that **** to work properly. A Grooveshark playlist mostly dominated by blink-182, Offspring and good ole Milk Inc. mixed up by some rock classics from Queen & Co. playing looped for a damn long time did a great service ;) So now the sun is arising I can finally go to sleep after a -finally- very successful day of work.

  • Share/Bookmark
23Jul/100

Alpha 2 & Resource Organization

Today I finished the last tasks I had queued for alpha 2. Furthermore I've put a snapshot of the recent version online accomplished by some documentation. By doing so I decided to share some thoughts on the organization of resources by contexts and I'd like to draw your attention to it: What's your opinion on my solution, how do you handle it?

I've also written a roadmap for the project:

  • Alpha 1 (5. February 2010)
    • First usable version with a basic implementation of all the most important features, those are:
      • Post Processing Pipeline: Satisfying the demand on being easy to use, effects like blooming can be activated by up to three lines of code.
      • Object oriented encapsulation of most important OpenGL elements like textures, frame buffer objects and many more, providing the paradigm of orthogonality while satisfying the demand on being flexible & robust.
  • Alpha 2 (23. July 2010)
    • Countless bug-fixes & increased robustness
    • Widely improved GL encapsulation
    • Straightforward user-oriented design
    • API completely re-organized by layers

      ← Here we are
  • Alpha 3
    • Implementation of per-object motion- & usual blurring
    • Material property for specular highlighting
    • GL/gl.h dependency removal from vertexbuffer.hpp
    • Lazy state changes to avoid redundancy
    • Major API changes
      • Renderer class merged into RenderTarget
      • Materials organized by resource contexts
      • Potentially some kind of a shader abstraction:
        - Stack-like organization of shader states
        - Automatized shader generation
  • Share/Bookmark
22Jul/102

Z-Fighting Problem Solved

Thanks to an user named kRogue on the OpenGL forums the problem mentioned here is finally solved:

glTexParameteri( GL_TEXTURE_2D, GL_DEPTH_TEXTURE_MODE, GL_ALPHA );

is not part of GL3 core... though it is there in a compatible context. Try taking that call out and use the .r component of the depth texture in your shader... this should NOT make a difference, but you never know.

- kRogue

Furthermore I've been notified that the problem didn't occur on a GF GTX260.

One more important aspect to notice that you should check if you should ever happen to run into the same problem as I did: The GL_MIN_FILTER and GL_MAG_FILTER properties of the depth texture object must be set to GL_NEAREST. At least they are not allowed to be set to GL_LINEAR. Don't ask me for the reason. Otherwise you will experience the same Z-Fighting as I did.

  • Share/Bookmark
21Jul/100

C++0x, Lambda Expressions and Visitors

I know there are thousands and millions of articles out there dealing with the new features that are being introduced by the new C++ ISO standard commonly known as C++0x. Today I read that on Code Project and got very enthusiastic about the part that described the lambda expressions. I know that is damn geeky but I almost went bananas :D when I read what they are and what kinda stuff you can do with them. Countless situations came immediately on my mind in which I could take advantage of them. Usually I tend to make very extensive use of the Visitor pattern. Most of my classes that encapsulate some kind of an 1 -to- n>1 association do offer a function like VisitObjects( :UnaryFunction ). I like it that much because I believe it's the most short and abstract way to offer an interface for the traversal of associated objects. No matter how the data is internally organized - whether it's a tree or maybe a flat structure like a linked list or an array - the interface stays all the same. Up to now I had to do the following to make use of that kind of interfaces:

namespace impl
{
 
class MyFunctor
{
public:
 
    int i;
 
    MyFunctor( int i )
        : i( i )
    {
    }
 
    bool operator() ( const MyElement& e )
    {
        std::cout << ( i++ ) << " - " << e << std::endl;
        return true;  //< continue traversal
    }
 
};
 
}  // namespace impl
 
 
void MyClass::MyFunction()
{
    impl::MyFunctor visitor( 0 );
 
    MySet.VisitMyElements( visitor );
 
    std::cout << "We've vistited " << visitor.i << " elements" << std::endl;
}

Everyone will admit that is kinda ugly. Now, thanks to lambda expressions, I could just inline the whole logic into the one really necessary function:

void MyClass::MyFunction()
{
    int i = 0;
    MySet.VisitMyElements( [&]( const MyElement& e )->bool
            {
                std::cout << ( i++ ) << " - " << e << std::endl;
                return true;  //< continue traversal
            } );
 
    std::cout << "We've vistited " << i << " elements" << std::endl;
}

Though I haven't tested it, to me lambda expressions and the visitor pattern seem like made for each other :D

  • Share/Bookmark
20Jul/100

WordPress 3.0 & SFTP

WordPress 3.0 has a nice feature that does all the platform and plugin updating for you by just clicking an 'Update' button at the admin console. In order to do so it needs to connect to the server the blog is hosted. By the default configuration of my (and I guess almost any) server only FTP and FTPS (FTP via SSL) are available here. Since my server doesn't run a FTP server module for security reasons I looked for a way to teach SFTP (kinda FTP tunneled via SSH) to the platform and stumbled over a blog post by Raditha Dissanayake from June 2009 that described the required procedure for a Fedora box. Since I'm running Ubuntu Hardy Heron LTS I'll sum up what I had to do on that specific system:

aptitude install libssh2-1-dev php-pear php5-dev
pecl install -f ssh2
echo "extension=ssh2.so" > /etc/php5/conf.d/ssh2.ini
/etc/init.d/apache2 restart

This procedure will enable the SSH2 extension for PHP. Afterwards there will immediately be a 'SSH2' option beside FTP and FTPS located in WordPress' update dialog.

  • Share/Bookmark
19Jul/100

Living in Aachen

So, mir ist gerade langweilig, also schreib ich einfach mal, was die meiner Meinung nach besten Lebensmittel-Produkte sind, die man in Aachen als armer Student kaufen kann, vom Preis-Leistungsverhältnis her.

Bier: Das 5,0er respektive Pils, Weizen oder Radler beim REWE. Kostet nur 0,78 der Liter und schmeckt in dem Preissegment am besten. Der Billigmarke vom Plus (Schloss) meilenweit überlegen.

Hackfleisch: Beim REWE gibt es öfter mal Sonderangebote der etwas gehobeneren Marken. Zu den Ja-Produkten greife ich an dieser Stelle nicht mehr, seit ich mal eine Lebensmittelvergiftung davon getragen habe ;) Und sonst beim Aldi.

Pfannengyros: Beim Aldi, etwas um die 2,50 für eine 500g Packung, finde ich mehr als fair. Schmeckt super.

Pizza: Dreifachpackung Salami für nur knapp 2,50 oder Margarita für knapp 2,00 beim Plus.

Schinken: Auf jeden Fall das Ja-Produkt von REWE.

Schokolade: Ganz klar die Ja-Produkte beim REWE, in verschiedenen Sorten.

Schwarzbrot: Weltmeisterbrot beim Plus, etwas über 1,00 für 750g.

Wasser: In verschiedenen Sorten bei REWE und beim Plus.

Die Liste wird bei Gelgenheit weiter ergänzt werden.

Ein tolles Angebot gibt es von der belgischen Bahn: Ab Eupen kommt man mit dem GoPass 1 für nur 6,50 pro Person oder 5,00 beim Kauf von mindestens 10 Tickets nach Oostende an die Nordsee. Nach Eupen kommt man z.B. mit der Linie 14, und als Student sogar kostenlos.

  • Share/Bookmark