Skip to content

Instantly share code, notes, and snippets.

@roxlu
roxlu / H264_Decoder.cpp
Created March 3, 2014 16:57
LibAV parser and decoder example with openGL (YUV420 -> RGB shader).
#include "H264_Decoder.h"
H264_Decoder::H264_Decoder(h264_decoder_callback frameCallback, void* user)
:codec(NULL)
,codec_context(NULL)
,parser(NULL)
,fp(NULL)
,frame(0)
,cb_frame(frameCallback)
,cb_user(user)
@roxlu
roxlu / primitive-restart.cpp
Created January 16, 2018 09:56
Basic example of using primitive restart
/*
---------------------------------------------------------------
oooo
'888
oooo d8b .ooooo. oooo ooo 888 oooo oooo
'888""8P d88' '88b '88b..8P' 888 '888 '888
888 888 888 Y888' 888 888 888
888 888 888 .o8"'88b 888 888 888
@roxlu
roxlu / GridDrawer.cpp
Created March 5, 2013 12:42
Probably the most basic example of using Texture Buffer Objects (TBOs) with openGL
#include "GridDrawer.h"
#include "Grid.h"
GridDrawer::GridDrawer(Grid& grid)
:grid(grid)
,grid_prog(0)
,grid_vbo(0)
,grid_vao(0)
,u_projection_matrix(0)
{
@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>
@roxlu
roxlu / Connection.h
Created June 4, 2012 12:52
Basic libEvent TCP server/client wrapper
#ifndef LIBEVENT_CONNECTIONH
#define LIBEVENT_CONNECTIONH
extern "C" {
#include <event2/event.h>
#include <event2/buffer.h>
#include <event2/bufferevent.h>
}
#include <string>
@roxlu
roxlu / install_cygwin_sshd.txt
Last active November 27, 2023 22:20
Installing CYGWIN + SSHD for remote access through SSH on windows
Installing CYGWIN with SSH
1) Download cygwin setup.exe from http://www.cygwin.com
- Execute setup.exe
- Install from internet
- Root directory: `c:\cygwin` + all users
- Local package directory: use default value
- Select a mirror to download files from
- Select these packages:
- editors > xemacs 21.4.22-1
- net > openssh 6.1-p
@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)
{
}
// Transfer characteristics (bits 5 downto 4 of Byte 2) is set to HLG (1h).
// Other values set are only used for testing purposes and do not conform to any spec!
unsigned char cFrameDataVpid[] =
{
0xAA, 0xD0, 0x00, 0x00,
};
std::vector<unsigned char> FrameDataVpid(cFrameDataVpid,
&cFrameDataVpid[sizeof(cFrameDataVpid)/sizeof(cFrameDataVpid[0])]);
@roxlu
roxlu / v2.cpp
Created March 23, 2020 13:52
OpenMAX experimenting
/*
2020 OPENMAX TEST V2
====================
LOG:
2020-03-21:
I started to cleanup this code a bit; it's still work in
@roxlu
roxlu / CMakeLists.txt
Last active March 9, 2023 07:11
CMake example that shows how you can build Freetype2 with support for Harfbuzz and Harfbuzz with support for Freetype2. This example uses ExternalProject which is the standard way to include external dependencies. Note that we have to patch Freetype2 and Harfbuzz because their CMakelists are not fully CMake compatible (still depend on pkg-config…
# This CMake file will build Freetype and Harfbuzz as external
# projects. We follow the build description as described here:
# https://sourceforge.net/projects/freetype/files/freetype2/2.5.3/ So,
# first we build Freetype2 w/o Harfbuzz, then we build Harfbuzz with
# freetype support after which we rebuild Freetype2 again.
#
# Both CMake files of Freetype2 and Harfbuzz are depending on
# pkg-config to find the dependencies for both projects. I've
# included a patch for Freetype2 and Harfbuzz which allows you to
# build Freetype2 and Harbuzz with pure CMake features. So I removed