Skip to content

Instantly share code, notes, and snippets.

View tomaka's full-sized avatar

Pierre Krieger tomaka

  • Freelance
  • Berlin, Germany
View GitHub Profile
@tomaka
tomaka / ThreadedCommandsQueue.cpp
Created May 1, 2014 19:51
Class which allows parallel execution in a separate thread
#include "ThreadedCommandsQueue.hpp"
#include <future>
ThreadedCommandsQueue::ThreadedCommandsQueue()
{
std::promise<void> initializationFinished;
auto future = initializationFinished.get_future();
mExecutingThread = std::thread([this,&initializationFinished]() {
try {
@tomaka
tomaka / gl.rs
Last active August 29, 2015 14:02
Binding for OpenGL 4.4 in Rust, generated by bjz/gl-rs
// Copyright 2013 The gl-rs developers. For a full listing of the authors,
// refer to the AUTHORS file at the top-level directory of this distribution.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
@tomaka
tomaka / libarchive.rs
Last active April 22, 2021 23:26
Rust FFI for libarchive
/* automatically generated by rust-bindgen */
pub enum Struct_archive { }
pub enum Struct_archive_entry { }
pub enum Struct_stat { }
pub enum Struct_archive_acl { }
pub enum Struct_archive_entry_linkresolver { }
pub type archive_read_callback = ::libc::c_void;
pub type archive_skip_callback = ::libc::c_void;
pub type archive_seek_callback = ::libc::c_void;
@tomaka
tomaka / chipmunk2d.rs
Created June 23, 2014 12:00
Rust FFI for Chipmunk2D
/* automatically generated by rust-bindgen */
#![crate_id = "chipmunk-rs"]
#![crate_type = "lib"]
extern crate libc;
pub type size_t = ::libc::c_ulong;
pub type wchar_t = ::libc::c_int;
pub type idtype_t = ::libc::c_uint;
@tomaka
tomaka / gist:623781c5af6ebbc5dcfe
Last active February 15, 2020 06:24
Gfx vs glium comparison table
Gfx and glium are Rust libraries that aim to provide a "rusty" abstraction over graphics programming APIs.
Both may look similar, and one of the questions that gets asked frequently on IRC is "what are the differences between gfx and glium?". Here is a comparison table:
| Gfx | Glium
-------------------------------------|-------------------------------------------------------------------------------------------------------------------|--------------------------------
URL | <https://github.com/gfx-rs/gfx-rs> | <https://github.com/tomaka/glium>
History | Papers since Oct 2013. Really started in June 2014. | Private/confidential from Feb 201
@tomaka
tomaka / License
Last active July 10, 2022 12:54
FXAA with glium
This code is under the MIT license.
The GLSL code was taken from https://github.com/mattdesl/glsl-fxaa and is also under the MIT license.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
use glium::{self, Surface};
use glium::backend::Context;
use glium::index::PrimitiveType;
use glium::texture::SrgbTexture2dArray;
use std::cell::{RefCell, RefMut};
use std::default::Default;
use std::rc::Rc;
use std::ops::Range;
@tomaka
tomaka / Cargo.toml
Last active September 26, 2015 16:35
[package]
name = "test"
version = "0.0.1"
authors = ["Pierre Krieger <pierre.krieger1708@gmail.com>"]
build = "build.rs"
[dependencies]
libc = "*"
[build-dependencies]
; ModuleID = 'test.0.rs'
target datalayout = "e-p:32:32-i64:64-v128:32:128-n32-S128"
target triple = "asmjs-unknown-emscripten"
%str_slice = type { i8*, i32 }
%"2.core::fmt::Write::write_fmt::Adapter<collections::string::String>" = type { %"3.collections::string::String"* }
%"3.collections::string::String" = type { %"3.collections::vec::Vec<u8>" }
%"3.collections::vec::Vec<u8>" = type { %"5.alloc::raw_vec::RawVec<u8>", i32 }
%"5.alloc::raw_vec::RawVec<u8>" = type { %"2.core::ptr::Unique<u8>", i32 }
%"2.core::ptr::Unique<u8>" = type { %"2.core::nonzero::NonZero<*const u8>", %"2.core::marker::PhantomData<u8>" }
; ModuleID = 'test.0.rs'
target datalayout = "e-p:32:32-i64:64-v128:32:128-n32-S128"
target triple = "asmjs-unknown-emscripten"
%str_slice = type { i8*, i32 }
%"2.core::fmt::Formatter" = type { i32, i32, i8, %"2.core::option::Option<usize>", %"2.core::option::Option<usize>", { i8*, void (i8*)** }, %"2.core::slice::Iter<core::fmt::ArgumentV1>", { %"2.core::fmt::ArgumentV1"*, i32 } }
%"2.core::option::Option<usize>" = type { i32, [0 x i32], [1 x i32] }
%"2.core::slice::Iter<core::fmt::ArgumentV1>" = type { %"2.core::fmt::ArgumentV1"*, %"2.core::fmt::ArgumentV1"*, %"2.core::marker::PhantomData<&'static core::fmt::ArgumentV1>" }
%"2.core::fmt::ArgumentV1" = type { %"2.core::fmt::Void"*, i8 (%"2.core::fmt::Void"*, %"2.core::fmt::Formatter"*)* }
%"2.core::fmt::Void" = type {}