Skip to content

Instantly share code, notes, and snippets.

@roxlu
roxlu / fun.cpp
Last active August 29, 2015 14:19 — forked from kizzx2/fun.cpp
THIS DOES NOT WORK WITH 5.2
// fun.cpp
extern "C"
{
#include <lua.h>
#include <lauxlib.h>
#include <lualib.h>
}
#include <iostream>
@roxlu
roxlu / compile.sh
Created December 28, 2014 18:03
Apache, PHP and MySQL build script for Mac 10.10
#!/bin/bash
d=${PWD}
sd=${d}/sources
bd=${d}/build
id=${d}/installed/
PATH_ORIG=${PATH}
CC_ORIG=${CC}
CPP_ORIG=${CPP}
MODULE Server
PERS tooldata myTool:=[TRUE,[[0,0,1],[1,0,0,0]],[1,[0,0,0.1],[1,0,0,0],0,0,0]];
TASK PERS wobjdata myWobj:=[FALSE,TRUE,"",[[400,0,400],[1,0,0,0]],[[0,0,0],[1,0,0,0]]];
!CONST robtarget myRobtarget:=[[0,0,0],[0.707107,0,0.707107,0],[0,0,0,0],[9E9,9E9,9E9,9E9,9E9,9E9]];
VAR robtarget myRobtarget:=[[0,0,0],[1,0,0,0],[0,0,0,0],[9E9,9E9,9E9,9E9,9E9,9E9]];
VAR socketdev server_socket;
VAR socketdev client_socket;
PROC main()
! SocketCreate server_socket;
dding: 422.593750, 34.640625
Adding: 422.593750, 36.640625
Adding: 422.593750, 41.863281
Adding: 422.593750, 49.175781
Adding: 422.593750, 66.929688
Adding: 422.593750, 75.285156
Adding: 422.593750, 84.687500
Adding: 422.593750, 93.042969
Adding: 422.593750, 100.355469
Adding: 422.593750, 110.101562
@roxlu
roxlu / Encoding.cpp
Created October 22, 2014 18:17
Fix for return value -12780 when calling VTCompressionSessionEncodeFrame(). You need to pass the `nbytes` into the `CVPixelBufferCreateWithPlanarBytes()` function otherwise you'll get this return value.
#include "Encoding.h"
/* ------------------------------------------------------------------- */
static void output_callback(void* outputCallbackRefCon,
void* sourceFrameRefCon,
OSStatus status,
VTEncodeInfoFlags infoFlags,
CMSampleBufferRef sampleBuffer);
@roxlu
roxlu / CMakeLists.txt
Created September 26, 2014 12:55
Work in progress, simple cross platform mutex and threading code
cmake_minimum_required(VERSION 2.8.11)
set(bd ${CMAKE_CURRENT_LIST_DIR})
set(id ${bd})
include_directories(${id})
add_executable(test_thread test_thread.cpp)
if (WIN32)
@roxlu
roxlu / build_unix_dependencies.sh
Last active June 4, 2020 01:57
Mac / Linux build script for open source libraries. Feel free to contact me http://www.twitter.com/roxlu for additions of fixes.
#!/bin/bash
# ----------------------------------------------------------------------- #
# I N F O
# ----------------------------------------------------------------------- #
#
#
# ********************************************************************** *
#
# Get the latest version of this file from:
@roxlu
roxlu / opengl_wrappers.c
Last active March 18, 2018 16:05
A couple of wrappers for opengl which are handy when you want to provide some openGL features in your library. Simply embed these into your cpp file. (Note that your executable will become slightly bigger because of this.)
/*
See https://gist.github.com/roxlu/6152fccfdd0446533e1b for the latest version.
Author: roxlu
Twitter: http://www.twitter.com/roxlu
*/
/* ------------------------------------------------------------------------*/
@roxlu
roxlu / AsyncUpload.cpp
Last active April 26, 2019 09:44
Experimental code to test fast pixel transfers using PBOs.
#include <gfx/AsyncUpload.h>
namespace gfx {
AsyncUpload::AsyncUpload()
:width(0)
,height(0)
,dx(0)
,channels(0)
,n(0)
@roxlu
roxlu / test_fex_load_image.cpp
Created August 22, 2014 13:22
Examples on how to load + reuse memory using rx_load_png and rx_load_jpg
/*
test_fex_load_image
-------------------
Plain test which loads + reloads a couple of images and reallocating the
previously allocated buffer when needed. Just a tiny test to speed up
the image loading process.
*/