C++ Internals :: STL vector, Part I

August 5, 2015 in C++, Programming, Uncategorized by Adrian Marius

Today is a great day to disembowel something. How’s about a well-known std::vector? You think there is nothing more you can learn about it? Believe me, you’re wrong.

In this series of three articles we are going to check:

what is std::vector and how it works (suppress a yawn)
vector’s growth factor
VC++ Debug’s “aux object”
new C++11’s methods
miscellaneous things


std::vector is the most famous sequence container in C++ world that encapsulates dynamic size arrays. Other sequence containers you might be aware of arestd::forward_list (since C++11), std::list, std::deque and std::array(since C++11). But the scope of this article is std::vector. So, let’s get started.

The items in std::vector are stored contiguously in memory:

A gentle introduction to shaders in Unity3D

June 19, 2015 in Programming by Adrian Marius

We can safely say that Unity3D has made game development easier for a lot of people. Something where it still has a long way to go is, with no doubt, shader coding. Often surrounded by mystery, a shader is a program specifically made to run on a GPU. It is, ultimately, what draws the triangles of your 3D models. Learning how to code shaders is essential if you want to give a special look to your game




shader theory

OpenGL API Documentation

June 19, 2015 in OpenGL by Adrian Marius

Here is OpenGL API Documentation



Python on Android

May 5, 2015 in Android, Programming by Adrian Marius

android-logoThere are an increasing number of resources about different ways of running Python on Android. Kivy (and its subprojects) are commonly mentioned, as one of the most mature and popular ways to do so, but one thing that gets less attention is the details of what you can do with Python itself once it’s running on the device – what are the limitations of this? Can we use any Python module? What about calling Android APIs, can we perform all of the functions of a Java application? These are all somewhat leading questions, they are things addressed by Kivy or its associated projects, and in this post I’ll summarise some of the most interesting and important details.



Modern OpenGL 08 – Even More Lighting: Directional Lights, Spotlights, & Multiple Lights

April 30, 2015 in OpenGL by Adrian Marius

In this article, we will be adding directional lights, spotlights, and allowing for multiple lights instead of just one. This is the final article on lighting – at least for a while.

Implementing Hello Triangle in Mantle

April 19, 2015 in Uncategorized by Adrian Marius

The specification and drivers for Vulkan, Khronos’ next generation graphics API, are expected to be released later this year. However, we can get a head start on learning how this new API will work by learning from the project that it evolved from: Mantle.



Nick Desaulniers – Raw WebGL

April 19, 2015 in OpenGL, Uncategorized by Adrian Marius

New web developers have trouble distinguishing jQuery from JavaScript. We frequently point developers to three.js for doing 3D on the web, but what is raw WebGL and what tools do we have for debugging 3D web applications?

Slides Here: http://nickdesaulniers.github.io/RawWebGL/#/


Collision detection (part 2)

January 19, 2015 in Programming by Adrian Marius

Last time, we discussed collision detection in general and surveyed some techniques for narrow phase collision detection.  In this article we will go into more detail on broad phase collision detection for closed axis-aligned boxes.  In the late 1970’s and early 1980’s, this problem attracted an enormous amount of attention due to its applications in VLSI design, resulting in many efficient algorithms and data structures.  Here we survey some of the general approaches to this problem and review some analytical results.

by admin

Accessing C++11 Features of the Android NDK

January 13, 2015 in Android, C++, Programming, Tips & Tricks, Tutorial by admin

android-logoSource here

Once you start working with some of the handy new C++11 features, it is a bit difficult to stop using them simply because you want to work on an Android project. Fortunately, the Android NDK supports C++11 features, although they are not enabled by default. The default Android NDK configuration provides only a minimal C++ runtime support library and doesn’t include the necessary flags to activate available C++11 features. In this article, I explain how set up a project to use C++11 features, relying on Eclipse and the latest available Android NDK, version r9d.

Consider a very common scenario in which you want to create a new Android app by reusing existing C++ code. In these cases, a typical solution is to develop the UI in Java and use the Java Native Interface (JNI) to make calls to the C++ code from Java (and the other way around if necessary). If your existing C++ code has been written taking advantage of C++11 features, you certainly would not want to create a new version removing all these C++11 features just to make it fit with the default Android NDK configuration. Fortunately, you can activate the NDK’s C++11 features to allow you to work with modern C++ amenities, and you can go on using the auto keyword, lambda expressions, and other useful C++11 features.

I’ll assume that you have basic experience working with Eclipse, Android Development Tools (ADT), and the Android NDK; hence, I won’t provide specific instructions for the basic setup of these tools. You will need ADT and NDK installed on your system in order to test the examples. Because ADT and NDK have important changes in each new release, it’s important to note that I am using ADT Build v22.6.2-1085508 and NDK Revision 9d. This way, I can focus on the necessary configurations and tweaks related to C++11 and the related features. I’ll use a simple example Android app that employs a few C++11 features combined with some use of the Standard Templates Library (STL). Finally, I’ll explain additional options and configurations that you might need to consider.”

For the entire article, follow this link.

by admin

Strategies for Implementing POSIX Condition Variables on Win32

January 12, 2015 in C, Linux, Programming, Source Code, Tips & Tricks, Windows by admin

c++In case one’s interested in cross-platform development, here is a nice article about various strategies of implementing POSIX condition variables on Win32. Quoting from the article:

The threading API provided by the Microsoft Win32 [Richter] family of operating systems (i.e., Windows NT, Windows ’95, and Windows CE) provides some of the same concurrency constructs defined by the POSIX Pthreads specification [Pthreads]. For instance, they both support mutexes, which serialize access to shared state. However, Win32 lacks full-fledged condition variables, which are a synchronization mechanism used by threads to wait until a condition expression involving shared data attains a particular state.

The lack of condition variables in Win32 makes it harder to implement certain concurrency abstractions, such as thread-safe message queues and thread pools. This article explores various techniques and patterns for implementing POSIX condition variables correctly and/or fairly on Win32. Section 2 explains what condition variables are and shows how to use them. Secion 3 explains alternative strategies for implementing POSIX condition variables using Win32 synchronization primitives. A subsequent article will describe how the Wrapper Facade pattern and various C++ language features can help reduce common mistakes that occur when programming condition variables.

For the entire article, follow this link.
Source: http://www.cs.wustl.edu/~schmidt/win32-cv-1.html

Skip to toolbar