Skip to content

Instantly share code, notes, and snippets.

View 8Observer8's full-sized avatar

Ivan 8Observer8

View GitHub Profile
@8Observer8
8Observer8 / main.py
Created February 6, 2023 11:05
Button over OpenGL canvas in PyQt6
import sys
from OpenGL.GL import *
from PyQt6.QtCore import QSize, Qt
from PyQt6.QtOpenGLWidgets import QOpenGLWidget
from PyQt6.QtWidgets import QApplication, QPushButton, QVBoxLayout
class OpenGLWidget(QOpenGLWidget):
@8Observer8
8Observer8 / color.frag
Created January 29, 2023 12:52
Click detection with AABB, Box2D, OpenGL 2.1, PyQt6, Python 3.8
precision mediump float;
uniform vec3 uColor;
void main()
{
gl_FragColor = vec4(uColor, 1.0);
}
@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();;
}