38,009 questions
0
votes
0
answers
34
views
OpenGL and OpenCL interoperability - Delphi
I've read that it's possible and better to run OpenCL instead of a Compute Shader, so I've been trying to build a test app where both share a VBO. According to what i've found, step one is creating a ...
Advice
0
votes
3
replies
111
views
I have a custom SDL2 graphical engine and i'd like to go isometric view
I gave a lot of time making a custom sdl2 based graphical engine in c++ and i'd like to move to isometric view rendering. This means being able to display 3d objects and i wonder if I should stick to ...
-2
votes
0
answers
69
views
PyOpenGL seems not to work with trimesh .obj through glDrawElementsInstanced [closed]
I have .obj files, which I load through trimesh.load, and then I prepare the vertex data and indices. However, PyOpenGL does not seem to draw the mesh correctly through glDrawElementsInstanced (the &...
-3
votes
1
answer
87
views
Should I reorder triangle vertices depending on their position to ensure correct winding (CW/CCW)?
I draw triangles in OpenGL using DrawArrays():
public void DrawTriangle(
Vector2 a,
Vector2 b,
Vector2 c,
ShapeOptions shapeOptions = null)
{
shapeOptions ??= PresentationConsts.Shape....
Advice
0
votes
2
replies
70
views
UI Element Detection
I am implementing a UI library, and I want to implement pixel-perfect hit detection.
For example, if a UI element is a red ellipse, when I click on a red pixel, I want a click event to be emitted; ...
2
votes
2
answers
93
views
Window goes black when enabling GL_DEPTH_TEST?
I have a problem that my window:
// gcc -o minimum main.c -lglut -lGL
#include <stdio.h>
#include <unistd.h>
#include <GL/gl.h>
#include <GL/glut.h>
extern void ...
Advice
0
votes
7
replies
110
views
Polyhedra from its vertices in OpenGL
I'm currently working on Voronoi polyhedra, and I already have software that generates all the vertices for me, but I haven't got any indexes to draw the polyhedra.
I know how to draw polygons and ...
0
votes
0
answers
67
views
wrong transformes for model loaded with assimp in opengl
Im trying to apply the model's transforms by walking the node heirarchy, but the poses are wrong (im not trying to animate it, just load it in a pose by using the transforms given in the gtlf file)
...
1
vote
0
answers
64
views
QComboBox popup not visible when placed in an overlay over QVTKOpenGLNativeWidget in fullscreen on Windows
I'm embedding a VTK rendering widget inside a Qt 6 app using QVTKOpenGLNativeWidget.
The window contains a QVTKOpenGLNativeWidget used for 3D rendering, wrapped inside a QFrame.
On top of it, a ...
Advice
0
votes
3
replies
153
views
How do I draw a line using triangles in OpenGL?
In my code, I useing draw line to draw model selection line and error edge line ,useing draw triangle to draw 3D model.
Using the model's openmesh handle, edges are recorded and drawn.
...
Advice
1
vote
2
replies
228
views
How do I create a raycast in C++ for a game
I have been making a 3D game from scratch using opengl and C++ and I want to know how I can make a ray casting class in C++ for my game where I can call it when ever I need to, to check for things ...
0
votes
1
answer
105
views
SDL3 + OpenGL in c++ is thowing empty SDL_Init erros when making a window in Wayland [duplicate]
I have installed the packages that I need (as far as I know), and the window throws an empty error when I run it.
Output is:
/home/bence/Programming/cpp/game1/cmake-build-debug/game1
SDL_Init Error:
...
3
votes
2
answers
97
views
What does a min filter do on the same mip level?
In a graphics API like Vulkan, you have VkFilter, which can be NEAREST or LINEAR. Leaving aside the mipmap filtering, which is another thing altogether, I'm trying to understand what the point of the ...
1
vote
1
answer
109
views
Non-uniform access by indexing vs non-uniform access from a switch case or if-else statement
This question is supposed to be in the most general sense possible, this is because I'm using the Slang shading language to apply potentially to multiple graphics APIs.
In OpenGL and Vulkan the ...
0
votes
0
answers
44
views
pyglet window disappearing on second monitor
I can create a simple window on my main monitor, but when I try to perform the same function on a secondary monitor, the window appears for a second or so, then disappears.
Initially, I was attempting ...
0
votes
2
answers
198
views
Manually generated texture shows unexpected results, OpenGL
I am trying to generate texture data manually. The texture shows in unexpected ways. So I stripped all to two simple cases for 1x1 and 2x2 texture. When I provide 1x1 texture it is ok, but it is not ...
2
votes
1
answer
63
views
Are storage buffers bounds-checked by default?
I found a comment on Reddit saying:
SSBO accesses are bound checked at runtime by the shader to prevent
segmentation faults (which is why the descriptor of a SSBO is a
pointer and size). I think this ...
3
votes
1
answer
161
views
Square not rendered in OpenGL
I'm trying to program a simple game in java using lwjgl and OpenGL but I'm not able to render a square to the window. Can someone help?
The render function in render class is called evert frame and ...
1
vote
1
answer
146
views
Why is eglCreateContext() giving me EGL_BAD_ALLOC?
Preface: I'm aware fixed-function OpenGL is obsolete, I'm just using it for fun and learning.
I'm trying to set up a classic fixed-function OpenGL context with Xlib and EGL. However, I'm getting ...
1
vote
0
answers
136
views
How do glOrtho and glVertex3f work together
I have some code that is supposed to draw a flat rectangle behind a rotating cube.
However, the rectangle keeps appearing in front of the cube no matter what I change in glOrtho and glVertex3f for ...
-1
votes
2
answers
135
views
Instead of a texture atlas, dump all images in one buffer
In a texture atlas the individual images are arranged geometrically. The texture atlas itself is an image that can be viewed in any image viewer.
I was wondering if it was possible, to simply dump all ...
2
votes
2
answers
126
views
Simple GLFW animation of a circle fails
This is supposed to animate half of a clockwise circle, as though a particle was moving in a circle at constant speed:
// gcc simple6.c -o simple6 -lglfw -lGL -lm
// Fedora Linux 42 (Workstation ...
2
votes
0
answers
160
views
deltaTime jitter with OpenGL in SDL2?
When running a simple SDL2/OpenGL demo with VSync on Windows 10, I noticed that deltaTime between frames fluctuates by 1–4 ms at 60 Hz. I expect some jitter from OS scheduling, but 4 ms seems large ...
1
vote
1
answer
48
views
Does GLSL spec permit cases when PS-input mismatched with VS-output?
On my NVIDIA GPU these 2 shaders work fine:
// VS
#version 450
layout(location = 0) in vec4 inPosition;
layout(location = 0) out struct {
vec2 dummy;
uvec4 variableInStruct;
} testStruct;
void ...
1
vote
1
answer
154
views
glMemoryBarrier and compute shaders clarification
I've read the Khronos wiki Memory_Model page and the glMemoryBarrier
docs, and I'm still confused.
I have two buffers for vertex data (A and B) that I glMapBufferRange, memcpy into them, then ...
0
votes
1
answer
146
views
Changing OpenGL (wgl) context to a different window handle
I am creating an application using OpenGL (4.2). By default, the rendering is done on a panel in a window, it works without issues, but the panel can be docked/undocked, which causes the underlying ...
0
votes
0
answers
55
views
OpenGL 4.6 and context sharing with GLFW3 [duplicate]
I have recently moved on newer hardware (laptop with rtx 5070) and so with new nvdia driver (version 575). I am now using OpenGL 4.6 rather than 3.3 I used before and now I am struggling ...
1
vote
1
answer
106
views
Black screen when using GL3 (OpenGL) with Maven and JOGL
I am trying to begin working with OpenGL by drawing a quad with the simplest of shaders, but when using GL3 capabilities, I just get a black screen. I wasn't able to really debug this because (a) I ...
0
votes
1
answer
140
views
Segfault when calling OpenGL functions from other file
I am creating a small abstraction layer for an engine, but when I call any OpenGL API functions from a class, the code segfaults. I'm using glad and glfw and there aren't any errors from either, and ...
2
votes
1
answer
86
views
Transformations Involved in Gribb & Hartmann Frustum Construction
I'm currently working on implementing a Gribb & Hartmann Frustum Construction algorithm into my 3D game engine for frustum culling, but I find I need more clarification on the transformations ...
-3
votes
2
answers
137
views
cannot determine which instance of overloaded function "Init::Init" is intended [closed]
currently working in c++ trying to create an Init class to initialize some of the behavior in GLFW and GLEW. Basically I'm moving the whole setup portion to a new class called Init. Init will have ...
3
votes
1
answer
96
views
glBegin(GL_QUADS) is not drawing a kite
I am trying to draw a kite:
...using glBegin(GL_QUADS):
// g++ main.cpp -lopengl32 -lgdi32 -municode
#include <windows.h>
#include <GL/gl.h>
#include <cstdlib> //system
#include &...
1
vote
1
answer
92
views
Why isn't this program correctly texturing models?
I'm trying to basic 3D rendering working using OpenGL 1.1:
#define GLFW_INCLUDE_GLU
#include <GLFW/glfw3.h>
#include <gl/GL.h>
#include <gl/GLU.h>
#include <stdio.h>
#include &...
1
vote
1
answer
122
views
Modern C++ Alternative to Macros for Wrapping OpenGL/SDL State Functions
I'm developing a C++20 application using OpenGL and SDL3, with a window_manager class that wraps windowing and OpenGL state management. Instead of writing separate member functions for each OpenGL/SDL ...
3
votes
1
answer
140
views
Is there a way to get the index of a draw call?
I know there's gl_VertexIndex and gl_VertexID, but let's just say I have an index buffer that looks like:
[3, 0, 4, 1, 2, 3]
The first vertex processed in the vertex shader with an indexed draw ...
5
votes
1
answer
121
views
OpenGL fails to draw textured triangle?
In this program the 3 triangles aren't drawn, even when I replace the texture by vec4(0.0f, 0.5f, 0.0f, 1.0f);, trying to draw the third triangle in green:
#define GLFW_INCLUDE_NONE
#include <GLFW/...
0
votes
0
answers
75
views
GLSL Program crashing when attempting to include a textured background [duplicate]
I have been displaying animations:
#include <GL/glew.h>
#include <GLFW/glfw3.h>
#include <iostream>
#include <fstream>
#include <sstream>
#include <cmath>
#include &...
0
votes
0
answers
78
views
Reliably Calling OpenGL Functions in a DLL Injection in Windows
I'm developing a DLL injection tool for an OpenGL application (core profile, version >3.3) to intercept geometry data. I need to call OpenGL functions like glDrawElements and glGetIntegerv from my ...
1
vote
1
answer
95
views
Opengl stencil buffer bleeding [closed]
I have an opengl problem but the minimal code for showcase became 450 lines of code so I uploaded it to github instead:
https://github.com/Siamaster/opengltest
What I'm trying to do here is to define ...
0
votes
1
answer
108
views
Create two OpenGL contexts (views, subwindows) in the one MFC window
I need to make two independent OpenGL views in one MFC dialog-based window. This views will show different scenes with different shaders and different VAO. It's not difficult to me to make the one ...
0
votes
0
answers
158
views
SDL_GL_CreateContext() fails without an error message
I'm building an OpenGL 4.6 application using SDL3 and GLAD, compiled with g++:
// g++ -Wall -Ofast main.cpp include/glad/glad.c -Iinclude/SDL3 -Linclude/SDL3 -lSDL3 -lopengl32 -o build/program
#define ...
1
vote
1
answer
113
views
How to make memcpy asynchronous when uploading textures with OpenGL PBOs
I'm using OpenGL Pixel Buffer Objects (PBOs) with persistent mapped buffers to asynchronously update textures in my Qt app. In my render loop, I do something like this:
void GLWidget::updateTextures() ...
13
votes
0
answers
704
views
Forcing non-exclusive borderless fullscreen with SDL3 + OpenGL on Windows 11
Creating a borderless OpenGL window with SDL3 on Windows at the native display resolution results in the window unexpectedly switching to an exclusive fullscreen mode.
This happens specifically after ...
2
votes
1
answer
68
views
Does glTexImage2D() or glTexSubImage2D() break a bindless texture handle?
i'm using bindless textures with glGetTextureHandleARB() + glMakeTextureHandleResidentARB(), and trying to figure out if the handle becomes invalid after calling glTexImage2D() or glTexSubImage2D() (...
0
votes
1
answer
74
views
Lightened mesh "ribs" while smooth rendered [closed]
I recently faced a problem I still cannot overcome for the reason I don't understand its nature.
I created a sphere, assigned vertices and normals and indices and built DSA vao (Opengl 4.5). Having ...
0
votes
1
answer
90
views
Invalid operation in `glTextureView` [closed]
I am using a GL_TEXTURE_2D_ARRAY for storing all my textures and was trying to figure out a TextureView system to see individual textures, but when I try to initialize it, it says GL_INVALID_OPERATION ...
1
vote
1
answer
110
views
Can't get GL_NV_gpu_shader5 to work in QT 5 when hasExtension is true
I have the following code, QT doesn't explain how to use extensions like this, like at all (just a default page when you go to QtOpenGLExtension page), so I assume I'm supposed to inherit from it.
//...
0
votes
0
answers
59
views
Bindless Uniform Variables
I am implementing a 3d renderer in OpenGL.
Here is how you would render some 3d models:
Renderer3D.begin(camera);
Renderer3D.setShader(shader_1);
Renderer3D.render(model_1, transform_1);
Renderer3D....
0
votes
1
answer
100
views
Legacy OpenGL Display Issue
I am using Legacy OpenGL to make a fish tank:
#include <GL/glut.h>
#include <stdio.h>
float fishPosX = 0.0f;
float fishDirection = -1.0f;
float rotationAngle = 0.0f;
int rotating = 0;
...
1
vote
1
answer
114
views
How to get data stored in VBO
I need to get back a float[] of vertices which is stored in attrList in vbo in vao.
I do:
float[] b = new float[vertexCount];
glBindVertexArray(vaoId);
long pointer;
glEnableVertexAttribArray(0);
...