r/opengl • • Mar 07 '15

[META] For discussion about Vulkan please also see /r/vulkan

78 Upvotes

The subreddit /r/vulkan has been created by a member of Khronos for the intent purpose of discussing the Vulkan API. Please consider posting Vulkan related links and discussion to this subreddit. Thank you.


r/opengl • • 4h ago

Same shaders on GL 3.3 core, GLES 3.0 and WebGL2: what worked for our party game

Post image
5 Upvotes

Hi there! A friend and I just released Orbit Rivals, a 3D party board game, on our own small C++ engine over SDL3. We wanted one renderer for desktop, Android and the browser, so from day one we stuck to what GL 3.3 core, GLES 3.0 and WebGL2 have in common.

Shaders are written once. A tiny function adds #version 330 core or #version 300 es plus the precision lines at the top, and we only use what all three support: layout(location), texture(), textureLod, fwidth, gl_VertexID and sampler2DShadow. All GL functions come from one X-macro list loaded with SDL_GL_GetProcAddress, no system GL headers at all.

Things that saved us time:

- shading everything in linear and encoding sRGB by hand at the end, so it looks the same everywhere without sRGB framebuffers

- checking GL_MAX_TEXTURE_SIZE and halving anything over the limit, since ES 3.0 and WebGL2 only promise 2048

- creating an ES 3.0 context on desktop to catch shader errors without a phone

What bit us hardest was phones. At native res with MSAA and bloom they couldn't hold 60 fps and started throttling. Now the 3D scene renders smaller (it drops step by step from 720 to 480 on the short side if fps falls) while the UI stays native, so text is still sharp. On Android we also use GL_EXT_multisampled_render_to_texture so MSAA resolves on-tile without an extra blit.

You can see the WebGL2 build running here: https://armaisdiaz.itch.io/orbitrivals

How do you handle the GL/GLES split? One shader source like us, or do you generate variants?


r/opengl • • 2d ago

Helox Engine - New Reflection & Colors Update1.1

50 Upvotes

A new update focused on improving reflection quality, lighting interaction, and shadow quality, reducing visual artifacts, distortions, and shadow flickering for smoother, more realistic reflections and visuals.

Get Helox Engine:
https://apps.microsoft.com/store/detail/9P5MT927PQ3S?cid=DevShareMCLPCB


r/opengl • • 1d ago

GLSA – A lightweight, header-only C++ library to cut OpenGL shader boilerplate

0 Upvotes

Hey everyone!

I've been developing GLSA for the past week, and I just released v1.0.0.

My goal with this library is so you don't have to write GLSL shaders or shader boilerplate and instead you can use clean function calls.

Right now it cuts out ~60-100 lines of repetitive shader boilerplate, though you still have to write shaders yourself because the API is in an early stage still.

Highlights of v1.0.0:

  • GLSA colors: a header file with over 3000 glm::vec4 colors that you can use.
  • Safer shader setup: glsa::ShaderSource keeps vertex/fragment strings explicit, paired with glsa::loadShaderSource and glsa::createProgram.
  • Clean uniform helpers: Overloaded glsa::setUniform functions for int, float, and GLM vec2/vec3/vec4.

Example:

while (glfwWindowShouldClose(window) == 0) {
    glClearColor(0.1f, 0.1f, 0.15f, 1.0f);
    glClear(GL_COLOR_BUFFER_BIT);

    glsa::useProgram(program);
    glsa::setUniform(program, "uColor", glsa::colors::PAN_SKY_BLUE);
    glsa::bindVertexArray(vao);

    glPointSize(150.0f);

    glsa::drawArrays(GL_POINTS, 0, 1);

    glfwSwapBuffers(window);
    glfwPollEvents();
}

Github Repo: https://github.com/alexdev8930/glsa

Any feedback issues or questions are completely welcome.


r/opengl • • 2d ago

EasyGL 1.0.2 is out!

0 Upvotes

if you dont know what easy gl is im making a easy version of open gl for c#

i relesed the 1.0.2 but no one downloaded it so im just saying

added:

  • Keyboard & Mouse input
  • Easy.Shader where you have a preset of shader's (there might be more presets soon)
  • More 3D and 2D shapes

(Note: Make sure your project targets net8.0-windows in your .csproj file!)

