r/GraphicsProgramming • • Mar 03 '24

Article RSGL | Modular, header-only, cross-platform GUI library for C | easy-to-use

3 Upvotes

RSGL is a header-only library I created for creating GUI software. RSGL's core values include, modularity, user convenience and efficiency in code and resource usage. RSGL achieves this by separating itself into a few modules, offering convenient methods, using modern C techniques and by using concise data types to minimize bloat. RSGL is free and open source under the zlib license.I've already posted about RSGL here, but since then there has been major updates including more widgets and general quality of life improvements!

Introduction

https://github.com/ColleagueRiley/RSGLRSGL stands for Riley's Simple GUI Library. Just as the name suggests, RSGL is a simple-to-use library for creating GUI libraries. It accomplishes this with a straightforward windowing system and easy-to-use basic, but fundamental, rendering system, widgets designed around convenience and modularization.   

Features

  • No external dependencies, all the libraries required are included in RSGL

  • Supports multiple platforms, Windows, MacOS, Linux, etc

  • Supports multiple versions of OpenGL (even allowing you to switch during runtime)

  • Uses other small lightweight dependencies

  • Basic shape drawing, collisions and drawing operations

  • OpenGL abstraction layer, RGL, which can also be used independently as a single-header library

  • Straightforward window management via RGFW

  • Supports multiple font, image and audio formats via `stb_truetype.h`, `stb_image.h`, and `miniaudio.h`

  • Dynamic GUI Widgets

  • Many examples included

  • Free and Open Source (zlib/libpng license)

Using the code

This code can be compiled withLinux : gcc <file.c> -lGL -lX11 -lmWindows : gcc <file.c> -lopengl32 -lshell32 -lgdi32MacOS: gcc -shared RSGL.o -framework Foundation -framework AppKit -framework CoreVideo

#define RSGL_NO_AUDIO /* RSGL uses miniaudio.h, and I don't want to compile it if I'm not using it */
#define RSGL_IMPLEMENTATION
#include "RSGL.h"

int main() {
    RSGL_window* win = RSGL_createWindow("name", RSGL_RECT(0, 0, 500, 500), RSGL_CENTER);

    RSGL_button button = RSGL_initButton(); /* zero out button */
    RSGL_button_setRect(&button, RSGL_RECT(50, 50, 100, 50));
    RSGL_button_setStyle(&button, RSGL_STYLE_LIGHT | RSGL_STYLE_ROUNDED);

    bool running = true;

    while (running) {
      while (RSGL_window_checkEvent(win)) {
          if (win->event.type == RSGL_quit) {
            running = false;
            break;
          }

          RSGL_button_update(&button, win->event);
      }

      RSGL_drawButton(button);
      RSGL_drawRect((RSGL_rect){200, 200, 200, 200}, RSGL_RGB(255, 0, 0));
      RSGL_window_clear(win, RSGL_RGB(200, 150, 120));
    }

    RSGL_window_close(win);
}

The RSGL repo can be found at https://github.com/ColleagueRiley/RSGL


r/GraphicsProgramming • • Mar 06 '24

Bounded Volume Hierarchy Implementation in C++: Segmentation errors

3 Upvotes

Hello all,

I'm to implement a bounded volume hierarchy in C++ for a computer graphics class. This includes the constructor, which runs in O(N log N) time complexity and a method for intersecting the hierarchy which has to run in O(log N). Both are recursive. I'm honestly pretty new to C++ and a slow learner, so it took me a while to just get the code compiled. Now that I have, all my tests are throwing segmentation faults and I have no idea what's causing it.

All the code that I wrote is in the boundedVolumeNode.cpp. That's where the constructor and intersect method are. The constructor takes 2 iterators, start and end, which point to a vector of shared pointers to bounded primitives. The start iterator points to the start of the vector, and the end iterator points to the element after the last element of the vector. Because of this, the constructor's end parameter is exclusive while the start parameter is inclusive.

