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 9h ago

(Fuse Engine) Graphics Update - OpenGL 4.3

Enable HLS to view with audio, or disable this notification

22 Upvotes

I've made some graphical updates to my game engine.

Now we can create terrain, procedural skies (day and night), and volumetric clouds (I'm still adjusting them).

My future implementation will be oceans.

repo: https://github.com/Krueels/FuseEngine


r/opengl 9h ago

Update : AO46 reached OpenGL 4.3 context

2 Upvotes

AO46 has reached a new milestone: Mesa can now successfully create an OpenGL 4.3 context on macOS.

This is a step beyond the previous 4.1 context ceiling and means the driver now exposes enough required functionality for Mesa to advertise and initialize a 4.3 core context.

This does not yet imply full OpenGL 4.3 conformance, but it marks a major architectural step toward the final OpenGL 4.6 target.

AO46 is now operating beyond the version officially exposed by Apple’s legacy OpenGL stack.


r/opengl 4h ago

AO46 reaches OpenGL 4.6 Core profile functionality

0 Upvotes

AO46 has now reached OpenGL 4.6 Core Profile on macOS. 🔥

Apple’s native OpenGL stack stopped at 4.1, while AO46 now targets the final desktop OpenGL specification through its Mesa/Gallium + Metal backend.

Next focus: feature completeness, stability, and CTS-level validation.

From 3.x bring-up to 4.6 Core. The version ladder is officially finished. 🗿


r/opengl 1d ago

My Graphics Programming Journey

Thumbnail
3 Upvotes

r/opengl 1d ago

Help needed with camera matrix code, I am going insane!!

2 Upvotes

A year or so ago, I was doing an OpenGL project, and I somehow just defined the camera by its rotation matrix and position, and then I fed that into a [16] array and handed it to OpenGL, and it worked.

Fast forward to today. I lost the old code in a computer burnout, and the backup was corrupted. Now everyone tells me to simply use glMatrixMode(GL_MODELVIEW) and glLoadMatrixf(cameraMatrix). However, not only is this not the same code as then (I KNOW there was no GL_MODELVIEW stuff), but this does not work. Instead of the world rotating around the camera, the world just rotates around itself in front of the camera. But everywhere I get the same code suggested (yes, I even tried ChatGPT, I am desperate!). or glMultMatrix, which is not that either and does the same wrong rotation.

What is my lost code??? What was that wonderfully sleak solution I once had???

Update: I managed a work around, but I would still love to somehow reconstruct the, IIRC, much sleaker, prettier code I lost, so suggestions are still more than welcome!

Update 2: As per request, I hereby upload what I believe is the relevant code. Note that the tabulation is horrible due to a problem with the IDE settings.

void renderscene()

{

if (keys[68] == 1){cameraMatrix[12] += 0.1*cam.v[0].v[0]; cameraMatrix[13] += 0.1*cam.v[0].v[1];}

if (keys[65] == 1){cameraMatrix[12] -= 0.1*cam.v[0].v[0]; cameraMatrix[13] -= 0.1*cam.v[0].v[1];}

if (keys[87] == 1){cameraMatrix[13] += 0.1*cam.v[0].v[0]; cameraMatrix[12] -= 0.1*cam.v[0].v[1];}

if (keys[83] == 1){cameraMatrix[13] -= 0.1*cam.v[0].v[0]; cameraMatrix[12] += 0.1*cam.v[0].v[1];}

if (keys[88] == 1){cameraMatrix[14] += 0.1;}

if (keys[90] == 1){cameraMatrix[14] -= 0.1;}

POINT p;

GetCursorPos(&p);

int mx = p.x;

int my = p.y;

float spin = (mx-200)*-0.001;

Vec3 axis(0,0,1);

cam.v[0] = rotate(cam.v[0],axis,spin);

cam.v[1] = rotate(cam.v[1],axis,spin);

cam.v[2] = rotate(cam.v[2],axis,spin);

spin = (my-200)*-0.01;

// cam.v[0] = rotate(cam.v[0],cam.v[0],spin);

cam.v[1] = rotate(cam.v[1],cam.v[0],spin);

cam.v[2] = rotate(cam.v[2],cam.v[0],spin);

SetCursorPos(200, 200);

cameraMatrix[0] = cam.v[0].v[0]; cameraMatrix[1] = cam.v[1].v[0]; cameraMatrix[2] = cam.v[2].v[0];

cameraMatrix[4] = cam.v[0].v[1]; cameraMatrix[5] = cam.v[1].v[1]; cameraMatrix[6] = cam.v[2].v[1];

cameraMatrix[8] = cam.v[0].v[2]; cameraMatrix[9] = cam.v[1].v[2]; cameraMatrix[10] = cam.v[2].v[2];

/*

cameraMatrix[0] = cam.v[0].v[0]; cameraMatrix[1] = cam.v[0].v[1]; cameraMatrix[2] = cam.v[0].v[2];

cameraMatrix[4] = cam.v[1].v[0]; cameraMatrix[5] = cam.v[1].v[1]; cameraMatrix[6] = cam.v[1].v[2];

cameraMatrix[8] = cam.v[2].v[0]; cameraMatrix[9] = cam.v[2].v[1]; cameraMatrix[10] = cam.v[2].v[2];

*/

Vec3 temp(cameraMatrix[12],cameraMatrix[13],cameraMatrix[14]);

cameraMatrix[12] = 0; cameraMatrix[13] = 0; cameraMatrix[14] = 0;

glMatrixMode(GL_MODELVIEW);

glLoadMatrixf(cameraMatrix);

glTranslatef(-temp.v[0],-temp.v[1],-temp.v[2]);

/* OpenGL animation code goes here */

glClearColor (0.0f, 0.0f, 0.0f, 0.0f);

glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

glPushMatrix ();

glBegin (GL_TRIANGLES);

for (int i=-5;i<6;i++){

glColor3f (1.0f, 0.0f, 0.0f); glVertex3f (a.v[0],a.v[1]+i,a.v[2]);

glColor3f (0.0f, 1.0f, 0.0f); glVertex3f (b.v[0],b.v[1]+i,b.v[2]);

glColor3f (0.0f, 0.0f, 1.0f); glVertex3f (c.v[0],c.v[1]+i,c.v[2]);

}

glEnd ();

glPopMatrix ();

SwapBuffers (hDC);

Sleep (1);

cameraMatrix[12] = temp.v[0]; cameraMatrix[13] = temp.v[1]; cameraMatrix[14] = temp.v[2];

}


r/opengl 1d ago

Auda con los MIPs

3 Upvotes

Alguien puede ayudarme a determinar por qué al renderizar a un mip diferente de 0 no veo nada? El mip base funciona perfectamente. También ya confirmé que el viewport se actualice, etc.

Este es el código que tengo para crear el fbo y generar los mips, hay algo que me falte? Gracias de antemano :)

