Skip to content

Instantly share code, notes, and snippets.

View paulhoux's full-sized avatar
🏠
Working from home

Paul Houx paulhoux

🏠
Working from home
View GitHub Profile
@paulhoux
paulhoux / AppImplMswBasic.cpp
Created November 5, 2011 03:57
Cinder: improved frame rate and low CPU usage on Windows PC's
/*
Copyright (c) 2010, The Barbarian Group
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that
the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions and
the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
@paulhoux
paulhoux / Frustum.cpp
Created January 15, 2012 03:34
Additions to Cinder to facilitate frustum culling
/*
Copyright (c) 2012, Paul Houx
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that
the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions and
the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
@paulhoux
paulhoux / colorwheel.cpp
Created October 30, 2015 00:02
Fix for NanoGui's ColorWheel::adjustPosition() method.
ColorWheel::Region ColorWheel::adjustPosition(const ivec2 &p, Region consideredRegions)
{
float x = p.x - mPos.x, y = p.y - mPos.y, w = mSize.x, h = mSize.y;
float cx = w*0.5f;
float cy = h*0.5f;
float r1 = (w < h ? w : h) * 0.5f - 5.0f;
float r0 = r1 * .75f;
x -= cx;
@paulhoux
paulhoux / SignalsApp.cpp
Last active December 20, 2015 00:38
Example of using signals and slots with derived classes. Sample made for Cinder. Simply create an empty Cinder application called "Signals" using TinderBox, then replace the contents of ```SignalsApp.cpp``` with this code.
#define _SCL_SECURE_NO_WARNINGS
#include "cinder/app/AppNative.h"
#include "cinder/gl/gl.h"
using namespace ci;
using namespace ci::app;
using namespace std;
//--------------------------
@paulhoux
paulhoux / PointOnSphereApp.cpp
Last active December 22, 2015 08:09
Example of how to place objects at the surface of a sphere with the correct axes. Created in response to https://forum.libcinder.org/#Topic/23286000001779023 .
#include "cinder/app/AppNative.h"
#include "cinder/gl/gl.h"
#include "cinder/Camera.h"
#include "cinder/MayaCamUI.h"
using namespace ci;
using namespace ci::app;
using namespace std;
class PointOnSphereApp : public AppNative {
@paulhoux
paulhoux / CamAndGridApp.cpp
Last active December 28, 2015 17:29
Shows how to setup a camera, render a grid and control the camera using a mouse.
#include "cinder/app/AppNative.h"
#include "cinder/gl/gl.h"
#include "cinder/Camera.h"
#include "cinder/MayaCamUI.h"
using namespace ci;
using namespace ci::app;
using namespace std;
@paulhoux
paulhoux / DebugMesh.cpp
Created January 24, 2014 22:55
Test application for the Cinder framework, showing that recalculated normals (based on the average of all connected triangle faces) is just as precise as the original normals (calculated from sphere mathematics).
#include "DebugMesh.h"
using namespace ci;
using namespace ci::geom;
using namespace std;
DebugMesh::DebugMesh(void)
{
enable( Attrib::POSITION );
enable( Attrib::COLOR );
@paulhoux
paulhoux / QuadCircle.cpp
Last active January 23, 2016 06:52
Circle of Quads
#include "cinder/app/App.h"
#include "cinder/app/RendererGl.h"
#include "cinder/gl/gl.h"
#include "cinder/Camera.h"
#include "cinder/CameraUi.h"
#include "cinder/ip/Checkerboard.h"
using namespace ci;
using namespace ci::app;
@paulhoux
paulhoux / YourApp.cpp
Last active May 14, 2016 20:25
Semi-Circle Example (with shader).
#include "cinder/app/App.h"
#include "cinder/app/RendererGl.h"
#include "cinder/gl/gl.h"
using namespace ci;
using namespace ci::app;
using namespace std;
class YourApp : public App {
public:
@paulhoux
paulhoux / AudioShaderApp.cpp
Last active March 2, 2018 13:19
Adaptation of ShaderToy's AudioSurf shader for Cinder. Actual audio data is replaced with random noise to keep it simple. I kept the original shader code without making any changes. Note that ```iResolution``` must be passed as a Vec3f.
#include "cinder/app/AppNative.h"
#include "cinder/gl/gl.h"
#include "cinder/gl/GlslProg.h"
#include "cinder/gl/Texture.h"
#include "cinder/Rand.h"
using namespace ci;
using namespace ci::app;
using namespace std;