The steps I took are as follows: First I initialize the node's bounding box by iterating through the bounded primitives and adding each one's bounding box to the node's bounding box. Then, if there are more than 2 primitives in the vector (number of shapes in the box) I partition the bounded primitives using a pivot that is the bounding box's center along a random axis. After that, I use a partitioning algorithm similar to the one used in quicksort for O(N log N) complexity (key difference is that the pivot isn't necessarily in the vector). I made sure the i iterator is always pointing to the last element that is less than the pivot after partitioning. I pass each partition to _left and _right to construct new nodes. _left's constructor takes (start, std::next(i)) which has elements less than the pivot, while _right's constructor takes (std::next(i), end) which has elements greater than or equal to the pivot. If there are 2 or fewer primitives in the vector, then those primitives become leaf nodes and the recursion can stop.

The intersect method is much simpler: If the ray doesn't hit the bounding box, return an empty intersection point. Otherwise, recursively call the intersect method on _left and _right and return the nearest intersection point. Note that intersect() is an abstract method in the boundedPrimitive class and boundedVolumeNode inherits from boundedPrimitive along with other bounded primitives like bounded triangles, so an intersection point will be returned if _left or _right is a bounded primitive other than boundedVolumeNode.

Apologies for such a big post. I'd be so grateful for any advice on how to fix the segmentation faults. I'd also really appreciate any advice in general; like whether or not the code will work correctly even after the segmentation faults are fixed. My professor canceled office hours today and it would probably take me days, if not weeks, to learn how to debug segmentation faults, so my options for help are limited. Thank you all!

Here is the code:

boundedVolumeNode.cpp: https://pastebin.com/aYZpZRkv

boundedVolumeNode.h: https://pastebin.com/BtSgGqgn

boundedPrimitive.cpp: https://pastebin.com/k9hn8Sip

boundedPrimitive.h: https://pastebin.com/2md2aGDU

boundingBox.cpp: https://pastebin.com/LX3R5A4n

boundingBox.h: https://pastebin.com/xv5Q87xx


r/GraphicsProgramming • • Apr 12 '20

Is OpenGL or DirectX11-12 obsolete now with the advance in new cutting edge 3d graphics API like Vulkan etc ? or it's still good to know for many games still developed today (PC, PS4, Xbox) ?

0 Upvotes

Is OpenGL or DirectX11-12 obsolete now with the advance in new cutting edge 3d graphics API like Vulkan etc ? or it's still good to know for many games still developed today (PC, PS4, Xbox) ?


r/GraphicsProgramming • • Mar 11 '26

Question What about using Mipmap level to chose LOD level

0 Upvotes

Mipmap_0 -> LOD_0
Mipmap_2 -> LOD_1

is that what we r doing? did i crack the code?? (just a 3d modeling hobbyist having shower thoughts)


r/GraphicsProgramming • • Aug 27 '26

Question Why lumen looks better than baked light?

0 Upvotes

I open this post because i couldn't find someone talking about it. I find lumen's cloudy day look more pleasing and realistic. It just looks next gen. Why we don't have much more better lightning in a precomputed scenario. Why baked lighting looks old.


r/GraphicsProgramming • • Jun 14 '26

Question Best way to learn Graphics programming in 2026

0 Upvotes

How do I actually learn graphics programming through projects and real games?

Instead of reading documentation and copying code, I want to learn graphics programming by reading a concept, finding it being used in a real game, then implementing it myself from scratch.

Is this a good Method to follow?


r/GraphicsProgramming • • Jun 01 '25

Is it me or modern valve game have really good visual clarity

22 Upvotes

I picked up a Steam deck recently and was completely blown away by the visual of the deskjob demo. Everything just feel so sharp and immersive. I'm not sure exactly why but this is also the case for Half-life Alyx. I'm aware of the TAA problem with UE but didn't know it could have this much of an effect. Valve is truly the GOAT even when they don't really make games lol


r/GraphicsProgramming • • Jul 10 '25

👀 GPU Lovers Wanted – Help Build a CUDA-Powered Soft Body Physics Engine

0 Upvotes

Project Tachyon – Real-Time Physics, Real Chaos

I’m building a real-time, constraint-based 3D physics engine from scratch—modular, GPU-accelerated, and designed to melt eyeballs and launch careers. Think soft-body simulations, fabric, chaos, multibody collisions, and visuals that make other engines flinch.

But I’m not doing it alone.

I’m looking for 10–15 devs who don’t just code—they crave mastery. People who know their vectors and rotations better than their own face. People who wake up thinking about constraint solvers and spatial hashing. People who want to turn CUDA into a weapon. People who want to build something that gets them hired, scouted, and remembered.

We’re building it in C++, with CUDA and OpenGL as the backbone. Structure of Arrays for insane GPU throughput. Maybe even Vulkan or DirectX11 later, if we feel like really pushing it. Weekly builds. Clean, modular architecture. Built to scale, and to flex.

Not sure if you're ready? Cool. Start here: 📖 Game Physics Engine Development by Ian Millington Download the book (PDF)

I’m looking for constraint solver junkies, soft-body dreamers, GPU freaks, visual magicians, and optimization fanatics. Also? Weird thinkers. People who want freedom. People who want to get their hands dirty and build something that could live beyond them.

We'll organize on Discord, push code on GitHub, and meet weekly. This isn't a tutorial. It’s a launchpad. A proving ground. A collective of people crazy enough to build something unreasonably good.

This is Project Tachyon. If your heart’s beating faster just reading this—you’re in the right place.

DM me or comment. Let’s build something jaw dropping.


r/GraphicsProgramming • • Oct 09 '26

Source Code I built an open-source F1 session replay visualizer using Bevy and Rust.

0 Upvotes

r/GraphicsProgramming • • Feb 21 '25

Question No experience in graphics programming whatsoever - Is it ok to use C for OpenGL?

8 Upvotes

So i dont have any experience in graphics programming but i want to get into it using OpenGL and im planning on writing code in C. Is that a dumb idea? A couple of months ago i did start learning opengl with the learnopengl.com site but i gave up because i lost interest but i gained it back.

What do you guys say? If im following tutorials etc i can just translate CPP into C.


r/GraphicsProgramming • • Apr 24 '21

Trying to understand how to build a flow chart as per included image

8 Upvotes

hello,

I am trying to understand if there is a library for generating charts as bellow

how would you do this?

thank you


r/GraphicsProgramming • • Sep 28 '16

Pixels and voxels, the long answer

Thumbnail
medium.com
8 Upvotes

r/GraphicsProgramming • • Jul 26 '26

Source Code 3D rendering is now possible using the CoreAI / Apple Neural Engine (ANE) software rasterizer (CPU usage reduced to 9%). The quality is still terrible.

0 Upvotes

Here is a follow-up on the triangle rasterizer running on CoreAI that I previously introduced here.

We have finally succeeded in rendering 3D graphics! As shown in the video, we are currently rendering two intersecting vertical triangular planes.

While the rendering quality is still in the early stages and a new challenge regarding the massive 5GB memory footprint has emerged, we have fully achieved real-time operation.

We optimized the codebase by actively reducing reliance on CPU fallbacks and ensuring the pipeline runs entirely on the ANE's matrix operation hardware, successfully cutting CPU usage from the previous 38% to approximately 9%.

Much of the pipeline code—written in Python, Swift, and Metal—was rapidly prototyped and generated with the help of Siri AI.

GitHub: https://github.com/kamisori-daijin/Magnesium

Please feel free to leave comments with any questions or optimization tips (especially regarding that 5GB memory usage!).


r/GraphicsProgramming • • Aug 12 '25

Question How do shaders are embedded into a game?

8 Upvotes

I’ve seen games like Overwatch and Final Fantasy XIV that use shaders more. Do they write each shader for each character, or do characters share shaders, like when taking damage? How do they even manage that many shaders?


r/GraphicsProgramming • • Jul 22 '25

[Advice Needed] Am I too late to break into the game industry?

18 Upvotes

I’m 27, with 3 years of experience in web development — but the truth is, I’ve always been passionate about the game industry. I love the tech behind it: game engines, graphics programming, systems-level stuff. That’s where my heart is.

A few months ago, I left my job to fully commit to learning low-level systems and graphics programming. I’ve been building personal projects, studying daily, and applying to every opportunity I can find — but after 3 months of trying, I haven’t been able to land even an entry-level position. It’s honestly been exhausting, and I’m starting to feel burned out.

I’m not looking for a shortcut or an easy job. I’d do anything just to get my foot in the door.

I guess I’m looking for a reality check. Is this path still possible for someone like me? Or should I face the fact that maybe I’ve made a mistake and go back to something more stable?

If anyone has advice, experience, or even just a dose of honesty — I’d really appreciate it.


r/GraphicsProgramming • • Sep 24 '25

Question Why do rendering engines used a single polygon type?

37 Upvotes

Unless my knowledge is wrong, rendering engines pretty much all use triangles. I'm wondering why don't they use a combination of triangles, quads, rectangles and the likes?

One advantage for rectangles can be that you need only two points to save them (maybe it saves computational cost?). Bear in mind I never wrote gpu programs so i don't know how optimizations work or if two points is more costly than 4 / 3 due to computational overhead

Edit:

I know the advantage of triangles. My question is why use ONLY triangles and not add in more shapes, which can potentially reduce compute time or memory


r/GraphicsProgramming • • Feb 28 '23

Need help: capture Hogwarts Legacy in RenderDoc?

10 Upvotes

Hi, I have Hogwarts Legacy for Steam.

I was curious to see how the spells are rendered, so I though I would give RenderDoc a try. But I having trouble, so I thought someone here could help me :)