InitFBO::InitFBO(int w, int h, GLenum internalFormat)
{
    glGenTextures(1, &texture);
    glBindTexture(GL_TEXTURE_2D, texture);

    for (int mip = 0; mip < 8; ++mip)
    {
        int mipW = std::max(1, w >> mip);
        int mipH = std::max(1, h >> mip);

        glTexImage2D(GL_TEXTURE_2D, mip, internalFormat, mipW, mipH, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr);
    }

    float borderColor[] = {0.0f, 0.0f, 0.0f, 1.0f};
    glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_BORDER_COLOR, borderColor);

    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);

    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
    glBindTexture(GL_TEXTURE_2D, 0);


    // FBO
    glGenFramebuffers(1, &fbo);
    glBindFramebuffer(GL_FRAMEBUFFER, fbo);
    glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture, 0);

    GLenum drawBuffers[1] = {GL_COLOR_ATTACHMENT0};
    glDrawBuffers(1, drawBuffers);

    if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE)
        std::cerr << "Error";

    glBindFramebuffer(GL_FRAMEBUFFER, 0);
}

r/opengl 2d ago

Finally finished camera movement

Enable HLS to view with audio, or disable this notification

37 Upvotes

Finally i finished implementing camera movement to my OpenGL ES demo, still very basic tho but it works.


