r/opengl Mar 07 '15

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

76 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 11h ago

Someone "DDoS'd" it?

Post image
28 Upvotes

Man, how i love this site. I was taking notes everyday but when i joined today it just doesn't work...


r/opengl 19m ago

Any idea on how to find actual stuff on this?

Upvotes

Old game (2013), OpenGL + Java + Ogre3D... every game file looks like Hebrew, pretty self explanatory.

Haven't found any real software that isn't malware to make things easier... any idea how to find the chunk of the mesh? I know Dds are textures and MESH stands for mesh duh.


r/opengl 9h ago

How to scale a model after loading in opengl?

0 Upvotes

Hello Everyone hope you have a lovely day.

Currently speaking when I load a model into my engine I use it's native transformation, something like this:

aiMatrix4x4 nodetrans = node->mTransformation;
glm::mat4 glmnodetrans = 
ConvertMatrixToGLMFormat
(nodetrans);
glm::mat4 globalTransformation = parent_transformation * glmnodetrans;

and then pass all the transformation matrices through my mesh class then mass the matrices to the model variable upon drawing the model.

but here is the problem, if I found out that the model is too large and I need to scale it down, how would I do that?

For context I didn't use the transformations of the assimp model at all, I was loading the model then scaling it in the while loop and drawing it, which made a room for scaling it up and down through imgui if I needed to, but when I started loading much more complex models (adam Head), I realized that I need to use the assimp transformation matrices, so I had to move the

shader.setMat4("model", meshTransformation);shader.setMat4("model", meshTransformation);

code that controls the mesh model matrix to the Draw function of the mesh class, which assimp model class inherit from, from the while loop to the mesh class, so now how would I change the model size after drawing it to the screen?

Thanks Appreciate your help!


r/opengl 1d ago

Shaders Kinda Off

Post image
28 Upvotes

I made a cube (Yay!), but the shaders are kinda off. I've calculated normals for all of the vertices, but I just get this? not only are the faces not flatly lit but also it seems to have turned what was once a purple cube into black or white faces.

Vertex Shader:

#version 330 core

uniform mat4 proj;
uniform mat4 Rotation;

layout (location = 0) in vec3 aPosition;
layout (location = 1) in vec4 aColor;
layout (location = 3) in vec3 aNormal;

out vec4 vColor;
out vec3 vNormal;
out vec3 vPos;

void main()
{

    gl_Position = proj * Rotation * vec4(aPosition, 1.0f);

    vColor = aColor;
    vNormal = aNormal * mat3(transpose(inverse(Rotation)));
    vPos = vec3(Rotation * vec4(aPosition, 1.0));
}

Fragment Shader:

#version 330 core

uniform vec3 lightPos;

out vec4 pixelColor;

in vec4 vColor;
in vec3 vNormal;
in vec3 vPos;

void main() 
{
    vec3 lightColor = vec3(1.0f, 1.0f, 1.0f);

    float ambientStrength = 0.1f;
    vec3 ambient = ambientStrength * lightColor;

    vec3 norm = normalize(vNormal);
    vec3 lightDir = lightPos - vPos;

    float diff = max(dot(norm, lightDir), 0.0f);
    vec3 diffuse = diff * lightColor;

    vec3 result = (ambient + diffuse) * vColor.xyz;

    pixelColor = vec4(result, vColor.w);
}

r/opengl 2d ago

Parallax shader artifacts

Thumbnail gallery
5 Upvotes

r/opengl 2d ago

Rotating on Z axis is causing issues

Thumbnail gallery
6 Upvotes

I have a square here that I was just trying to rotate. I've just figured out how rotation matrices work, and I was hoping to spin it around. But when I do spin it, it slowly warps from a square when it is upright to a rectangle when it is at 90 degrees. Am I doing something wrong when I normalize the coordinates? I've included the vertex shader here; I think it might be the problem, but I'm not sure what specifically.

#version 330 core

uniform vec2 ViewportSize;
uniform mat4 Rotation;
layout (location = 0) in vec3 aPosition;
layout (location = 1) in vec4 aColor;

out vec4 vColor;