I found the game executable at "C:\Program Files (x86)\Steam\steamapps\common\Hogwarts Legacy". Then, in RenderDoc, I check the "Capture Child Processes" checkbox, as the game launches as a child process of Steam.

First I get a a message box warning me that the game is being launched with the " Phoenix " command line arguments. I say OK to the pop up, and everything and the game seems to launch fine and I can even play around just fine. The problem comes when I hit F12 to capture: the game freezes for a while, and after 2 mins of so the game shuts down :(

I though the problem might be lack of RAM since I had only 16GB and task manager showed that I was running on the limit. But I bought more RAM (now I have 32GB) and the problem still persists, even though I only get about 17GB usage.

Has anyone managed to capture this game successfully? Or do you have any hints from having captured other Steam games?

Thanks in advance!

EDIT:

Thanks to all those that tried to help me!

I manged to get a few captures now :)

Still trying to figure things out, as I had to turn graphics down, and I'm also interested in knowing about the techniques that are enabled in the high settings. But this is promising! I'm so excited to see what can I learn from this game :))


r/GraphicsProgramming • • Jul 20 '25

AI gave me the simplest explanation what a quaternion is. XYZ is the axis and W is the angle around that axis.

Thumbnail
gallery
12 Upvotes

"XYZ is the axis and W is the angle around that axis". This kind of oversimplification is what I wish I heard 11 years ago when I first used quaternions but YT videos were always getting unnecessarily philosophical and talking about some 4D projections or other nonsense.