r/opengl 2d ago

(Fuse Engine) Spider AI upgrade - OpenGL 3.3

Enable HLS to view with audio, or disable this notification

53 Upvotes

I made this AI system for the spider to follow the player.

I'm not using any navmesh or pathfinding, it's just a mix of mathematical workarounds.

repo: https://github.com/Krueels/FuseEngine


r/opengl 4d ago

What I learned after 5 months of daily work on my C++ OpenGL engine

Thumbnail gallery
208 Upvotes

I don't want this to be just another "look at my project" post, but rather something useful for beginners diving into OpenGL/C++. (Second is April version)

This is the result of 5 months of non-stop daily work on my pet project engine (OpenGL 4.6 + Bullet Physics + Dear ImGui + miniaudio+ mixamo riggng).

I forced myself through a grueling schedule: only taking 2 days off per week starting in July, and using every trick possible to free up time from university. I’m completely burnt out and just need a rest. But before I step away, here are 13 honest takeaways from my experience(think this is "Effective C++", but way less polished):

1.      Don't treat AI as a silver bullet. AI won't replace a solid book or article because structured reading sticks in memory better. Use AI for what it's great at: quickly finding specific tech concepts or algorithms without spending hours searching;

2.      Books are often too basic. Don't get stuck reading forever. I read one book on OpenGL and one on GLSL, but that wasn't nearly enough to implement things like IBL (Image-Based Lighting). You'll have to read articles, papers, and specs, docs, etc;

  1. Ditch cube-based skyboxes if you can. Dealing with 6 separate cubemap faces (or a cross-layout texture you have to slice) was a pain. Using a single equirectangular image instead made things much simpler — one texture, no seams to worry about between faces.

4.    I tried implementing Data-Oriented Design (DOD), but ended up sticking with Object-Oriented Programming (OOP) for most systems. The web of circular dependencies in pure DOD drove me crazy;

5.      Log everything and profile early. Logging is your best friend when debugging graphics and physics pipelines, starting on another device when exporting(in file text log if console not available).