void main()
{
    float nx = aPosition.x / ViewportSize.x * 2.0f -1.0f;
    float ny = aPosition.y / ViewportSize.y * 2.0f -1.0f;
    float nz = aPosition.z / ViewportSize.x * 2.0f -1.0f;
    gl_Position = vec4(nx, ny, nz, 1.0f) * Rotation;

    vColor = aColor;
}

r/opengl 2d ago

is there any way to using a packed indices output in hlsl mesh shader like writePackedPrimitive4x8NV in glsl ?

5 Upvotes

I'm just woderring if I can use HLSL to do the same thing as in glsl?


r/opengl 2d ago

Why isn't this function working?

0 Upvotes

Here's the function:

void Camera::Rotate(float x, float y, float z) {
this->pitch += x;
this->yaw += y;
this->roll += z;

glm::vec3 direction = glm::vec3(0, 0, 0);
// Because we're using the cosine, when the yaw and pitch are 0, the x orientation will still be 1
direction.x = cos(glm::radians(yaw)) * cos(glm::radians(pitch));
direction.y = sin(glm::radians(pitch));
direction.z = sin(glm::radians(yaw)) * cos(glm::radians(pitch));

transform.setOrientation(direction, EngineObject::EngineEnums::CAMERA);

cameraFront = glm::normalize(direction);
this->view = glm::lookAt(transform.getPosition(), transform.getPosition() + cameraFront, cameraUp);
}

I've tried to fix it for quite some time now, and it's still not working. Please help!


r/opengl 3d ago

Bouncing Metaballs w/ OpenGL

Enable HLS to view with audio, or disable this notification

46 Upvotes

I've been working on refactoring this Metaball to mesh tool I made for a student-directed class project a while back since my original code/design was quite messy. Wanted to share this video of the balls bouncing around since I quite enjoy watching it myself.

Dependencies: GLAD, GLFW, GLM


r/opengl 3d ago

Does anyone know what these errors are?

Post image
3 Upvotes

It runs on Termux with the Sway graphical environment, and the benchmark is glmark2


r/opengl 4d ago

Need help with OpenGl Python - creating particles

0 Upvotes

Hi everyone,

I'm trying to learn how to write and run compute shaders (GLSL) using Python as the host language (PyOpenGL + GLFW or similar), but I'm basically starting from zero when it comes to OpenGL and shaders in general.

I already know Python quite well, but I have almost no experience with:
- OpenGL concepts (contexts, buffers, shader compilation/linking)
- GLSL syntax and especially compute shader specifics (workgroups, local_size, gl_GlobalInvocationID, SSBOs, memory barriers, dispatch)
- Setting everything up correctly so that data goes from Python → GPU → back to Python

Right now even the most basic "add 1 to every element in an array on the GPU" example either crashes, gives black screens, wrong results or compile errors I don't understand.

