Skip to content

Instantly share code, notes, and snippets.

View tgfrerer's full-sized avatar

Tim Gfrerer tgfrerer

View GitHub Profile
@tgfrerer
tgfrerer / gist:77cbd9e2a60acc95ee1f
Created June 18, 2015 12:01
keypress oF testcase
#include "ofMain.h"
class ofApp : public ofBaseApp {
public:
void keyPressed(int key) {
ofLogNotice() << "key press : " << std::setw(3) << key;
};
Generating code
1>c:\users\dominic\desktop\openframeworks\scripts\apothecary\build\cairo-vs\pixman\pixman\pixman-mmx.c(512): warning C4799: function 'is_opaque' has no EMMS instruction
1>c:\users\dominic\desktop\openframeworks\scripts\apothecary\build\cairo-vs\pixman\pixman\pixman-mmx.c(501): warning C4799: function 'is_equal' has no EMMS instruction
1>c:\users\dominic\desktop\openframeworks\scripts\apothecary\build\cairo-vs\pixman\pixman\pixman-mmx.c(586): warning C4799: function 'expand_4xpacked565' has no EMMS instruction
1>c:\users\dominic\desktop\openframeworks\scripts\apothecary\build\cairo-vs\pixman\pixman\pixman-mmx.c(284): warning C4799: function 'to_uint64' has no EMMS instruction
1>c:\users\dominic\desktop\openframeworks\scripts\apothecary\build\cairo-vs\pixman\pixman\pixman-mmx.c(518): warning C4799: function 'is_zero' has no EMMS instruction
1>c:\users\dominic\desktop\openframeworks\scripts\apothecary\build\cairo-vs\pixman\pixman\pixman-mmx.c(490): warning C4799: function 'store8888' has no EMMS
@tgfrerer
tgfrerer / utils.glsl
Last active August 29, 2015 14:24
utility methods for GLSL
// ------------------------------------------------------------
// Math
// ------------------------------------------------------------
float map(in float val_, in float range_min_, in float range_max_, in float min_, in float max_){
return ( min_ + ((max_ - min_)/(range_max_ - range_min_)) * clamp(val_, range_min_, range_max_));
}
vec2 map(in vec2 val_, in vec2 range_min_, in vec2 range_max_, in vec2 min_, in vec2 max_){
return ( min_ + ((max_ - min_)/(range_max_ - range_min_)) * clamp(val_, range_min_, range_max_));
@tgfrerer
tgfrerer / main.cpp
Created August 24, 2015 22:03
test case for include parser for ofShader PR
//
// main.cpp
// testTokenise
//
// Created by tgfrerer on 23/08/2015.
// Copyright © 2015 pal. All rights reserved.
//
#include <iostream>
#include <string>
@tgfrerer
tgfrerer / output
Last active October 15, 2015 09:48
Testing the construction / destruction order of cpp objects.
construct: a
construct: b
destruct: a
@tgfrerer
tgfrerer / ofTexture.cpp (lines 1042 to 1053)
Last active December 15, 2015 03:49
flipped vertex draw order to check if that un-messes texture coordinate problems with NVIDIA cards whilst keeping it sane for everyone else =)
ofPushMatrix();
ofTranslate(x,y,z);
quad.getVertices()[0].set(px0,py0);
quad.getVertices()[1].set(px1,py0);
quad.getVertices()[3].set(px0,py1); // flipped
quad.getVertices()[2].set(px1,py1); // flipped
quad.getTexCoords()[0].set(tx0,ty0);
quad.getTexCoords()[1].set(tx1,ty0);
if(bUsingTexCoords) {
glBindBuffer(GL_ARRAY_BUFFER, texCoordId);
ofEnableTexCoords();
if(ofGLIsFixedPipeline()){
glTexCoordPointer(2, GL_FLOAT, texCoordStride, 0);
}else{
glVertexAttribPointer(ofGetAttrLocationTexCoord(), 2, GL_FLOAT, GL_FALSE, texCoordStride, 0);
}
}
@tgfrerer
tgfrerer / gist:5262377
Created March 28, 2013 11:03
opengl profiler log
glEnableVertexAttribArray(2)
Error: GL_INVALID_OPERATION
Context: 0x058a5600
Virtual Screen: 0/2
kCGLCPCurrentRendererID: 16915206 (0x01021b06)
GL_RENDERER: AMD Radeon HD 6750M OpenGL Engine
GL_VENDOR: ATI Technologies Inc.
GL_VERSION: 3.2 ATI-1.6.37
kCGLCPGPUFragmentProcessing: GL_TRUE
kCGLCPGPUVertexProcessing: GL_TRUE
=================== config.mk platform detection ================
PLATFORM_ARCH=armv6l
PLATFORM_OS=Linux
PLATFORM_VARIANT=default
PLATFORM_LIB_SUBPATH=linuxarmv6l
=================== config.mk paths =============================
OF_ADDONS_PATH=../../../addons
OF_EXPORT_PATH=../../../export
OF_EXAMPLES_PATH=../../../examples
OF_APPS_PATH=../../../apps
@tgfrerer
tgfrerer / gist:5788384
Created June 15, 2013 14:49
build flags for GLFW 3.0 / openFrameworks OS X 32 bit
compiled using these flags:
# cmake ../ -DGLFW_USE_CHDIR=0 -DGLFW_USE_MENUBAR=1 -DBUILD_SHARED_LIBS=0 -DGLFW_BUILD_EXAMPLES=0 -DGLFW_BUILD_TESTS=0 -DGLFW_BUILD_UNIVERSAL=0 -DCMAKE_OSX_ARCHITECTURES=i386 -DCMAKE_{C,CXX}_FLAGS=-m32
# make -j