PortableGL

June 16, 2021 OpenGL C libraries

So, it's only 9 months past when I initially released it, but I'm finally posting it to my projects page and writing this perfunctory blog post about it.

In a nutshell, it's a portable, single header library, written in clean-C (ie C++ safe), implementing OpenGL 3.x ish. In other words, it runs entirely on the CPU and its only dependency is C99, though all the examples and demos use SDL2.

You can read more about it and look at the examples here.


Playing With Emscripten and WebAssembly

December 6, 2017 OpenGL C C++ Web

So a little over a month ago, I thought it would be cool to try out emscripten and WebAssembly with one of my students. We had previously done some "hello world" type graphics programs and a simple game port and I thought it'd be fun to see how easy (or not) it was to get those to run in the browser.

While I think it was a good exercise, and emscripten is much better than it was a couple years ago, I don't think it's ready for primetime yet. You cannot simply compile your existing graphics/game code and expect it to work. If you're lucky you only have to make a few minor changes and with an #ifdef you can use the same code for your regular executable to. If you're not, you might have to re-do your whole program because of the limitations emscripten (which are really the limitations of the browser/DOM rendering model. These include turning infinite loops into callback functions and restricting yourself to OpenGL ES 2/3 which gets translated to WebGL 1/2.

In any case, here are our results:

For some reason we could not get file loading to work and the movement in sdl2_interactive is very inconsistent for no reason that we could determine. We originally wanted to port simulate which we had previously already ported to C but due to the mainloop callback requirement, it would have required a complete redesign.

Useful links:


New OpenGL Project: opengl_reference

March 7, 2016 OpenGL C C++

I've posted a new project, opengl_reference.

As it says, it's going to be a growing repo of small to medium OpenGL programs. Some will be very simple examples, almost tutorial type programs. Some will demonstrate 1 or 2 specific features of OpenGL. Some will show specific aspects/behavior of OpenGL (like it's left-handed canonical coordinate system or what happens when you draw lines on the exact edges of the view volume). Finally, a couple will be template programs, meant to be copy-pasted to start new projects of a certain type.

In the course of developing these, I'll be building my OpenGL helper libraries (math, mesh/buffer/texture/shader management etc.) and refining/improving them. I'll also be using/learning glm but I prefer using/writing my own for various reasons.


© Robert Winkler, 2010 - 2024. Site design based on an old version of Michael Fogelman's awesome site.