Skip to content

Instantly share code, notes, and snippets.

@roxlu
roxlu / gist:1068050
Created July 6, 2011 19:01
ofThead blocking does not work
// simple thread class
class MyCustomThread : public ofThread {
protected:
virtual void threadedFunction() {
while(true) {
cout << "My own custom thread!" << endl;
ofSleepMillis(3000);
}
}
};
@roxlu
roxlu / oflogging.cpp
Created July 6, 2011 21:04
Testing of logging
// Check 1.
//ofLogToFile("of.log");
ofSetLogLevel(OF_LOG_VERBOSE);
ofLog(OF_LOG_VERBOSE,"log something");
ofLog(OF_LOG_VERBOSE,"Something to log");
ofLog(OF_LOG_VERBOSE,"Something else to log");
/*
Output of Check 1:
OF: OF_VERBOSE: log something
//----------------------------------------
void ofLight::setAmbientColor(const ofFloatColor& c) {
if(glIndex==-1) return;
ambientColor = c;
glLightfv(GL_LIGHT0 + glIndex, GL_AMBIENT, &c.r);
}
//----------------------------------------
void ofLight::setDiffuseColor(const ofFloatColor& c) {
if(glIndex==-1) return;
#include "testApp.h"
void testApp::setup(){
ofBackground(33,33,33);
light.enable();
// light.setDirectional();
// light.setSpotlight(45.0, 0.2f);
light.setPointLight();
#include "testApp.h"
#include "ofMaterial.h"
void testApp::setup(){
ofBackground(33,33,33);
my_fbo.allocate(ofGetWidth(),ofGetHeight());
ofEnableNormalizedTexCoords();
}
void testApp::draw(){
// testapp.h
class testApp : public ofBaseApp{
public:
ofVideoGrabber my_grabber;
void setup();
void update();
void draw();
//! \p detail can be between 0 ( = icosahedron) and 8 (extremely detailed sphere)
//! a value of 2 yelds already very good results.
ref<Geometry> vl::makeIcosphere(const vec3& pos, Real diameter, int detail, bool remove_doubles)
{
ref<Geometry> geom = new Geometry;
geom->setObjectName("Icosphere");
ref<ArrayFloat3> coords = new ArrayFloat3;
ref<ArrayFloat3> norms = new ArrayFloat3;
GL_ZERO -> GL_ZERO
GL_ZERO -> GL_ONE
GL_ZERO -> GL_SRC_COLOR
GL_ZERO -> GL_ONE_MINUS_SRC_COLOR
GL_ZERO -> GL_DST_COLOR
GL_ZERO -> GL_ONE_MINUS_DST_COLOR
GL_ZERO -> GL_SRC_ALPHA
GL_ZERO -> GL_ONE_MINUS_SRC_ALPHA
GL_ZERO -> GL_DST_ALPHA
GL_ZERO -> GL_ONE_MINUS_DST_ALPHA
#include "BlendModeTester.h"
#include "error.h"
BlendModeTester::BlendModeTester()
:is_initialized(false)
,num_tex(1)
,curr_mode(0)
,page(0)
,item(0)
{
vector<ofVec3f> bottom;
vector<ofVec3f> top;
for(float i = 0; i < 10; ++i) {
float a = (i/10) * TWO_PI;
float x = cos(a) * 5;
float z = sin(a) * 5;
ofVec3f vec(x,0,z);
mesh.addVertex(vec);
verts.push_back(vec);
}