Instead of trying to understand quaternions by starting from an Euler rotation, it's better to forget about Euler and start from an axis-angle perspective. This way a quaternion can be explained in a minute and even manually calculated like in screenshot 2.


r/GraphicsProgramming • • Sep 16 '26

The image you see here is 3D, not 2D.

Thumbnail
youtube.com
12 Upvotes

Hey guys, just passing by to show that I managed to create an artstyle which allows you to have a true pixel artstyle in a 3D space(without it being cardboard and all. The objects in the image are true 3D objects). Very similar to Project Shadowglass artstyle, if you need the reference.


r/GraphicsProgramming • • May 09 '26

I was struggling with legacy OpenGL concepts in class, so I built a 2D visual simulator to teach it

Post image
86 Upvotes

I tried to keep this as short as possible, so bear with me!

I built VAMS (Visual Animation Modeling Simulator) as a project to help beginners like myself back then understand legacy OpenGL. It’s a GUI-only, 2D teaching simulator that includes a dedicated "Lesson Mode" featuring narrated demos and interactive exercises.

Here is what the system currently teaches:

  • Pipeline - the OpenGL rendering pipeline, NDC coordinates, rasterization, and the anatomy of a GLUT program

  • Primitives - all glBegin/glEnd primitive types, per-vertex color (glColor3f/glColor3ub), line styling (glLineWidth, glLineStipple), bitmap text, and GLUT callbacks

  • Buffers - immediate mode vs. vertex arrays vs. VBOs, buffer usage hints (GL_STATIC_DRAW, GL_DYNAMIC_DRAW, GL_STREAM_DRAW), indexed drawing, and glMapBuffer

  • Transforms - glTranslatef, glRotatef, glScalef, the matrix stack, and glOrtho

  • Textures - UV mapping, filtering, wrapping, and full texture setup code

The Tech Stack: Under the hood, it’s a web app built with React, TypeScript, and Zustand for state management, using PixiJS to handle the 2D canvas rendering.

Link to the app is in the screenshot if you are interested in trying it and I would absolutely love to hear your feedback, critiques, or ideas!! Thank you!


r/GraphicsProgramming • • Jan 10 '25

Question how do you guys memorise/remember all the functions?

36 Upvotes

Just wondering if you guys do brain exercises to remember the different functions, or previous experience reinforced it, or you handwrite/type out the notes. just wanna figure out the ways.


r/GraphicsProgramming • • Nov 09 '25

Question Do y'all have suggestions?

Thumbnail
gallery
36 Upvotes

I'm having an artblock


r/GraphicsProgramming • • Feb 13 '26

Question I made a ground in my game.

0 Upvotes

I made a ground in my game. It is not fully working but it is acceptable.

I am a new developer by the way.

any ideas of what game should I make?

thanks for reading, stay tuned to learn more about my journey.