Category Archives: C++

Everything related to the use of the C++ language

Interactive Raytracer 3: Lights and shadows

Adding the lights is the first step toward a Whitted raytracer. For each ray that hits an object, several rays can be cast, reflection, refraction and shadow. The last one is the one created with lights.

Lights and shadow rays

Without light, objects are bland, seem to have no depth, … Light on a scene can be cast by several light sources. When a ray of the camera hits an object, the intersection point can be illuminated by one or several of those sources. Each of them contributes to the color of the object. If the light source direction is parallel with the normal of the object at the intersection point, the contribution will be maximum. If it is orthogonal, the contribution will be zero. The scalar product is the tool used to compute this quantity.
Continue reading Interactive Raytracer 3: Lights and shadows

Book review: Effective C++: 55 Specific Ways to Improve Your Programs and Designs

C++ code quality is a difficult topic. There are some basic topics and other, more advanced. Sutter and Alexandrescu wrote a complete book on C++ standards to achieve good quality with basic and advanced topics, but Meyers wrote a book before, on the basics of C++.

Effective C++ is at its third edition, which is a complete rewrite with topics from the “old” Effective C++ and More Effective C++. So if you have one or the other, you will find yourself with additional content.
Continue reading Book review: Effective C++: 55 Specific Ways to Improve Your Programs and Designs

Profiling with Visual Studio Performance Tool

After presenting Valgrind as an emulation profiler, I will present Microsoft solution, Visual Studio Performance Tool. It is available in the Team Suite editions, and offers a sampling- and an instrumentation-based profiler. Of course, it is embedded in Visual Studio IDE and accessible from a solution.
Continue reading Profiling with Visual Studio Performance Tool

Interactive RayTracer 1: A barebone raytracer

At last, I’m starting with my first post on my attempt on Interactive RayTracing. This first one will only be on the generic global implementation.

A matrix library must be used, the same basis class will be used for each element, point or color, but with a different size (if needed). I will use a typedef for defining each of them. This will help explaining what is going on. I will not explain the code of the library, althoug the optimization of the raytracer will surely have to be done in this part of the code as well.

So a vector will be named (for the moment) Vector3df, a point Point3df, a normal Normal3df and a color Color. All elements will live in the IRT namespace.
Continue reading Interactive RayTracer 1: A barebone raytracer

Book review: C++ For Game Programmers

Some books geared toward game programming beginners tend to only scratch the surface of the presented language and of what it takes to write a game. There are some pitfalls that are specific to games that need to be addressed (or so the book says), and this is what this book is about.
Continue reading Book review: C++ For Game Programmers

Using GCCXML to automate C++ wrappers creation

GCCXML uses GCC as a front-end to parse C or C++ files. It then generates XML files for the interface, that is, it generates tags for the types and prototypes it parses. Then, pygccxml is a wrapper over it which parses the XML file to generate a Python object with every information one may need.

So I will quicly show here how it is possible to generate serialization/deserialization and then how to wrap functions with my custom serialization functions.
Continue reading Using GCCXML to automate C++ wrappers creation

Review of Intel Parallel Studio

I’ve played a little bit with Intel Parallel Studio. Let’s say it has been a pleasant trip out in the wildness of multithreaded applications.

Intel Parallel Studio is a set of tools geared toward multithreaded applications. It consists of three Visual Studio plugins (so you need a fully-fledged Visual Studio, not an Express edition):

  • Parallel Inspector for memory analysis
  • Parallel Amplifier for thread behavior and concurrency
  • Parallel Composer for parallel debugging

This is an update of the review I’ve done for the beta version. Since this first review, I’ve tried the official first version.

Continue reading Review of Intel Parallel Studio

Book review: C++ Coding Standards: 101 Rules, Guidelines, and Best Practices

There is no official C++ standard, unlike several languages (Java, Python, …) where there are referentials for code and design style, good practices, … It didn’t exist until this book where two world-renowned C++ authors set the basis for your every day development.
Continue reading Book review: C++ Coding Standards: 101 Rules, Guidelines, and Best Practices

Book review: Ultimate 3D Game Engine Design & Architecture

I bought this book as soon as it was published, and I sold it soon after. Suffice to say I had a very mitigated impression after reading it. There are good things in it, but also some very bad stuff. It doesn’t describe how to write your ultimate game engine, but the author’s game engine. What about some modesty?

Let’s start with the bad stuff.

Continue reading Book review: Ultimate 3D Game Engine Design & Architecture