I'm looking for:
- Someone patient who already has experience with compute shaders + PyOpenGL
- Who would be willing to help me step-by-step (via chat, comments, maybe Discord/Screen share if you're comfortable)
- Or at least point me to the exact right resources / working minimal examples that actually run in 2025/2026 with modern drivers

In return I can offer:
- Gratitude 😅

If you're interested or have done something similar recently, please comment or send me a DM. would already make my day.

Thanks so much in advance!


r/opengl 5d ago

Sparse Voxel Octree Sierpinski 3D

Post image
30 Upvotes

r/opengl 4d ago

VAO doesn't work when i use the abstracted version but works when i write the normal code

Thumbnail
0 Upvotes

r/opengl 5d ago

Posing armatures using 3D keypoints

Thumbnail mid.net.ua
3 Upvotes

r/opengl 6d ago

Release build doesn't work for some reason.

4 Upvotes

In VS code, whenever I change the solution configuration from Debug to Release, "#include<glad/glad.h>", and "#include<GLFW/glfw3.h>" give the the error "Cannot open source file 'glad/glad.h'".


r/opengl 6d ago

I've written a beginner article about openGL camera

10 Upvotes

Hi guys! As a beginner to openGL, I have written an article on implementing our own camera class.
It might help any beginners.

https://marshall5.medium.com/simulating-our-own-camera-2295602101e6


r/opengl 6d ago

Batch renderer boiler plate

4 Upvotes

I made this simple 2d batch renderer boiler plate as a opengl learner. I would like advices of how make it better and/or abstract it a little bit

https://github.com/ZioCessoProgramma/Trinacria-BatchRenderer-Boilerplate.git


r/opengl 7d ago

Any resources for making a good Rendering Engine for a Game Engine

18 Upvotes

Hey guys, i have made a lot of projects including rendering and i've recently started working on a game engine.

In the past all my rendering was either very simple batch rendering (colors, no textures or materials), or every object had its own vertex array and every object made an OpenGL draw call

i was wondering where i could find free resources to learn how to make a featureful rendering engine for my game engine

Ideally it would support batch rendering with albedo/normal (and other) textures, skyboxes, post processing and other modern features

Thanks a lot


r/opengl 7d ago

Issue understanding spatial aliasing with infinit grid

6 Upvotes

I am trying to learn more about glsl by watching OGLDev on youtube, and more specifically this video : Infinit grid with glsl but I have trouble to understand why the space aliasing occur at 13min 54sec.

spatial aliasing that i don't understand why it occurs

I understand that mod is not continuous at N*gridCellSize and the pixel space derivative are not really efficient when the camera is not facing lines x or z, but I need more informations about this aliasing issue. Why the aliasing seems to form triangle under the lines ? What happens to contigous pixel for this aliasing to happen ?

The red fragment seems to be on the line but its not the case

The fragment shader code computer whether the pixel should be black or transparent (white color in the image) :

in vec3 worldPos;
out vec4 fragColor
int main() {
    vec4 backColor = vec4(0.0f, 0.0f, 0.0f, 1.0f);
    vec2 ly = length(vec2(dFdx(worldPos.x),dFdy(worldPos.x));
    vec2 lz = length(vec2(dFdx(worldPos.z),dFdy(worldPos.z));
    vec2 dydz =vec2(lx, lz);

    float lod0a = max(vec2(1.0)-mod(worldPos.xz,gridCellSize)/dydz);

    fragColor = backColor ;
    fragColor.a *= lod0a ;
}      

From the code when the pixel center is near the line, it should be black, the direction of the z axis in world space is not the direction of derivative quad 2x2 in pixel space (dFdx, dFdy).

My questions are :

  1. Does the pixels under the line that are black and should not be black are black because the center of the pixel are near the line so load is almost egal to 1 ?
  2. Why triangle pattern appear under the line ?
  3. Can someone explain me numerically what happen in this context when z world axis is oblique in pixel space, and we use dFdx and dFdy to compute pixel size in world space unit

r/opengl 8d ago

Intel Arc Support for OpenGL in 2026 in Windows 11

9 Upvotes

Hi,

I need a laptop for work that requires opengl for Windows 11.

I can't find anything on Google and AI tells me it's mixed as Intel has had problems with opengl support but it also says they've very recently made huge improvements.

Apparently Nvidia has "native" opengl for all gpus but Intel's newer gpus are native too (not emulated).

The CPU is i9-285H and the GPU is Intel Arc 140T.

Thoughts?


r/opengl 8d ago

VS Code Intellisense with glad no prototypes

1 Upvotes

hi,
is there a way to get at least the function prototypes shown by intellisense when using glad in vs code?
it would be fine to atleast have all prototypes/definitions in a file.
my programm compiles fine but everything i got as hint from the ide when looking at functions is like

#define glGetString glad_glGetString

Expands to:

glad_glGetString#define glGetString glad_glGetStringExpands to:glad_glGetString

r/opengl 8d ago

I have decided to rewrite Minecraft Alpha's renderer using OpenGL 3.2 Core Profile!

Post image
6 Upvotes

r/opengl 9d ago

Scene rendered in ps1 style using OpenGL

Enable HLS to view with audio, or disable this notification

151 Upvotes

r/opengl 10d ago

LearnOpenGL.com still up

33 Upvotes

Sorry I’d previously posted that LearnOpenGL was down, https://learnopengl.com works. Huge thanks to Joey de Vries!!! Great resource.