Skip to content

Instantly share code, notes, and snippets.

View tgfrerer's full-sized avatar

Tim Gfrerer tgfrerer

View GitHub Profile
@tgfrerer
tgfrerer / cardan_angles.cpp
Created March 21, 2014 09:17
Caclucate Nautical = Cardan angles.
//--------------------------------------------------------------
/**
* @brief Returns Cardan = roll/pitch/yaw angles for the given
* rotation.
*
* @param q_ an ofQuaternion (unit quaternion) denoting a rotation.
*
* @details Cardan Angles == Tail-Bryan-A. == Nautical-A. == Euler
* Angle Sequence 1,2,3.
@tgfrerer
tgfrerer / pollkeys.cpp
Created April 17, 2014 18:00
how to poll keys from a windows openFrameworks console window
void ofApp::pollKeys(){
HANDLE hStdInput = GetStdHandle(STD_INPUT_HANDLE);
DWORD events = 0; // how many events took place
INPUT_RECORD input_record; // a record of input events
DWORD input_size = 1; // how many characters to read
// we use peek so that this is non-blocking.
BOOL peek = PeekConsoleInput(hStdInput, &input_record, input_size, &events);
@tgfrerer
tgfrerer / ofMesh_load.cpp
Created April 24, 2014 16:33
ofMesh::load (modified to deal with more general .ply files)
//--------------------------------------------------------------
void ofMesh::load(string path){
ofFile is(path, ofFile::ReadOnly);
ofMesh& data = *this;
string line;
string error;
ofBuffer buffer(is);
ofMesh backup = data;
@tgfrerer
tgfrerer / main.cpp
Last active August 29, 2015 14:05
ofTexture::mipmap test project - press key to toggle mipmaps on/off
#include "ofMain.h"
class ofApp : public ofBaseApp{
ofCamera mCam1;
ofTexture mTex1;
public:
void setup() {
//mTex1.enableMipmap(); ///< auto-generate mipmap whenever ofTexture updates it's image data.
@tgfrerer
tgfrerer / main.cpp
Last active August 29, 2015 14:05
test case : programmable GL renderer does not transform "vanilla" meshes.
#include "ofMain.h"
class ofApp : public ofBaseApp{
ofEasyCam mCam1;
ofVboMesh mMshBackground;
public:
void setup(){
@tgfrerer
tgfrerer / meshGenerator.cpp
Created September 12, 2014 15:28
square mesh generator
void generateMesh () {
int cMeshWidth = 200; // mesh dimensions
int cMeshHeight = 200;
// setup mesh
vector<ofVec3f> vertices;
vector<ofIndexType> indices;
@tgfrerer
tgfrerer / main.cpp
Created October 2, 2014 16:08
opengl optimisations testcase
#include "ofMain.h"
class ofApp : public ofBaseApp{
ofVboMesh mMshSphere;
ofCamera mCam1;
public:
void setup(){
#include "ofMain.h"
class ofApp : public ofBaseApp{
ofMesh box;
public:
void setup(){
box = ofBoxPrimitive().getMesh();
};
@tgfrerer
tgfrerer / main.cpp
Created January 31, 2015 01:01
test project for #3598
#include "ofMain.h"
class ofApp : public ofBaseApp{
public:
ofFbo mFbo;
ofFbo mFbo1;
ofFbo mFbo2;
@tgfrerer
tgfrerer / main.cpp
Created April 7, 2015 10:33
Minimal test case for issue #3747
#include "ofMain.h"
class ofApp : public ofBaseApp{
ofVboMesh testMesh;
ofEasyCam mCam1;
public: