797 questions
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
0
answers
97
views
Why is my image not shown while I'm dragging background window to resize it in imgui?
I'm developing a desktop program based on imgui docking branch on ubuntu 22.04 to add an image into background window and center it always while the window is being resized:
(Also note, get arbitrary ...
0
votes
1
answer
66
views
OpenGL Rendering Issue with VAO in Mesh Class - GL_INVALID_ENUM Error [closed]
I am rendering a rectangle using a mesh class to encapsulate the vertex and index data, as well as handle rendering. However, I've encountered an issue where the mesh object does not render, and I'm ...
0
votes
1
answer
64
views
Render particles in the transparent parts of other particles
Problem
I am rendering a 3D cube, and this works fine. Afterwards, I render particles as an array of points, which a geometry shader transforms to quads (2 triangles). The problem I have is that the ...
2
votes
1
answer
388
views
What is the glVertexAttribPointer "stride" argument?
just started learning openGL and, as usual, trying to understand what every bit of code i write does and why it is there, but i could not understand the stride argument is. according to the ...
1
vote
1
answer
290
views
Does GL_DYNAMIC_DRAW make a difference when only using glBufferData?
I have some vertex data that changes every frame, but because I don't know the (max) number of vertices ahead of time, I have to use glBufferData every frame, instead of using glBufferSubData. I'm ...
0
votes
0
answers
55
views
Trouble porting some GL line strips to core profile
I have to port some legacy OpenGL code to the 3.3+ core profile (which I'm only somewhat familiar with) but there's a specific section I'm having some trouble with because the only way I can think to ...
0
votes
1
answer
2k
views
I have an error loading an image with STB image
my problem is that while loading any type of image with the library STB image I get the next error: BAD PNG SIG, even if It's not even a PNG, all the code worked before I tried making an OBJECT class ...
2
votes
1
answer
304
views
In what way is WebGL2 immediate compared to retained mode OpenGL3?
I have some previous experience with OpenGL3 from following the tutorials on learnopengl.com and have recently been learning how WebGL2 compares. I'm still a n00b, so excuse any misunderstandings.
One ...
0
votes
0
answers
202
views
Why are the frameSwapped and aboutToCompose signals of QOpenGLWidget emitted almost simultaneously?
In theory, if I enable the vertical sync option with setSwapInterval(1), the time interval between the emissions of these two signals should be at least the refresh period of the display. However, in ...
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
2
answers
86
views
OpenGL Triange demo shows blank window
I've started my learning of LWJGL3 and OpenGL 3.2+ with a triangle demo. The program seems to run well and I'm not getting any OpenGL errors, but the triangle does not show up on screen.
I've looked ...
1
vote
1
answer
109
views
OpenGL Geometry Shader rendering triangle instead of square from a point
I am trying to render a square from a single point, here is my geometry shader code:
#version 330 core
layout (points) in;
layout(triangle_strip, max_vertices=4) out;
void main(){
vec4 pos=gl_in[...
2
votes
1
answer
613
views
How to rotate a matrix along two axis without affecting the third axis at all?
I have an object, which needs to be rotate by two axis (for simplicity, let's call them the X and Y axis, but understand that they can be completely arbitrary).
So, something like this:
Matrix aMat;
...
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 ...
0
votes
1
answer
142
views
how to implement 3D model rendering By different indexes? [duplicate]
I have a problem with rendering 3D models in OpenGL - The problem is that I can't implement rendering by single index buffers
(I mean rendering: vertex by vertex indices, normals by normal indices, ...
2
votes
2
answers
2k
views
Why is my OpenGL code producing a black screen?
This is my code written in C++ that is supposed to produce 2 triangles, however I am getting a blank screen. Is there something I am missing?
#include <GL/glew.h>
#include <GLFW/glfw3.h>
#...
3
votes
1
answer
398
views
Beryllium crate does not link with project, linking with cc fails
Allo!
I've been trying to compile an OpenGL example here and so far I've been porting the examples for the newest package versions. After I've finally got the compiler to shut up and compile, it... ...
2
votes
2
answers
295
views
From C matrix to texture in modern OpenGL?
Problem
I am trying to write a simple program in C, using OpenGL, that would allow "drawing" a 2D C array (int **, 32-bit integers) according to a color palette.
For the moment (I am not ...
3
votes
0
answers
275
views
Should I bind my buffers to GL_COPY_WRITE_BUFFER when uploading data?
I don't have access to direct buffer access, so I need to bind my buffers to upload data to them. Normally I bound them to the target they're used for, but I recently learned that ...
-1
votes
1
answer
167
views
OPENGL flickering on updating model uniform to same value
I have looked up almost all related questions regarding flickering in opengl. They all mostly have something to do with z-buffer or perspective projection. However, I'm rendering a single quad on ...
3
votes
1
answer
1k
views
Should I prefer glMapBufferRange over glMapBuffer?
The documentation for glMapBuffer says it can only use the enum access specifiers of GL_READ_ONLY, GL_WRITE_ONLY, or GL_READ_WRITE.
The documentation for glMapBufferRange says it uses bitflag access ...
2
votes
1
answer
5k
views
Access violation in nvoglv64.dll when using OpenGL
My code is giving me this error:
Exception thrown at 0x00007FFCF428A6CF (nvoglv64.dll) in program.exe:
0xC0000005: Access violation reading location 0x000001D6B603F000.
In the debug output window of ...
0
votes
0
answers
141
views
Why Doesn't My Heightmap-Generated Terrain Texture Correctly?
I'm building a heightmap out of a 2D array of shorts. The code to generate the vertices is
MeshVertex v; // has position, normal, and texCoord fields
v.position = glm::vec3(
(float) x * 150,
...
1
vote
1
answer
461
views
How do OpenGL buffers relate to the VAO?
I'm currently learning OpenGL, but I'm having some problems understanding how the different buffers relate to the VAO. In my following code, I'm creating one VAO and two buffers (VBO for the vertex ...
2
votes
1
answer
135
views
Why does GLFW_CONTEXT_VERSION 3.3 render slower than 2.0?
I have the following code:
#include <glad/glad.h>
#include <GLFW/glfw3.h>
#define GLFW_INCLUDE_NONE
#include <stdio.h>
#include <stdlib.h>
static void error_callback(int ...
1
vote
0
answers
169
views
Java - LWJGL and OpenGL, How to apply texture to an object?
everybody.
So I am using LWJGL to learn OpenGL.
So I am trying to apply texture that is located in a folder called textures (full path -> src/textures/texture.png). However all I am getting is ...
1
vote
0
answers
185
views
Is there a way to make a flat surface, that is perpendicular to the camera, visible in OpenGL?
As seen in the picture we have a rectangle which is 2 Dimensional in a 3D space.
When I rotate said rectangle (Slightly rotated) so that the normal of this plate is perpendicular to the camera, it ...
0
votes
1
answer
319
views
What is the equivalent pixel format of SDL_PIXELFORMAT_ABGR1555 in OPENGL for a texture?
I have a game that outputs color value of type ABGR1555 to a frame buffer, and uptill now I was using SDL2 for the graphics(draws a texture) and it conveniently had an option to deal with the color ...
1
vote
0
answers
412
views
Rendering only a part of the window onto a framebuffer in opengl
I have been wanting to make edit menu using framebuffers in opengl(with c++). I then render some buttons in the menu space and then render the framebuffer. So while creating the framebuffer I just ...
1
vote
1
answer
1k
views
How would I store vertex, color, and index data separately? (OpenGL)
I'm starting to learn openGL (working with version 3.3) with intent to get a small 3d falling sand simulation up, akin to this:
https://www.youtube.com/watch?v=R3Ji8J2Kprw&t=41s
I have a little ...
0
votes
1
answer
235
views
debugging of shader is not working in opengl
I am trying to abstract OpenGL shader but shader compilation fails even though it is a tutorial shader. The main problem is that when I run it shader compilation fails and it shoots out arbitrary text ...
0
votes
1
answer
91
views
access violation when i use my index buffer to draw objects [duplicate]
I am learning OpenGL and I am trying to abstract it to make it convenient for me to use it.
but I am getting access violations when I use my IndexBuffer class while rendering.
this is my code for ...
1
vote
1
answer
208
views
Getting incorrect vectors when trying to do mouse picking in OpenGL 3
I am trying to get a direction vector to where my cursor is on the screen, however it gives me large values instead of the actual values. When doing mouse picking I am getting extremely small numbers ...
0
votes
1
answer
1k
views
Is there a way to prevent the contents of my window from "moving" when i resize the window in OpenGL
I would like my window contents to stay centered when my window resizes. OpenGL (or GLFW) - I'm not sure which - does give this desired effect when resizing horizontally, however when i resize the ...
3
votes
1
answer
624
views
OpenGL 3.1 with SDL2 context on MacOS fails to output anything on screen
I am trying to get a simple demo of OpenGL working with SDL2. I am using MacOS Big Sur 11.3.1, my SDL version is 2.0.16, and my attempted OpenGL version is 3.1.
Everything seems to work fine at first, ...
0
votes
1
answer
455
views
OpenGL vertex shader processing
I'm pretty new to 3D programming. I'm trying to learn OpenGL from this site. During the reading I couldn't really understand how the layout (location = 0) line really operates. I've tried to search ...
0
votes
0
answers
299
views
How Do Texture Coordinates Work When They Aren't Correctly Assigned?
Let's assume we have a texture like this
and an array of vertices like this:
float vertices[]{
//Pos //TexCoor
0 , 0, 1,0,
0.5, 0, 1,0,
0.5, ...
1
vote
1
answer
856
views
OpenGL clear color alpha channel not working
I am making a game in OpenGL and C++ and I want to add a little red tint to everything. I decided to do this by clearing the screen red after rendering everything but making the alpha channel a low ...
1
vote
0
answers
149
views
Memory leak when drawing lines in OpenGL3
I'm having some memory leak issues with my draw line function.
I'm using windows task manager to see that there is a problem. When I start the application it uses around 200MB and after running it for ...
0
votes
0
answers
198
views
Ways to Scale glBitmap
I have been using glBitmap for quite a long time and I need to scale according to the Windows Display settings. For me, performance is key and I can't afford texture spriting or any other stuff.
...
1
vote
1
answer
448
views
How can I pass a single value in a VBO to every vertex?
I have a VBO that contains multiple 3d models stored one after another with the intention of drawing the models conditionally with multiple calls to functions like glDrawElements. Each model is meant ...
1
vote
1
answer
579
views
Visual Studio, GLUT error - The following is a new check for GLUT 3.0; update your code. redisplay needed for window 1, but no display callback
The code is building successfully but when I run the code I have the following error -
The following is a new check for GLUT 3.0; update your code.
GLUT: Fatal Error in D:\6th Sem\4. CG UCS505\...
0
votes
0
answers
82
views
Modern OpenGl transformation issues
I have an object which I'm trying to apply some transformation. For example, with something like an airplane. If I translate the object, it translates normally. However, if I try rotating it at its ...
0
votes
1
answer
148
views
What is the Proper Formula for Converting a Quaternion to a Matrix
I am currently writing my own game engine and I am having trouble properly implementing quaternions. My current quaternion implementation looks like this:
/*
CybRender - Quaternion API
*/
#include &...
1
vote
1
answer
78
views
code pulls up an object has no type pyglet
this is the code i know is making the errors
self.scale_loc = glGetUniformLocation(shader, b"scale")
self.rotate_loc = glGetUniformLocation(shader, b"rotate")
self....
1
vote
1
answer
83
views
Can't get attribute location pyglet
this code doesn't allow me to use it
position_loc = glGetAttribLocation(shader, "position")
color_loc = glGetAttribLocation(shader, "color")
the full code near it
shader = ...
1
vote
1
answer
3k
views
How to prevent GLFW window from showing up right in creating?
I am creating a 3D game using LWJGL3, and I want the window loaded in the background and hidden, wait for my game setup and only than showing up.
My problem is even if I call GLFW.glfwHideWindow(...
0
votes
1
answer
511
views
glGenVertexArrays causes a segmentation fault, how do I properly set up an OpenGL context? [closed]
I'm trying to code a simple triangle. However glGenVertexArrays(1, &VertexArrayID) casues a segmentation fault whenever I run it.
SDL_Init(SDL_INIT_VIDEO);
SDL_GL_SetAttribute(...
2
votes
1
answer
328
views
OpenGL 3.3: How implement uncompressing texture data before passing to vertex and fragment shader
I am pulling 12 bit data from a camera which is packed, so that 3 bytes define 2
consecutive pixels.
Is there a way to decompress these into two 16 bit values before passing the data to the vertex ...