Skip to content

Instantly share code, notes, and snippets.

View VirtuosoChris's full-sized avatar

Christopher Pugh VirtuosoChris

View GitHub Profile
@VirtuosoChris
VirtuosoChris / HelloGLFW.cpp
Last active September 5, 2016 04:14
Hello GLFW : minimal example
#include <GLFW/glfw3.h>
#include <iostream>
// #define LOG_FORMATS
static void error_callback(int error, const char* description)
{
std::cerr<< "Error " << error << " : " << description << std::endl;
}
@VirtuosoChris
VirtuosoChris / HelloOpenVR_GLFW.cpp
Last active May 19, 2024 13:56
Minimal OpenVR + GLFW Example
/**** Minimal OpenVR example : outputs textures to the headset, a different color in each eye. No head tracking or input anywhere. Bare minimum. ****/
/// header only extension loader and object oriented bindings -- ref : https://github.com/VirtuosoChris/glhpp
#define GL_ALT_GL_API 1
#define GL_ALT_GLES_API 2
#include <glalt/gl4.5.h> // opengl api
#include <glalt/glext.h>
#include <opengl.hpp> // object oriented bindings
@VirtuosoChris
VirtuosoChris / ShaderProgramLib.h
Last active February 6, 2023 17:55
Hello OpenVR : Pt 2 : Basic Rendering + Head Tracking
// Copyright (c) 2013 Virtuoso Engine LLC. All rights reserved.
//
// defines:
// VIRTUOSO_SUPPRESS_OUTPUT to hide compilation logs, etc
// VIRTUOSO_SHADERPROGRAMLIB_IMPLEMENTATION for implementation
#ifndef _GL_SHADER_H_INCLUDED
#define _GL_SHADER_H_INCLUDED
#if !defined(GL_ALT_API_NAME)
@VirtuosoChris
VirtuosoChris / Oregon78
Created September 10, 2016 02:20
Oregon78
10 REM PROGRAM NAME - OREGON VERSION: 01/01/78
20 REM ORIGINAL PROGRAMMING BY BILL HEINEMANN - 1971
30 REM SUPPORT RESEARCH AND MATERIALS BY DON RAWITSCH,
40 REM MINNESOTA EDUCATIONAL COMPUTING CONSORTIUM STAFF
50 REM CDC CYBER 70/73-26 BASIC 3.1
60 REM DOCUMENTATION BOOKLET 'OREGON' AVAILABLE FROM
61 REM MECC SUPPORT SERVICES
62 REM 2520 BROADWAY DRIVE
63 REM ST. PAUL, MN 55113
80 REM
@VirtuosoChris
VirtuosoChris / sht_test
Created February 11, 2017 01:40
sht_test
#define STB_IMAGE_IMPLEMENTATION
#include "stb_image.h"
#define STB_IMAGE_WRITE_IMPLEMENTATION
#include "stb_image_write.h"
template<typename OUTTYPE, typename INTYPE>
void splice(OUTTYPE* finalImg, INTYPE*redImageIn, INTYPE* greenImageIn, INTYPE* blueImageIn, int pixels)
{
{
@VirtuosoChris
VirtuosoChris / SHOPS.hpp
Created May 2, 2017 07:16
SHOPS - Stateless Header Only Particle System - VS based, part of HOPS library.
//
// HOPS.h
// IMGUITEST
//
// Created by Chris Pugh on 3/28/17.
// Copyright © 2017 VirtuosoEngine. All rights reserved.
//
/// --- Header Only Particle System by Virtuoso Engine ---
///
#####
##### By Christopher Pugh
##### Copyright 2015 Virtuoso Engine, LLC
##### Public domain or equivalent license
#####
##### Basic asset to header script
##### Pulls vertices, normals, single texture coord channel
##### Triangulates meshes, pulls multiple meshes, puts everything in arrays in a namespace
##### first argument is input mesh file
##### Second optional argument is namespace name
@VirtuosoChris
VirtuosoChris / SurfaceTexturePlayer.java
Created March 2, 2019 01:55
Android video player code.
/**
* Created by chrispugh on 8/13/16.
*/
package com.virtuosoengine;
import android.app.Activity;
import android.content.res.AssetFileDescriptor;
import android.graphics.SurfaceTexture;
import android.media.AudioManager;
import android.media.MediaPlayer;
// Copyright (c) 2013 Virtuoso Engine LLC. All rights reserved.
//
// defines:
// VIRTUOSO_SUPPRESS_OUTPUT to hide compilation logs, etc
// VIRTUOSO_SHADERPROGRAMLIB_IMPLEMENTATION for implementation
///#define VIRTUOSO_LOG_SHADERS
#ifndef _GL_SHADER_H_INCLUDED
#define _GL_SHADER_H_INCLUDED
#ifndef VIRTUOSO_GL_UTIL_H_INCLUDED
#define VIRTUOSO_GL_UTIL_H_INCLUDED
namespace Virtuoso
{
namespace GL
{
#ifdef GL_ALT_FUNDEF_CopyImageSubDataEXT
inline void copyMonoFrameToEyeBuffers(GLint monoTexture, GLint leftEyeTex, GLint rightEyeTex, GLint rtWidth, GLint rtHeight, unsigned int border=1, bool invalidateAfter=true)