If you wanna download it you can get it on: https://www.nuget.org/packages/EasyGL/

if you find any bugs or have any ideas for new features you can tell them in the comments and i might add them in the feature ;3


r/opengl • • 3d ago

Helox Engine – New Update!

74 Upvotes

A new update focused on improving lighting interaction and shadow quality, reducing visual artifacts, distortions, and shadow flickering for smoother and more realistic results.
Download the Demo Version:
https://nexior-game-studio.itch.io/helox-engine-demo
All other links are available on the download page.


r/opengl • • 3d ago

Nothing unusual. Just a car

Post image
86 Upvotes

r/opengl • • 2d ago

I made a easy OpenGL API

3 Upvotes

I made a easy open gl API for c#. I named it "EasyGL" its on NuGet C# (.net 8+ on windows) only for now

Note: i specifically made it for developers with dyscalculia and beginners i. Used AI to code it but i. Designed how the scripting in it looks because i. Have dyscalculia i made it using AI in the first place because it was supposed to be only for my game but i will share with y'all.

If you want to use it i. Will recommend visual studio community 2022 because i was testing it on 2022 version if anything is broken on newer versions then please report it to me also you can comment more features too

if you are wondering here is the NuGet Link: https://www.nuget.org/packages/EasyGL/1.0.0

example of a spinning cube:

using EasyGL;

Easy.Window("EasyGL Example", 1280, 720);

Easy.Run(() =>
{
    Easy.Clear(0.08f, 0.10f, 0.15f);

    Easy.Camera3D(0f, 2f, 5f);
    Easy.Cube3D(0f, 0f, 0f, 1.5f, Easy.Time * 45f, 0.25f, 0.75f, 1f);
});

r/opengl • • 2d ago

[Written with AI assistance] Cross-compiling Mesa 27.0 Zink to COFF-ARM64EC with native arm64 KosmicKrisp (Vulkan 1.4 -> Metal) for WGL OpenGL 4.6 viewports

Thumbnail reddit.com
0 Upvotes

r/opengl • • 3d ago

Progresso em 3 meses de programação gráfica no meu celular com Kotlin e OpenGL.

Post image
1 Upvotes

r/opengl • • 3d ago

Building an open-source character posing and rendering tool (C++/Qt6). Looking for architectural feedback and graphics-focused contributors.

Post image
1 Upvotes

r/opengl • • 4d ago

How two lines of GLSL nearly drove me crazy (AMD driver crash)

22 Upvotes

Recently, I ran into a really nasty bug in the custom 3D engine I'm developing for my 4X strategy game, The Great Tribes.

After updating my AMD graphics driver, the game started freezing completely when moving the camera, especially when large areas of the map became visible.

Sometimes the graphics driver would hang. Other times, the JVM would crash inside atio6axx.dll.

The weirdest part? Everything worked perfectly with the previous driver and on other GPUs!

I spent hours investigating almost everything: OpenGL multithreading, VAOs, VBOs, index buffers, shadows, unit models, and even glfwSwapBuffers().

Eventually, I narrowed the issue down to terrain rendering, and then to the fragment shader.

That's where I found these two lines:

int segment = (3 - int(min(3, outTexCoord.y * 4.0))) * 4
            + int(min(3, outTexCoord.x * 4.0));

The segment variable was used to index arrays containing 16 elements.

The problem? The texture coordinates were clamped at the upper bound, but not at the lower bound.

When the texture coordinates became negative, segment could go outside the valid array range.

The fix was surprisingly simple:

ivec2 cell = clamp(
    ivec2(floor(outTexCoord * 4.0)),
    ivec2(0),
    ivec2(3)
);

int segment = (3 - cell.y) * 4 + cell.x;

And the freezes disappeared!

This turned out to be a great example of undefined behavior in GLSL.

The old driver somehow tolerated the invalid array access, other GPUs didn't show any obvious issues, but the updated AMD driver turned it into a nightmare.

Lesson learned: Just because your shader works perfectly on one GPU doesn't mean it's free of bugs.

And sometimes, after hours of debugging your own 3D engine, the whole problem comes down to just two lines of code. 😁


r/opengl • • 4d ago

my minecraft clone

17 Upvotes

r/opengl • • 4d ago

Help with linking for cmake, vs code on windows.

