Skip to content

Instantly share code, notes, and snippets.

Avatar

@roxlu ☾ roxlu

View GitHub Profile
@roxlu
roxlu / gist:1068050
Created Jul 6, 2011
ofThead blocking does not work
View gist:1068050
// 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 Jul 6, 2011
Testing of logging
View oflogging.cpp
// 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
View ofLight.cpp
//----------------------------------------
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;
View gist:1075588
#include "testApp.h"
void testApp::setup(){
ofBackground(33,33,33);
light.enable();
// light.setDirectional();
// light.setSpotlight(45.0, 0.2f);
light.setPointLight();
View testApp.cpp
#include "testApp.h"
#include "ofMaterial.h"
void testApp::setup(){
ofBackground(33,33,33);
my_fbo.allocate(ofGetWidth(),ofGetHeight());
ofEnableNormalizedTexCoords();
}
void testApp::draw(){
View app.cpp
// testapp.h
class testApp : public ofBaseApp{
public:
ofVideoGrabber my_grabber;
void setup();
void update();
void draw();
View sphere.cpp
//! \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;
View gist:1082525
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
View blender.cpp
#include "BlendModeTester.h"
#include "error.h"
BlendModeTester::BlendModeTester()
:is_initialized(false)
,num_tex(1)
,curr_mode(0)
,page(0)
,item(0)
{
View gist:1083300
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);
}
You can’t perform that action at this time.