Skip to content

Instantly share code, notes, and snippets.

@roxlu
roxlu / BillboardingParticles.cpp
Created June 16, 2012 23:28
Fixing wierd edges with transparent billboarded particles
void GlowiesManager::draw(const Mat4& pm, const Mat4& vm, const Vec3& right, const Vec3& up) {
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
// IMPORTANT: disable depth mask writing to prevent wierd looking edges while using transparency!
// ------------------------------------------------------------------------------------------------
glDepthMask(GL_FALSE);
for(vector<GlowiesData>::iterator git = collections.begin(); git != collections.end(); ++git) {
GlowiesData& gd = (*git);
@roxlu
roxlu / openframeworks_fbo_test.cpp
Created June 26, 2012 08:50
Raw FBO, openFrameworks
#include "testApp.h"
#include "Error.h"
//--------------------------------------------------------------
void testApp::setup(){
ofEnableNormalizedTexCoords();
ofDisableArbTex();
int w = ofGetWidth();
int h = ofGetHeight();
@roxlu
roxlu / Binnin2D.h
Created June 26, 2012 22:41
Simple templated 2D particle binning
#ifndef ROXLU_BINNING_2DH
#define ROXLU_BINNING_2DH
#include <math.h>
#include <vector>
using std::vector;
/*
@roxlu
roxlu / PointCloudCompile.sh
Created July 8, 2012 10:40
Pointcloud PCL, compile script
#!/bin/sh
# PCL version 1.5.1
# Boost 1.49
# Eigen 6e7488e20373
# Flann 1.7.1
# QHull 2012.1
# VTK 5.10.0
d=${PWD}
bd=${PWD}/build
@roxlu
roxlu / Image.cpp
Created July 9, 2012 17:48
stbi image loading, super clean png/jpg/psd/hdr loading.
#include <roxlu/experimental/Image.h>
namespace roxlu {
Image::Image()
:width(0)
,height(0)
,pixels(NULL)
{
}
@roxlu
roxlu / onb.cpp
Created July 10, 2012 08:51
Fast coordinate systems from direction vector, from Jeppe Revall Frisvad
/*
* The following source code accompanies the JGT article
*
* Building an Orthonormal Basis from a 3D Unit Vector
* Without Normalization
*
* By author: Jeppe Revall Frisvad
*
* After submitting the article to production, I found an
* improvement for my implementation of the Hughes-Moeller
@roxlu
roxlu / LightRays.cpp
Created July 16, 2012 19:04
Light Rays
#include "LightRays.h"
#include <roxlu/opengl/Error.h>
LightRays::LightRays()
:w(0)
,h(0)
,tex(0)
,fbo(0)
,depth_buffer(0)
,frag_shader(0)
@roxlu
roxlu / SnowDrawer.cpp
Created September 11, 2012 20:43
Point Sprites
#include "SnowDrawer.h"
SnowDrawer::SnowDrawer()
:allocated_vertices(500)
,vertices(allocated_vertices,SnowVertex())
,allocated_bytes(0)
,num_flakes(0)
{
}
@roxlu
roxlu / Socket.cpp
Created September 12, 2012 20:53
Basic Winsock/Posix client socket wrapper (windows/mac)
#include <roxlu/io/Socket.h>
Socket::Socket() {
#ifdef _WIN32
int result = WSAStartup(MAKEWORD(2,2), &wsa_data);
if(result != 0) {
printf("Error: cannot initialize WinSock.\n");
WSACleanup();
}
#endif
@roxlu
roxlu / main.cpp
Created November 2, 2012 09:46
OpenSSL + LibUV: client https
#include <iostream>
#include <libgen.h>
#include <openssl/ssl.h>
#include <openssl/bio.h>
#include <openssl/err.h>
#include <openssl/pem.h>
#include <uv.h>
#include <vector>
#include <iterator>
#include <algorithm>