6.     I had my custom XOR decryption logic break even though the algorithm and key looked solid — turned out to be a text/file encoding issue. Spent way too much time debugging this(((

7.      Always enable viewport face orientation in Blender to make sure your normals are facing outward (blue). My terrain mesh had inverted normals, and I was losing my mind trying to fix this in code;

8.      Emission output in shaders. If you get weird visual artifacts/noise when implementing Emissive maps, make sure the emission output is properly linked and handled across all required shader pipelines, not just a single pass;

9.      Sometimes don't forget clean up your resources. Handle your GPU memory allocation carefully. When your OS freezes completely or crashes, 99% of the time it's a severe memory leak;

10.  Skeletal Animation. I set a max limit (e.g., 255 bones) and use recursive node hierarchy processing for complex models. I do not Fold expressions realized , but classic recursion handled complex GLTF model loading just fine;

11.  CMake can be a headache. Book on CMake gave me mostly basic theory, except for CPack. Neither books nor AI gave me ideal project structures. I still have a love-hate relationship with CMake;

12.  Beware of circular dependencies in headers. As your header files count grows, cyclic dependencies will haunt you. Keep your includes clean and rely on forward declarations where possible;

Don't forget about multithreading. I encountered a problem where it wouldn't start on my laptop; it just showed a blank screen and that's it, and the CPU wasn't even working. I'm thinking I'll either do it through separate threads or TBB, but I honestly don't know because I'm tired.

Final thoughts: I see people working on their engines for 5 years, and their projects are incredible. But I didn't have 5 years — I had 5 months, and I pushed myself to the absolute limit. By month 3, I was already struggling with burn-out and constant headaches.

My biggest advice? Do a little bit every day instead of destroying your health. And skip the "wake up at 5 AM" hustle advice — rest is just as critical as writing code.

If you wanna try this-> the demo is up on https://dokich-crcr.itch.io/tentacle-shippuden-enty-furry-beast, and I'm finally taking a long-overdue break(one week, and shit university starts again).


r/opengl 4d ago

(Fuse Engine) Spider procedural walk - OpenGL 3.3

Enable HLS to view with audio, or disable this notification

70 Upvotes

The system is still awful; the spider can only walk on flat surfaces. Any other surface causes strange bugs.

repo: https://github.com/Krueels/FuseEngine


r/opengl 5d ago

Deferred Rendering

Thumbnail
4 Upvotes

r/opengl 7d ago

I tried to adjust the Mandelbrot set rendering algorithm in OpenGL, but this is what I got:

Thumbnail gallery
9 Upvotes

r/opengl 6d ago

Iron Grid Engine Alpha — C++ performance, Python scripting, built-in AI tools

Thumbnail
0 Upvotes

r/opengl 7d ago

Tech Demo of Matrix Engine 2

10 Upvotes

Matrix Engine 2 is a custom game engine forked from pathos game engine, source code is here https://github.com/Soft-Sprint-Studios/Matrix-Engine-2 and i made a tech demo of it https://www.youtube.com/watch?v=3WjoSsY1k24


r/opengl 7d ago

Help Stylo Gravity Tab 8 32GB Silver

2 Upvotes

Just asking a simple question but does anybody know if the tablet "Stylo Gravity Tab 8 32GB Silver" has open GL 3.0 or higher I wanna buy it but I need it to support that


r/opengl 8d ago

(Fuse Engine) Decal System - OpenGL 3.3

Enable HLS to view with audio, or disable this notification

57 Upvotes

Mesh-based decal system I made last night.

Foldable decals compatible with complex surfaces.

repo: https://github.com/Krueels/FuseEngine


r/opengl 7d ago

WebGL compatibility doing something strange:

Thumbnail gallery
5 Upvotes

You can see from the screenshots that it well supports WebGL... but not in WWV?

Looked at the "detailed error info", no idea what I'm looking at.

Browser: Mozilla Firefox

Hardware: Thinkpad T410 i5 (Could that possibly be why?)

Distro: Debian 12 Bookworm, KDE Plasma 6

edit: This is worldwideview.dev btw, where I encountered the issue.


r/opengl 8d ago

glGenBuffers stops entire script

2 Upvotes

Hey everyone, I am new to opengl and gotta say, I'm loving it! Its just that I ran into one small bug (actually its kind of big), My program wouldn't create a window and so I started putting printf("test") around the script and I found out that glGenBuffers makes my ENTIRE script stop

I'm following LearnOpenGL and using GLAD aswell as GLFW heres the script:

#include <glad.h>

#define GLFW_DLL

#include <GLFW/glfw3.h>

#include <stdio.h>

#include <stdlib.h>

#include <stdbool.h>

void framebuffer_size_callback(GLFWwindow* window, int width, int height)

{

glViewport(0,0,width,height);

}

void process_input(GLFWwindow* window)

{

if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)

{

glfwSetWindowShouldClose(window, true);

}

}

int main()

{

float Vertices[10] = {

-0.5,-0.5,0,

0.5,-0.5,0,

0, 0.5,0};

const char *Vertex_Shader_Source = "#version 330 core\n"

"layout (location = 0) in vec3 aPos;\n"

"void main()\n"

"{\n"

" gl_Position = vec4(aPos.x, aPos.y, aPos.z, 1.0);\n"

"}\0";

printf("WORK1");

const char *Fragment_Shader_Source = "#version 330 core\n"

"out vec4 FragColor;\n"

"void main()\n"

"{\n"

" FragColor = vec4(1.0f,0,0,1.0f)"

"}\0";

printf("WORK1");

unsigned int VBO;

printf("WORK1");

glGenBuffers(1, &VBO);

printf("WORK1");

glBindBuffer(GL_ARRAY_BUFFER, VBO);

glBufferData(GL_ARRAY_BUFFER, sizeof(Vertices), Vertices, GL_STATIC_DRAW);

unsigned int VAO;

glGenVertexArrays(1, &VAO);

unsigned int Vertex_Shader;

Vertex_Shader = glCreateShader(GL_VERTEX_SHADER);

glShaderSource(Vertex_Shader, 1, &Vertex_Shader_Source, NULL);

glCompileShader(Vertex_Shader);

unsigned int Fragment_Shader;

Fragment_Shader = glCreateShader(GL_FRAGMENT_SHADER);

glShaderSource(Fragment_Shader, 1, &Fragment_Shader_Source, NULL);

glCompileShader(Fragment_Shader);

int Success;

char InfoLog[512];

glGetShaderiv(Vertex_Shader, GL_COMPILE_STATUS, &Success);

if (!Success)

{

glGetShaderInfoLog(Vertex_Shader, 512, NULL, InfoLog);

printf("VERTEX_SHADER FAILED TO COMPILE\n", InfoLog);

printf("\n compiler failed with exit code 1");

}

int Success2;

char InfoLog2[512];

glGetShaderiv(Fragment_Shader, GL_COMPILE_STATUS, &Success2);

if (!Success2)

{

glGetShaderInfoLog(Vertex_Shader, 512, NULL, InfoLog2);

printf("FRAGMENT_SHADER FAILED TO COMPILE\n", InfoLog2);

printf("\n compiler failed with exit code 1");

}

unsigned int ShaderProgram;

ShaderProgram = glCreateProgram();

glAttachShader(ShaderProgram, Vertex_Shader);

glAttachShader(ShaderProgram, Fragment_Shader);

glLinkProgram(ShaderProgram);

int SuccessProgram;

char InfoLogProgram[512];

glGetProgramiv(ShaderProgram, GL_COMPILE_STATUS, &SuccessProgram);

if (!SuccessProgram)

{

glGetProgramInfoLog(ShaderProgram, 512, NULL, InfoLogProgram);

printf("FRAGMENT_SHADER FAILED TO COMPILE\n", InfoLogProgram);

printf("\n compiler failed with exit code 1");

}

glUseProgram(ShaderProgram);

glDeleteShader(Vertex_Shader);

glDeleteShader(Fragment_Shader);

glBindVertexArray(VAO);

glBindBuffer(GL_ARRAY_BUFFER, VBO);

glBufferData(GL_ARRAY_BUFFER, sizeof(Vertices), Vertices, GL_STATIC_DRAW);

printf("glafd");

GLFWwindow* window = glfwCreateWindow(800,600, "Learning", NULL, NULL);

if (window == NULL)

{

printf("GLFW COULDNT CREATE WINDOW");

glfwTerminate();

return -1;

}

glfwMakeContextCurrent(window);

if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))

{

printf("Failed to load GLAD");

return -1;

}

glViewport(0,0,800,600);

glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);

glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(float), (void*)0);

glEnableVertexAttribArray(0);

glUseProgram(ShaderProgram);

glBindVertexArray(VAO);

glDrawArrays(GL_TRIANGLES, 0, 3);

while(!glfwWindowShouldClose(window))

{

glClearColor(0.2f, 0.3f, 0.3f, 1.0f);

glClear(GL_COLOR_BUFFER_BIT);

process_input(window);

glfwSwapBuffers(window);

glfwPollEvents();

}

glfwTerminate();

return 0;

}

please help


r/opengl 8d ago

Started a roadmap for DX12 also ............. after Vulkan

2 Upvotes

After the clash back I got from the community regarding Vulkan , instead of papering only over that , I have decided to empty that workspace for Microsoft's DX12 now .

However to say , OpenGL recently reached 4.1 capability context making yesterday

[ref https://www.reddit.com/r/opengl/comments/1vvdqih/ao46s_core_ceiling_raised_from_33_to_4x_range/ ]

And now am deciding that why not include Microsoft's Graphics APIs also

Now many would on seeing the above line say in comments that "Crossover , Wine and Apple GPTK exist bro, and that am about to just paste components and claim its my driver"

But it exists in the same way MoltenVK exists for Vulkan

MoltenVK existing never meant that there was no space to design another Vulkan path , and similarly CrossOver , Wine , GPTK , D3DMetal and DXMT existing does not mean D3D12 itself has somehow become a solved architecture on macOS.

The direction I am taking here is a bit different .

The new workspace is Microsoft_AppleDrivers , and the first target inside it is ADX12 , basically taking the same idea behind AO46 but now for D3D12.

The intended path currently looks more like

Windows D3D12 app -> Wine/CrossOver -> ADX12 D3D12 + DXGI ABI -> ADX12 runtime/device model -> ADXIL/NIR compiler path -> native Metal backend -> AGX

So Wine/CrossOver here are basically providing the Windows hosting environment , not becoming the graphics driver itself.

And yes , vkd3d-proton is going to be heavily useful here . It would honestly be stupid to ignore years of work already done figuring out D3D12 COM behaviour , descriptor semantics , resource states , barriers , synchronization , DXGI behaviour , feature reporting and hundreds of weird game compatibility cases.

But the point is not to take vkd3d-proton , replace Vulkan calls with Metal calls and then announce that a new driver has materialized from the heavens 💀

vkd3d-proton for this project is much more useful as a semantic/reference oracle .

The internal architecture itself is being designed around a backend neutral D3D12 object model , something like

ID3D12Resource -> ADXResource -> backend resource

with the permanent fast path being native Metal rather than inheriting the Vulkan-shaped architecture of vkd3d-proton.

I can still keep AVK143 as a Vulkan reference backend for differential testing where it becomes useful , but it is not supposed to become the permanent backend of ADX12.

So basically the distinction is

CrossOver / Wine = runs the Windows environment

GPTK / D3DMetal / DXMT = already existing D3D translation solutions

vkd3d-proton = extremely valuable D3D12 behavioural reference and compatibility knowledge

ADX12 = attempt to own the D3D12 + DXGI userspace ABI , runtime/device model , shader/compiler path and native Metal backend as one designed stack

Which is why I am not really interested in pretending these projects do not exist .

I want to use what they already taught us , then design the parts differently where macOS and Metal actually justify doing so.

Basically AO46 , but for D3D12.

Would like some recommendations from community.


r/opengl 8d ago

OpenGLESScope (Android App) -

2 Upvotes

r/opengl 9d ago

(Fuse Engine) New Updates! - OpenGL 3.3

Enable HLS to view with audio, or disable this notification

70 Upvotes

- Intermediate sound system

- Sound system with object collision physics

- Skinned models

- Weapon system prepared for future weapons

- Input context

- Simple enemy system

- Debug drawer update

repo: https://github.com/Krueels/FuseEngine


r/opengl 9d ago

Was running the "World Wide View" project and ran into this issue?

Thumbnail gallery
1 Upvotes

You can see from the screenshots that it well supports WebGL... but not in WWV?

Browser: Mozilla Firefox

Hardware: Thinkpad T410 i5 (Could that possibly be why?)

Distro: Debian 12 Bookworm, KDE Plasma 6


r/opengl 9d ago

Engine update.

5 Upvotes

This iteration features:

- PBR materials
- SSAO
- CSM

and as a experiment sparse arrays.

https://youtu.be/BsA6x7S8TpE


r/opengl 10d ago

Making a top-down game with my 3D engine

Enable HLS to view with audio, or disable this notification

37 Upvotes

I'm using my engine to make a top-down RPG. The world is build in full 3D using Brush CSG. I've also built a cell-streaming system so the world can be procedurally generated forever.

The camera can be toggled between top down and first-person (in real time) via a console command, so I'm considering using that for dungeon fighting or just for cinematics.

Everything in the world that is not CSG brushwork is a sprite that always faces the player

ViciousSquid/Fio: Unified Liminal World Editor, Procedural Engine & Game Creation Toolkit inspired by Radiant and Hammer. Optimised for low-power CPUs.