438 questions
Best practices
0
votes
0
replies
34
views
How to display a lot of line_strips efficiently with ModernGL
I need to display many (a lot) 3d trajectories with modernGL.
For now, I chain the trajectories and I create two arrays only (one for all the vertices and one for their colors) that I pass as params ...
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 ...
0
votes
1
answer
99
views
glGetProgramResourceIndex returning wrong indices [closed]
I'm using a generic mathod to bind buffers (uniform buffers, shader storage buffers, ...) to my shader programs, based on glGetProgramResourceIndex() function and buffer's name, but sometimes I'm ...
2
votes
0
answers
125
views
How do you query an Intel GPU for total memory?
I'm currently getting a GPU's total memory from GL_NVX_gpu_memory_info or GL_ATI_meminfo. However, testing this code with an Intel Arc card neither extension is supported (makes sense). However, ...
-1
votes
1
answer
36
views
How to call glTexImage2D properly using GLFW in C#
I was trying to set up texture rendering for an OpenGL project I was working on and I can't get it to work because apparently the glTexImage2D function's last parameter in a nint. I looked online and ...
2
votes
1
answer
600
views
Value of gl_DrawID when calling glMultiDrawElementsIndirect with instance count set to 0
Suppose I have three meshes A, B, C in one VBO and used glMultiDrawElementsIndirect with the instance count set to 1, 0, and 1 for A, B, and C respectively and the draw count set to 3. What would be ...
0
votes
0
answers
71
views
Passing extra variable to fragment shader completely breaks the shader program
The vertex shader:
in vec3 a_Position;
in vec4 a_Color;
in float a_Width;
in vec4 a_JointProduct;
in int a_EntityID;
layout(location=0) out vec3 pos;
layout(location=1) out vec4 color;
layout(...
0
votes
1
answer
132
views
How to create a SSBO with dynamic size
I have looked everywhere but couldn't find one that used DSA (Direct State Access). I need a SSBO with dynamic size so that I can update my instances WITHOUT having a limit like MAX_INSTANCE_COUNT.
At ...
4
votes
1
answer
279
views
Why did glGet with GL_POLYGON_MODE returns two values?
When getting the mode of GL_POLYGON_MODE, glGetIntergerv(GL_POLYGON_MODE, data), I'll have to make data an integer array of size 2.
because I've read somewhere that:
params returns two values: ...
0
votes
1
answer
332
views
How do I get glBindTextureUnit() to work?
The following works fine:
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, m_ID);
But when I replace it with this, it doesn't work. (I don't get any errors, just a black color instead of ...
-1
votes
1
answer
80
views
OpenGL shadow acne visual error without shadows implemented
so I'm having a problem with what it seems to be shadow acne (as far as I can tell), but the thing is that I have not yet implemented shadows of any type. I have implemented Phong Lighting model (...
0
votes
1
answer
333
views
sampler2D in compute shaders, compilation errors
I'm trying to port a Windows program to GNU/Linux, but a compute shader doesn't compile.
I have a few knowledge of GLSL. So I wonder if there are workarounds to get the shader working.
I have written ...
0
votes
1
answer
197
views
OpenGL shader uniform is not recognized in the code
I am currently trying to learn OpenGL, and I have the following issue: when I use glGetUniformLocation to locate my shader uniform, it simply cannot find this uniform. Do you have any idea why?
My ...
-1
votes
1
answer
97
views
Buffer read-back working depends on order of bind/map with DSA
I am trying to perform read-back of SSBO data in OpenGL. For this I persistenly map the SSBO, but the following piece of code does not actually read back the written data from the example compute ...
0
votes
1
answer
97
views
What happens to buffer attached to VAO via glVertexArrayVertexBuffer after deleting buffer?
I'm using OpenGL4.5, and using Direct State Access where possible. I wrote basic wrappers around VAO and buffer objects. I'm using glVertexArrayVertexBuffer to bind a buffer to a VAO. I'm wondering if ...
1
vote
0
answers
158
views
glPolygonOffset and backfaces
I stumbled upon a problem that I'm unsure of how to fix or if a fix even exists. I need to apply a positive polygon offset to a filled mesh for rendering some line geometry on top of them. The lines ...
1
vote
1
answer
100
views
Non-gradual color change in OpenGL
I'm trying to gradually change a triangle's color to each color on the spectrum. The color basically changes incrementally in every iteration of the render loop and passes the color information to a ...
0
votes
2
answers
681
views
OpenGL (with OpenTK) texture doesn't render (not even a white rect)
I am doing on overhaul on a game engine from my university and I've hit a brick wall when dealing with OpenGL rendering. I'm using OpenTK with GLFW.NET to render to a window. (I recently switched to ...
2
votes
0
answers
112
views
OpenGL glProam link failed in windows: error C5145: must write to gl_Position
I am currently learning the Book "Computer Graphics Programming - Using OpenGL and C++". When I test the chapter 2-3, I found the error:
shader program failed to link:
Program Info Log: ...
0
votes
1
answer
131
views
How Can I Render Round Vertices Using OpenGL 4.0?
I have an MFC based Windows desktop SDI application built with the Doc-View framework and which displays modern OpenGL based 3D graphics in the MainFrame. It used for rendering relatively simple ...
0
votes
0
answers
642
views
Passing a big texture to a GLSL shader?
I need to pass two textures of 65536x1024 pixels each to the shader program. I can't do this via the standard glTexImage2D() method because there is a limitation on the OpenGL side on the height and ...
1
vote
0
answers
219
views
Strided buffer copy for modifying interleaved vertex attributes
this question is a bit related to this one, but quite some time has gone by since it was asked. The basic premise: I have device-local (non-mappable) vertex buffers with interleaved attributes. These ...
1
vote
1
answer
189
views
Clearing FBO depth buffer without considering glDephMask
I'm currently writing a render pass which renders to a framebuffer with attached color and depth attachments. Before the pass starts, it needs to clear the depth attachment to a set value. I'm trying ...
0
votes
1
answer
284
views
GLSL simple shader results in strange compilation errors
I have a very simple shader here:
#version 460
layout (location = 0) in vec3 inPos;
layout (location = 0) out vec3 outPos;
void main() {
gl_Position = vec4(inPos.x, inPos.y, inPos.z, 1.0);
...
0
votes
1
answer
144
views
How to move 2D multiple drawn shapes (Squares and Rectanagles) seperately in OpenGl?
I have just started using OpenGl in visual studio.
I used the drawsquare() and drawRoundRect () to draw multiple shapes in seperate void functions which I called seperately in an another function ...
-2
votes
1
answer
110
views
glGetProgramResourceName() Throws
I am trying to get the uniform block name from a shader handle using glGetProgramResourceName().
Yet it throws (0xC0000005: Access violation executing location 0x0000000000000000) on std::vector<...
1
vote
2
answers
895
views
Continuously render Gtk::GLArea in gtkmm
I've followed a gtkmm4 + opengl example, the window loads and displays without any errors and renders one frame but then seems to ignore my queue_render() and queue_draw() calls as evidenced by the ...
1
vote
1
answer
119
views
Are all returned values of glGetInternalformat dependant on both the target and format arguments?
In the OpenGL 4.6 specification under section 22.3, a command named glGetInternalformat is described which can be used to gather implementation dependent information about internal formats.
The ...
1
vote
1
answer
95
views
cannot render own created model with loaded models together in modern OpenGL
I am failing to render my own created model with loaded obj at the same time.
I have mesh.h that is designed for loading objects:
struct Vertex {
glm::vec3 Position;
glm::vec3 Normal;
};
...
1
vote
1
answer
284
views
Why does glObjectLabel only fails for GL_TEXTURE?
Using OpenGL 4.3 with a debug context, I am able to label programs, shaders, vertex arrays and vertex buffers.
However, I am not able to label textures and get the following error in my callback:
...
4
votes
1
answer
2k
views
Drawing a simple rectangle in OpenGL 4
According to this wikibook it used to be possible to draw a simple rectangle as easily as this (after creating and initializing the window):
glColor3f(0.0f, 0.0f, 0.0f);
glRectf(-0.75f,0.75f, 0.75f, -...
-1
votes
2
answers
426
views
Stbi_load causes error from glGetTextureHandleArb()
Trying to setup bindless textures, whenever I call glGetTextureHandleARB() it results in the OpenGL error GL_INVALID_OPERATION. This page says this is because my texture object specified is not ...
1
vote
1
answer
706
views
OpenGL GLM rotate 2D shape around Z-axis
This is similar to this question, but I have a 2D triangle I'm trying to rotate solely about the z-axis, so I don't think I have to do any negative rotations. I have intentionally picked a triangle ...
0
votes
1
answer
211
views
OpenGL ARB shader baloot readInvocationARB returns different results for inactive invocation
I am writing a shader that uses the same algorithm several times on different inputs to calculate some intermediate results that are later combined to get the final result. The data is dependent on ...
1
vote
2
answers
2k
views
Issues with infinite grid in OpenGL 4.5 with GLSL
I've been toying around with an infinite grid using shaders in OpenGL 4.5, following this tutorial here. Since the tutorial was written for Vulkan and a higher version of GLSL (I'm using 450 core), I ...
0
votes
1
answer
560
views
Why does glDrawElements() require number of vertices and number of elements?
As per the OpenGL documentation,
void glDrawElements(GLenum mode,
GLsizei count,
GLenum type,
const GLvoid * indices);
The second argument count in the call to glDrawElements, "Specifies the ...
0
votes
0
answers
20
views
GL_INTENSITY16 Alternative? [duplicate]
I have a texture that used to be read in as GL_INTENSITY16 internal pixel format. After upgrading the pipeline ive noticed GL_INTENSITY16 is deprecated though i can kind of load the texture with ...
1
vote
2
answers
80
views
OpenGL Render Half Polygon
I am getting half polygon rendered while using Indices in OpenGL. Any idea what's going wrong?
float vertices[] = {
-0.5f, 0.5f, 0,
-0.5f, -0.5f, 0,
0.5f, -0.5f, 0,
0.5f, -0.5f, 0,
...
0
votes
1
answer
1k
views
Problem with imageStore in compute shader
I have a problem with a very simple compute shader that just copies a texture using imageStore.
#define KS 16 // kernel size
layout (local_size_x = KS, local_size_y = KS) in;
layout(location = 0) ...
0
votes
1
answer
655
views
OpenGL error 1282 when returning struct with uint array member
I get OpenGL error 1282 when I try to run fragment shader with a function that returns struct with uint array initialized from function argument and integer literal.
When I run my program with the ...
2
votes
1
answer
524
views
OpenGL - Can I draw non-indexed when index-buffer is set for VAO?
I set up a VAO, binding vertex-buffers to it for vertex attributes, but also set index-buffer (With glVertexArrayElementBuffer). Does that restrict it so it only works with glDrawElements type of ...
1
vote
1
answer
843
views
OpenGL warning after calling glCopyNamedBufferSubData and glNamedBufferSubData
I'm getting the following warning:
Buffer performance warning: Buffer object 19 (bound to NONE, usage hint is GL_DYNAMIC_DRAW) is being copied/moved from VIDEO memory to HOST memory.
I allocate this ...
0
votes
0
answers
131
views
What parameters affect glCompressedTexSubImage2D, in difference to glCompressedTexImage2D?
I have a problem which only affects ATI-graphic cards on PC, but it seems no other graphics hardware, including Nvidia/Intel/Android/iOS.
When I create a 2D texture I allocate using glTexStorage2D, ...
0
votes
0
answers
59
views
Black Box Renders Instead of 3D Object
This base code was working well for 2D objects, but will not render the 3D object that I have the vertices and index for. At first I thought it was the shader, but the shader works well for ...
0
votes
1
answer
732
views
what's the internal format of default framebuffer's depth component in opengl
glblitframebuffer requires matched internal format, so what's the internal format of default framebuffer's depth component?Is there a standard?I couldn't find a document for it.
My laptop's nvidia ...
1
vote
1
answer
66
views
c++ opengl 4.5 doesn't show the object
I writed code which must to show triangle but it doesn't. I really don't know where is problem. I checked everything and don't find out what is the problem. If you can please help me.
Here is code:
#...
0
votes
1
answer
360
views
OpenGL - Does MSAA not support floating-point texture?
Here's the things, I am trying to do deferred shading with multisample texture.
To create the GBuffer, I create a framebuffer with mutlisample texture attachments to draw on and a framebuffer with ...
0
votes
1
answer
1k
views
GL_LINEAR / GL_NEAREST equivalent in DirectX 11
I have a scene in which i load the same texture only depending on its resolution i use different filtering modes in OpenGL, these are GL_LINEAR, GL_NEAREST and so on. For example, for a texture with a ...
1
vote
1
answer
349
views
Can we run the openGL project from server using node.js child process?
I have been trying to automate the launching of OpenGL Project from server using node.js
The problem is like whenever new client join in (create a window in browser) I want to launch the .exe file.
....
0
votes
0
answers
97
views
Why are my textures not consistently drawing when I switch from Orthographic to Perspective?
I'm relatively new to opengl and I'm trying to make a basic 2d scened with gl-4.5. I have three tiles laid next to each other on the plane, two images from a single spritesheet and a coloured ...