Skip to content

Instantly share code, notes, and snippets.

DLSRelease.bc.js:1 Creating and mounting IDBFS
(index):224 (i) 2018-10-14 18:07:37 System initialized
(index):224 (i) 2018-10-14 18:07:37 Starting application
(index):236 bad name in getProcAddress: glVertexAttribIPointer,glVertexAttribIPointer
printErr @ (index):236
ASM_CONSTS @ DLSRelease.bc.js:1
_emscripten_asm_const_iii @ DLSRelease.bc.js:1
q3 @ DLSRelease.bc.js:13
_eglGetProcAddress @ DLSRelease.bc.js:1
_Q @ DLSRelease.bc.js:12
@floooh
floooh / bombjack_decode.c
Last active October 9, 2018 17:52
Decode Bomb Jack tile ROMs into PNGs
#include <stdint.h>
#include "bombjack-roms.h"
#define STB_IMAGE_WRITE_IMPLEMENTATION
#include "stb_image_write.h"
#define BYTES_PER_PIXEL (3)
uint8_t buf[256 * 256 * BYTES_PER_PIXEL];
uint8_t buf_x4[1024 * 1024 * BYTES_PER_PIXEL];
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Ansi 0 Color</key>
<dict>
<key>Alpha Component</key>
<real>1</real>
<key>Blue Component</key>
<real>0.0</real>
@floooh
floooh / galogen_emsc.md
Last active June 5, 2018 17:41
Compiling galogen for emscripten

Ok, here's what I found out :)

  1. the file is 9 MB because of the embedded gl.xml file... this is about 2.7 MB but gets blown up when embedded in to the asm.js (probably because of base64 encoding and extra commas)
  2. the way the program is currently compiled, everything is in the .html file, and it looks like your web servers doesn't compress .html (fixing the server-side compression would be the most important thing to fix, if you have access to the web server configuration)
  3. I played around with the compile options, first that the gl.xml is put into a separate binary file (this reduces the size from 9 MB to the 2.7 MB of the original gl.xml file), and some other options to reduce the size of the generated asm.js code.

The command line is (I've put this into a build_emsc.sh file)

em++ galogen.cpp third_party/tinyxml2.cpp -fno-rtti -fno-exceptions -std=c++11 -stdlib=libc++ -o galogen.html -Os --llvm-lto 1 -DNDEBUG -s WASM=0 --shell-file galogen-shell.html -s ASSERTIONS=0 -s DISABLE_EXCEPTION_CATCHING
@floooh
floooh / imgui_buffer_update.md
Last active February 9, 2022 12:26
How I update vertex/index buffers for Dear Imgui

My Dear Imgui render loop looks a bit unusual because I want to reduce calls to WebGL as much as possible, especially buffer update calls.

This means:

  • only one buffer each for all per-frame vertex- and index-data
  • only one update call each per frame for vertex- and index-data (with my own double-buffering, since buffer-orphaning doesn't work on WebGL, and with this I'm also independent from any 'under-the-hood' magic a GL driver might or might not perform)
@floooh
floooh / gist:360e884ea45c9868039c9ddb1343750d
Created December 5, 2017 13:01
emscripten/posix socket client example
//------------------------------------------------------------------------------
// NetClient.cc
//------------------------------------------------------------------------------
#if ORYOL_WINDOWS
#define _WINSOCK_DEPRECATED_NO_WARNINGS (1)
#include <WinSock2.h>
typedef int ssize_t;
#endif
#if ORYOL_POSIX
(1) change root URL to localhost, port 8000 (8080 for node's http-server), don't forget
the trailing slash:
ioSetup.Assigns.Add("orb:", "http://127.0.0.1:8000/"); // ORYOL_SAMPLE_URL);
(2) in oryol-samples/data, start a local HTTP server:
~/p/o/data ❯❯❯ pwd
/Users/floh/projects/oryol-samples/data
~/p/o/data ❯❯❯ python -m SimpleHTTPServer
@floooh
floooh / cmake_funcs.txt
Last active September 26, 2020 21:51
Fips generator example to copy files during build process
To invoke the generator from the cmake target you should define a helper macro in you project root's "fips-include.cmake" file:
macro(copy_files yml_file)
fips_generate(FROM ${yml_file}
TYPE filecopy
OUT_OF_SOURCE
ARGS "{ deploy_dir: \"${FIPS_PROJECT_DEPLOY_DIR}\" }")
endmacro()
In your cmake target definition you would then use this like:
// component pools...
ComponentPool<TransformComponent> Transform;
ComponentPool<AudioComponent> Audio;
ComponentPool<RenderComponent> Render;
// component pools would be registered somewhere central...
ComponentPoolRegistry.Register(Tansform);
...
// creating an entity is just picking a free Id, which serves
@floooh
floooh / Wireframe.cc
Last active June 16, 2017 14:05
A complete wireframe debug renderer for Oryol
//------------------------------------------------------------------------------
// Wireframe.cc
//------------------------------------------------------------------------------
#include "Pre.h"
#include "Wireframe.h"
#include "Gfx/Gfx.h"
#include "shaders.h"
namespace Oryol {