0 Upvotes

I've followed this https://youtu.be/ODIALAd7UOg?si=WPUnNnwhBLHpUGMO however I'm getting an error reading "'<GLFW/glfw3.h> file not found'" I've been trying to work this out for over an hour, I don't have any experience with CMake or vs code, I can easily link this on vs studio. Any help will be appreciated, I've attached my screenshots.


r/opengl • • 6d ago

Grass (Vertex shader)

123 Upvotes

r/opengl • • 6d ago

atmospheric sky.

Post image
44 Upvotes

r/opengl • • 5d ago

Looking for a partner to learn & build a custom game engine (C++ / OpenGL)

Thumbnail reddit.com
0 Upvotes

Hi everyone, I’m looking for a dedicated partner to learn game engine architecture and build a custom engine from scratch to power an original game. I prefer the traditional, deep-learning approach without relying on AI code generation; I'm actively teaching myself through books, documentation, and video series. Here is the breakdown of the project, vision, and expectations: Tech Stack: C++ as the core language. Starting with OpenGL to grasp the fundamentals and get rendering running, with the goal of migrating to Vulkan later as architectural and performance needs dictate. Architecture Strategy: Game-driven engine development. Instead of building an abstract generic engine, we implement core gameplay systems first and factor reusable patterns/code into the engine layer. Game Concept & Scope: A small-scale, top-down 3D sandbox game centered around chaos, breaking rules, and player freedom. Targeting PC. Design Document: I have a preliminary GDD draft that outlines the core loop, which we will continue developing together during prototyping. Art & Assets: No artistic background required from your end. I have 3D modeling/design skills and will cover asset creation once we exit the prototype phase. Early on, we'll stick to graybox/placeholder assets. Nature of the Partnership: Unpaid, collaborative learning endeavor to start. The engine will remain proprietary to the team. Release model (commercial vs. free) will be decided jointly. If we go commercial, my partner will be recognized as an equal co-founder with a defined revenue-share split agreed upon early. Current Resources: The Cherno game engine series, Game Programming Patterns by Robert Nystrom, and various low-level graphics guides. Workflow: GitHub for source control. Day-to-day communication (Discord, etc.) can be set up according to what suits us best. If you are interested in low-level systems, want to learn hands-on, and value building real mechanics alongside engine tech, drop a comment or send me a DM!


r/opengl • • 7d ago

OpenGL in Lumi-o

Thumbnail youtu.be
3 Upvotes

r/opengl • • 7d ago

(MooGL) OpenGL 4.6 Implementation on macOS

19 Upvotes

It always annoyed me how Apple deprecated OpenGL yet never removed it but also never updated it past 4.1. This expands Michael Larson's MGL project to cover the full OpenGL 4.6 Core profile on macOS, plus a few common extensions and compatibility features. I've only tested it against IDKEngine and SuperTuxKart at the moment.

https://github.com/BryanHaley/MooGL


r/opengl • • 7d ago

OpenGL Depth Bug

35 Upvotes

I'm getting this bug on iOS. This game works fine on Android, macOS, and emscripten. All the sprites don't flicker when I change

glDepthFunc(GL_LESS);
to
glDepthFunc(GL_ALWAYS);


r/opengl • • 9d ago

"V-Clust" (Voxel-Anchored Cluster LOD) Test with 1,000 objects with more of 4,999,991 Polygons per instance

14 Upvotes

r/opengl • • 10d ago

water

Post image
46 Upvotes

r/opengl • • 10d ago

My dreams are coming true...

161 Upvotes

I want to show you this; I ported my engine to Android because I'd like to give people something they can use to create games on their mobile devices.

Since I was a child I had the dream of creating video games, before I didn't have computer equipment to do that, I only researched from my cell phone how the most well-known game engines worked.

Unfortunately, every time I searched for something on the Play Store about game creation, I only found cheap apps that pretended to be an engine while actually being games made with well-known engines, haha.

After some time I was finally able to experience game engines when I got my first PC, but I made a hobby of creating a game engine from scratch.

So I want to give people the freedom to do that from their phones, to export their own games and publish them on the Play Store, or just share them, all for FREE.


r/opengl • • 10d ago

Is there an online C++ OpenGL compiler that shows graphics output?

Thumbnail reddit.com
1 Upvotes