Skip to content

Instantly share code, notes, and snippets.

View 8Observer8's full-sized avatar

Ivan 8Observer8

View GitHub Profile
@8Observer8
8Observer8 / main.cpp
Created December 29, 2023 18:56
Qt 6.6.1 Android Build Error: use of undeclared identifier 'GL_DRAW_FRAMEBUFFER'
#include <QtGui/QOpenGLExtraFunctions>
#include <QtGui/QSurfaceFormat>
#include <QtGui/QVector3D>
#include <QtOpenGL/QOpenGLFramebufferObject>
#include <QtWidgets/QApplication>
#include <QtWidgets/QLabel>
#include <QtWidgets/QWidget>
#include <QtWidgets/QVBoxLayout>
#include <QtOpenGLWidgets/QOpenGLWidget>
@8Observer8
8Observer8 / main.cpp
Created December 29, 2023 18:33
Qt 6.6.1 WebAssembly Error. WebGL: INVALID_ENUM: bindFramebuffer: invalid target
#include <QtGui/QOpenGLExtraFunctions>
#include <QtGui/QSurfaceFormat>
#include <QtGui/QVector3D>
#include <QtOpenGL/QOpenGLFramebufferObject>
#include <QtWidgets/QApplication>
#include <QtWidgets/QLabel>
#include <QtWidgets/QWidget>
#include <QtWidgets/QVBoxLayout>
#include <QtOpenGLWidgets/QOpenGLWidget>
@8Observer8
8Observer8 / format.cjs
Last active May 23, 2023 14:29
Format files recursively with js-beautify
const jsBeautify = require('js-beautify')['js_beautify'];
const fs = require('fs');
const glob = require('glob');
const options = {
indent_size: 4,
indent_char: ' ',
indent_with_tabs: false,
eol: '\n',
end_with_newline: true,
@8Observer8
8Observer8 / main.cpp
Created March 29, 2023 18:05
Keeping User Data for Box2D
// https://coliru.stacked-crooked.com/a/7765d15fe603a3d9
// https://gamedev.stackexchange.com/a/196955/115807
#include <iostream>
#include <string>
#include <vector>
#include <memory>
#include <map>
struct b2Fixture;
@8Observer8
8Observer8 / empty-window-qt6-cpp.pro
Created March 27, 2023 05:05
empty-window-qt6-cpp
QT += core gui widgets
SOURCES += main.cpp
TARGET = app
@8Observer8
8Observer8 / hello.s
Created February 13, 2023 03:23 — forked from mcandre/hello.s
64-bit GNU assembler Hello World for Windows
# Build:
#
# as -o hello.obj
# ld -o hello.exe hello.obj -L C:\\tools\\mingw64\\x86_64-w64-mingw32\\lib -lkernel32
#
# Requires MinGW
.extern GetStdHandle
.extern WriteFile
.extern ExitProcess
@8Observer8
8Observer8 / debug-drawer.js
Created February 11, 2023 08:52
Debug drawer for box2d.ts
import { mat4, quat, vec3 } from "gl-matrix";
import { gl } from "./webgl-context.js";
import { getEuler } from "./math-helpers.js"
// This class implements debug drawing callbacks that
// are invoked inside b2World::Step
export default class DebugDrawer {
constructor(program, pixelsPerMeter) {
this.program = program;
#!/usr/bin/python
# coding=utf-8
import os, pygame, time, random, uuid, sys
class myRect(pygame.Rect):
""" Add type property """
def __init__(self, left, top, width, height, type):
pygame.Rect.__init__(self, left, top, width, height)
self.type = type
@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);
}