Skip to content

Instantly share code, notes, and snippets.

View BlockoS's full-sized avatar
💭
🧙⚔️💾

MooZ BlockoS

💭
🧙⚔️💾
View GitHub Profile
@BlockoS
BlockoS / gl_init.c
Created October 28, 2011 20:42
gl init
union
{
struct
{
PFNGLATTACHSHADERPROC AttachShader;
PFNGLCOMPILESHADERPROC CompileShader;
PFNGLCREATEPROGRAMPROC CreateProgram;
PFNGLCREATESHADERPROC CreateShader;
PFNGLDELETEPROGRAMPROC DeleteProgram;
PFNGLDELETESHADERPROC DeleteShader;
@BlockoS
BlockoS / vao_test.c
Created November 14, 2011 15:04
Vao Example
// init
glGenVertexArrays(1, &fullscreenTriangleVAO);
glBindVertexArray(fullscreenTriangleVAO);
glEnableVertexAttribArray(0);
glEnableVertexAttribArray(1);
glBindBuffer(GL_ARRAY_BUFFER, fullscreenTriangleFBO);
glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 0, 0);
glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 0, (GLvoid*)(6*sizeof(GLfloat)));
glBindBuffer(GL_ARRAY_BUFFER, 0);
gl.BindVertexArray(0);
@BlockoS
BlockoS / clearColor.asm
Created November 29, 2011 16:33
glClearColor call
; 426 : glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
fldz
sub esp, 16 ; 00000010H
fst DWORD PTR [esp+12]
fst DWORD PTR [esp+8]
fst DWORD PTR [esp+4]
fstp DWORD PTR [esp]
call DWORD PTR __imp__glClearColor@16
@BlockoS
BlockoS / callback.cpp
Created December 13, 2011 21:06
Callback deluxe
class Callback
{
public:
Callback() {}
virtual ~Callback();
virtual void onMouseMove(int x, int y) = 0;
};
template <typename T>
@BlockoS
BlockoS / itoa10.c
Created December 28, 2011 18:46
itoa base 10
inline int Stringify(int value, char* buffer, int bufferLen)
{
int i = bufferLen-1, tmp;
char *ptr = buffer, c;
for(; value && i; --i)
{
tmp = value;
value/=10;
*ptr++ = "9876543210123456789"[9 + tmp - value*10];
@BlockoS
BlockoS / serialServer.pde
Created February 25, 2012 19:47
Stupid synchronous serial server for Arduino
#include <util/atomic.h>
#define CH_NUL 0x00
#define CH_BACKSPACE 0x08
#define CH_CANCEL 0x18
#define CH_SUBSTITUTE 0x1a
#define CH_ESCAPE 0x1b
#define CH_SPACE 0x20
#define CH_CSI 0x9b
#define CH_ST 0x9c
@BlockoS
BlockoS / scanJSR7D98.pl
Created March 11, 2012 21:40
Search for the 2 bytes preceding the jsr 7d98 instruction in a PC Engine rom.
#!/usr/bin/perl -w
use strict;
use File::stat;
die "You must specify a rom name!" unless ($#ARGV == 0);
my $rom = 0;
my $fileSize = stat($ARGV[0])->size;
open(FILE, "<$ARGV[0]") or die $!;
@BlockoS
BlockoS / BufferObject.cpp
Created April 17, 2012 20:52 — forked from StonedXander/Makefile
Some VBO Stuff
#include "BufferObject.h"
BufferObject::BufferObject() :
_id(0),
_target(GL_NONE),
_size(0),
_usage(0)
{}
BufferObject::~BufferObject() {}
// Fractional Brownian motion
float fBm(const glm::vec3 pos, const int octaveCount, float lacunarity, float gain )
{
float noiseSum = 0.0;
float amplitude = 1.0;
float amplitudeSum = 0.0;
glm::vec3 sample = pos;
for( int i = 0; i < octaveCount; ++i )
@BlockoS
BlockoS / ed_sd.asm
Last active October 7, 2015 23:18
Turbo Everdrive SD card interface
;;---------------------------------------------------------------------
; Turbo-Everdrive SD card library
;;---------------------------------------------------------------------
SPI_SS = 0
SPI_FULL_SPEED = 1
SPI_AREAD = 2
STATE_SPI = 0
STATE_RY = 1
STATE_FIFO_WR = 2