Tag Archives: c++

QuadDistrust

onedayitwillmake No Comments

This is a project I recently created for an installation. It uses the kinect to place the user into a world that has many particles in it – and they basically interact with the particles which are also being influenced by some perlin noise.

It was a spin off of my previous project, CinderRibbons which I never finished because it was getting a little too out of hand.
For this project my goal was simple: Quads influenced by a 3d mapped human skeleton, and perlin noise
I figured that if i scaled down my previous goal, and made it something that was actually attainable i would actually be able to finish the project.

I also decided to put the project on Github, however the code inside is rather messy because as the installation deadline got closer I had to make some, ahem sacrifices. I was actually coding and changing it up until 1 minute before the performer started her dance, while my computer was already hooked up to the projector. That part was pretty frantic.

Here are some images, they are sort of in chronological order, sort of:

Initial “get something on the screen”

Creating a floor plane:


Making quads ‘rise’ from the floor plane

Now add some beautiful perlin noise (Actually this is simplex noise technically)

 

The view from above:

 

All hail the glowing cube:

 

User controlled gravity swarms using the kinect skeleton data mapped back into 3d space:

Project Source Code

https://github.com/onedayitwillmake/QuadDistrust

Debugging Cinder Application with EclipseLovesCinder template

onedayitwillmake No Comments

Working on a project at work, and at at home is a good way to re-enforce processes needed to get up and running as well as exposing cracks in your setup.

In this case it was my Eclipse Loves Cinder template
I followed my own instructions to get Eclipse up and running with Cinder C++ framework.
Then I noticed when I went to debug i was not sure what to do.

I had set it up at home, but it was very much a trial and error excercise so once it finally functioned correctly – i was not sure exactly what it was that I did that got it to work.

EclipseLovesCinder after running a build, executes a python script which creates an “Application Bundle” for your application so it looks and feels more like an OSX Application. Copying all files from ‘resources’ into the application’s resources bundle, if they have been modified since last time or did not exist.

An ApplicationBundle is actually just a collection of folders following a specific structure, this page helped me figure out how to create one http://www.eclipse.org/swt/macosx/

The second problem was getting debug to work which is probably as important as being able to create the application otherwise – good luck making anything besides HelloWorld.

Getting GDB (Debugger) to work:

  • Select the debug, bug icon and – actually select the little arrow next to it.
  • Select Debug Configurations
  • Select C/C++ Application and click the “new” icon (looks like paper)
  • Where it shows the application under "C / C++ Application" select browse, and browse to “bin/HelloEclipse.app"
  • Append Contents/MacOS/HelloEclipse at the end of that, because eclipse actually wants the binary not the psuedo-application directory

After that, you should be able to select debug, and if it worked it will stop on a break point at the launch of Main.
You can turn that off if you like, sometimes i do, by going to the “Debugger” tab in the options.

While a bit tedious – you only have to do it once so it’s not so bad.

Here’s the result of hitting a breakpoint. Callstack on the left, variables on the right.
debugger

Using Eclipse with Cinder – A better c++ editor

onedayitwillmake 10 comments

I was really having a hard time with Xcode lately, specifically how its C++ code-completion leaves much to be desired especially if you have a very bad memory. I find myself constantly painfully looking through the header files to find the exact name/case of a function or property.

So I decided to try and see If i could get up and running with Cinder in Eclipse instead, it wasn’t too bad either !!! Just a couple of issues getting the linking right, but that was about it.

Download / Github


Xcode is a great IDE, however it is not great at C++ editing

It provides only very barebones syntax highlighting, even more barebones code completion, and no edit-time error checking.

Cinder is a great library, but it’s very vast – Without code-completion I was very lost/ nearly all the time poking through the header files and opening the .cpp files in other editors so I could learn it more thouroughly.

(Re)-Enter EclipseIDE for C++

This project is presented as is for anyone else who would like to use a C++ editor on osx that is actually aware of your classes.
From what I’ve used it so far, it is much better – but compile times are a little slower, however the time you save while editing is well worth it imo.

Usage

  1. http://www.eclipse.org/downloads/packages/eclipse-ide-cc-developers/heliossr2
  2. Download this project
  3. Import into eclipse workspace (select import existing project in the ‘general’ drop down)
  4. In terminal browse to the projects path and create a symbolic link named ‘CINDER_PATH_LINK’ to where cinder is located
    1. “ln -s foo/bar CINDER_PATH_LINK”
    2. Where ‘foo/bar’ is the path to Cinder such as ‘~/GIT/LIBRARY/CINDER’
  5. [Optional] – RightClick project root, select properties
    1. Select C/C++ Build
    2. Select Settings
    3. Replace ‘g++’ with ‘clang++’ and ‘gcc’ with ‘clang’ for the:
      • MacOS X C++ Linker
      • GCC C++ Compiler
      • GCC C Compiler
    • [Optional] Do the same for the discovery tab
  6. After hitting, apply/ok and closing that window select Project->Build All and project should build successfully.

Screenshots

Debugger / Hitting a breakpoint

Editor

OpenNIStarterKit Block

Editor

Better syntax highlighting, and code sense

Editor