Skip to content

Instantly share code, notes, and snippets.

View 8Observer8's full-sized avatar

Ivan 8Observer8

View GitHub Profile
@8Observer8
8Observer8 / index.html
Last active November 29, 2022 17:02
Load Ammo.js and a texture using Promise. WebGL, JavaScript
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Load Ammo.js and a texture using Promise. Rollup, WebGL, JavaScript</title>
</head>
@8Observer8
8Observer8 / index.html
Last active November 29, 2022 14:00
Load a texture using Promise, draw a triangle and import glMatrix as ES6-module
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Example</title>
</head>
<body>
@8Observer8
8Observer8 / index.html
Last active November 28, 2022 23:13
Import glMatrix and a simple triangle in WebGL
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Dog. WebGL, JavaScript</title>
</head>
<body>
@8Observer8
8Observer8 / .clang-format
Last active October 24, 2022 18:16
clang, extended braces: clang-format *.h *.cpp -i --style=file:"E:/clang-format/MyStyleWebKit/.clang-format"
---
Language: Cpp
# BasedOnStyle: WebKit
AccessModifierOffset: -4
AlignAfterOpenBracket: DontAlign
AlignArrayOfStructures: None
AlignConsecutiveMacros: None
AlignConsecutiveAssignments: None
AlignConsecutiveBitFields: None
AlignConsecutiveDeclarations: None
@8Observer8
8Observer8 / main.cpp
Created October 19, 2022 22:17
explosion-bullet-opengl1-freeglut-cpp
#define FREEGLUT_STATIC
#include <GL/freeglut.h>
#include <GL/glu.h>
#include <algorithm>
#include <btBulletDynamicsCommon.h>
#include <iostream>
#include <set>
#define EXPLOSION_STRENGTH 50.f
@8Observer8
8Observer8 / main.cpp
Created October 19, 2022 02:49
trigger-bullet-opengl1-freeglut-cpp
#define FREEGLUT_STATIC
#include <GL/freeglut.h>
#include <GL/glu.h>
#include <algorithm>
#include <btBulletDynamicsCommon.h>
#include <iostream>
#include <set>
int winW = 350, winH = 350;
@8Observer8
8Observer8 / main.cpp
Last active October 19, 2022 01:34
bouncing-ball-bullet-opengl1-freeglut-cpp
#define FREEGLUT_STATIC
#include <GL/freeglut.h>
#include <GL/glu.h>
#include <iostream>
#include <btBulletDynamicsCommon.h>
GLfloat floorMaterialDiffuse[] = { 0.55f, 0.64f, 0.36f, 1.f };
GLfloat sphereMaterialDiffuse[] = { 0.06f, 0.29f, 0.65f, 1.f };
GLfloat platformMaterialDiffuse[] = { 0.74f, 0.53f, 0.19f, 1.f };
GLfloat light0Diffuse[] = { 1.f, 1.f, 1.0f };
@8Observer8
8Observer8 / AmmoProvider.ts
Created October 12, 2022 14:08 — forked from Sumechoo/AmmoProvider.ts
Class for simplified usage of typed Ammo.js API inside ES6 modules
import Ammo from 'ammojs-typed';
export class AmmoProvider {
private static api: typeof Ammo;
public static async getApi() {
if (!AmmoProvider.api) {
AmmoProvider.api = await Ammo();;
}
@8Observer8
8Observer8 / main.cpp
Last active October 9, 2022 14:36
Very Simple Triangle using OpenGL2, Qt6, and C++
// To run on laptops:
#ifdef _WIN32
#include <windows.h>
extern "C" __declspec(dllexport) DWORD NvOptimusEnablement = 0x00000001;
extern "C" __declspec(dllexport) DWORD AmdPowerXpressRequestHighPerformance = 0x00000001;
#endif
#include <QtGui/QOpenGLFunctions>
#include <QtGui/QSurfaceFormat>
#include <QtOpenGL/QOpenGLBuffer>
@8Observer8
8Observer8 / sdl2_opengl_skeleton.py
Created September 3, 2022 19:56 — forked from kiwwisk/sdl2_opengl_skeleton.py
Skeleton for SDL2/OpenGL application in Python 3. Game loop has fixed time step, rendering is going at full speed.
#
# Skeleton for SDL2/OpenGL application in Python
# with fixed logic time step, rendering is going still at full speed.
#
# To turn debug logging messages on, run with -v parameter:
# python <script_name.py> -v
#
import argparse
import logging