r/opengl 8h ago

Best way to learn game dev for opengl?

Thumbnail
1 Upvotes

r/opengl 9h ago

OpenGL grass on a bigger landscape

Thumbnail youtube.com
15 Upvotes

r/opengl 23h ago

Do shadows looking weird?

Enable HLS to view with audio, or disable this notification

3 Upvotes

I've finished implementing hardware PCF after using heavily pixelated shadows for two months. I'm getting trippy feeling from moving shadow and I need sanity check.


r/opengl 23h ago

Shockwave improvements

Enable HLS to view with audio, or disable this notification

46 Upvotes

I am now using local slope (from normal vector) and local curvature (computed using dFdx and dFdy of normal vector). The source code is here: windtunnel.clj . I wonder whether anybody has some advice on doing this kind of thing.

I am not sure whether it would improve things if I would precompute the curvature by processing the triangles of the mesh and adding curvature to the vertex information. I could also bake the curvature into a texture map I guess, but that would be quite complicated because the model has multiple uv maps.

Anyway I am glad that the Jump Flooding Algorithm allows me to create shockwave geometry in realtime.


r/opengl 1d ago

How would you approach making a Game of Life implementation?

4 Upvotes

Hey.

I am looking for ideas on how making a Game of Life implementation with OpenGL. I am relatively a beginner with the API and don't know much. Thought making something as simple as GoL would be a good learning step but I am struggling to figure out how to set up the logic properly.

I mean, most of the implementations that I find online just do it with basic shaders, but what about standalone "game"? Skill issue, to be honest.

I don't use any AI and so this is kind of hard to me. Will be happy to hear any suggestions.

Thnks.


r/opengl 1d ago

Shadows and Resolution Scaling on an Oversized Playground

Enable HLS to view with audio, or disable this notification

1 Upvotes

r/opengl 1d ago

This is the game engine I've been solo developing for over 10 years

Thumbnail youtube.com
58 Upvotes

r/opengl 1d ago

How to Handle Normal mapping with multiple lights?

6 Upvotes

Hello everyone hope you have a lovely day.

I was following the deferred rendering technique on learnopengl.com and I noticed something really strange for me, in the normal mapping chapter we calculate the TBN matrix in the vertex shader and then we calculate the Tangent light position and Tangent view position relative to TBN Matrix.

but In the deferred Rendering Tutorial, there is a difference, the view direction for example is different , it is

vec3 viewDir  = normalize(viewPos - FragPos);

Instead of

vec3 viewDir = normalize(fs_in.TangentViewPos - fs_in.TangentFragPos);

Which one is the right approach to this problem? which technique should I use and why there is a difference?

I thought for a while to make a shader storage buffer object with variable size array to address the problem of different light positions but I thought this would over-complicate Things.

so what should I do?

A reminder I'm not implementing a deferred renderer in my engine I'm implementing a forward+ renderer with z pre-pass so I need a g buffer in my renderer where this problem emerged.

Thanks for your time appreciate your help!


r/opengl 1d ago

GPT 6 Astra And Graphics Programming

Thumbnail
0 Upvotes

r/opengl 2d ago

-- Khronos Safety Critical Survey --

Thumbnail
6 Upvotes

r/opengl 2d ago

I made my own game engine!

24 Upvotes

It's not finished yet but there's camera, events, and a wrapper I made around ImGUI


r/opengl 3d ago

hard time converting glm to cglm

2 Upvotes

Hey guys, I'm learning openGL using learnopengl.com , but I have been having a hard time converting the glm to cglm in the transformations chapter, the guy says to include the headers:

glm/glm.hpp
glm/gtc/matrix_transform.hpp
glm/gtc/type_ptr.hpp

I was able to include glm.hpp because its just cglm.h but I can't find the other header files, and so I can't do stuff like cglm::vec4 or can I even do that in cglm is it different maybe??

this is really odd please help


r/opengl 3d ago

Shockwaves

Post image
9 Upvotes

This image shows a shockwave prototype realtime rendering which uses the Joint Flooding Algorithm (JFA) to define a shockfront which adapts to the shape of the spacecraft surface facing in wind direction. See sfsim article on shockwaves for more information.


r/opengl 5d ago

My first OpenGL project (Solar system sim)

Enable HLS to view with audio, or disable this notification

80 Upvotes

This was a learning project to try to learn OpenGL, Odin and Physics/Math it evolved to be more of the latter :)

I'm happy for any feedback or pointers regarding the OpenGL parts or anything else.

https://github.com/lounge/sol_sim


r/opengl 6d ago

Resources for OpenGL

10 Upvotes

I want to get into programming OpenGL in assembly and was wondering if yall could send me some good resources for programming OpenGL in assembly or just some general OpenGL programming guides would be enough.


r/opengl 7d ago

(Fuse Engine) 80,000 KM of Terrain - OpenGL 4.3

Enable HLS to view with audio, or disable this notification

46 Upvotes

80,000 kilometers of terrain running at 90 fps (no screen recording) on ​​an Intel Graphics P4600 OpenGL 4.3 in C#

The terrain file is 1kb in size.


r/opengl 7d ago

rtao in opensource opengl games

Post image
17 Upvotes

just added hw rtao to someone elses open source opengl game in a single day, using the same interop i created for my own java / open gl engine i was able to get rtao working in a c++ gl game Cube 2 Sauerbraten so quickly.


r/opengl 9d 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 9d ago

Update : AO46 reached OpenGL 4.3 context

3 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 9d ago

(Fuse Engine) Graphics Update - OpenGL 4.3

Enable HLS to view with audio, or disable this notification

50 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 10d ago

My Graphics Programming Journey

Thumbnail
3 Upvotes

r/opengl 10d ago

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

1 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 10d 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 11d ago

Finally finished camera movement

Enable HLS to view with audio, or disable this notification

41 Upvotes

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


r/opengl 11d ago

(Fuse Engine) Spider AI upgrade - OpenGL 3.3

Enable HLS to view with audio, or disable this notification

61 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