Questions tagged [opengl]

OpenGL (Open Graphics Library) is a graphics standard and API which is platform-independent and available for desktop, workstation and mobile devices. It is designed to provide hardware-accelerated rendering, and hence gives greatly improved performance over traditional software rendering. OpenGL is used for applications like CAD software and computer games. The OpenGL standard, as well as OpenGL ES, is controlled by the Khronos group.

Filter by
Sorted by
Tagged with
18 votes
3 answers
6k views

How can I debug what is being rendered to a Frame Buffer Object in OpenGL?

I have a point cloud that is being rendered to the screen. Each point has its position and color as well as an ID. I was asked to render the IDs for each point to a texture so I created a FBO and ...
BRabbit27's user avatar
  • 969
9 votes
2 answers
832 views

How to unproject quadrilateral into rectangle?

tl;dr: Math problem in projective geometry: How does one find some 4x4 camera matrix that gives a projection as illustrated below, such that points A,B,C,D are somewhere on the edges of the unit box (...
ninjagecko's user avatar
3 votes
1 answer
2k views

How to unproject cursor with orthographic projection

With perspective projection we can unproject screen space coordinates of the cursor to the near and far plane of the frustum and calculate the direction of the ray through the cursor. ...
Lenny White's user avatar
71 votes
6 answers
50k views

How can I debug GLSL shaders?

When writing non-trivial shaders (just as when writing any other piece of non-trivial code), people make mistakes.[citation needed] However, I can't just debug it like any other code - you can't just ...
Martin Ender's user avatar
  • 2,720
27 votes
2 answers
39k views

GLSL. Can someone explain why gl_FragCoord.xy / screenSize is performed and for what reason?

I'm new to shaders and know that you can color pixels with gl_FragColor but sometimes there is this thing: ...
idchlife's user avatar
  • 373
17 votes
2 answers
11k views

Cause of shadow acne

I know how shadow mapping works but I am not getting the cause of shadow acne! Can anyone tell me cause of shadow acne in a simple way and how is it related to depth map resolution?
Ankit singh kushwah's user avatar
13 votes
2 answers
3k views

Derivative maps vs. Tangent Space Normal maps

I discovered that some engines use derivative maps instead of tangent space normal maps. After some reading, it seems to be a really awesome way to replace tangent space normals but are there some ...
MaT's user avatar
  • 1,219
13 votes
1 answer
4k views

Do I need to rebind uniforms or attributes when changing shader programs?

Rendering the scene usually involves more than one shader program which, in my case, all use the same attributes and share at least some of the uniforms. To have them working properly, I currently ...
Nero's user avatar
  • 1,310
12 votes
4 answers
2k views

Does it matter whether I learn OpenGL or Direct3D?

Are the differences between these two APIs minor implementation details that mean once I have learned one I can use it for everything? Or are there reasons for learning one rather than the other if I ...
trichoplax is on Codidact now's user avatar
12 votes
2 answers
10k views

OpenGL - Detection of edges

I'd like to load arbitrary meshes and draw thick black lines along the edges to get a toon-shading like look. I managed to draw a black silhouette around the objects by using the stencil buffer. You ...
enne87's user avatar
  • 601
11 votes
4 answers
13k views

Multiple viewports with modern OpenGL?

I use SDL2. Currently my only shader has a MVP matrix, and transforms the points with it. I calculate my View and Projection matrix for a camera with GLM: ...
Tudvari's user avatar
  • 313
11 votes
1 answer
1k views

Why do adjacent triangles never overlap when rasterized?

Apologies for the following noob question, it's just I can't find a satisfactory answer anywhere... When I render a simple axis-aligned quad made up of two triangles, I don't understand why there's ...
Reuben Scratton's user avatar
10 votes
3 answers
5k views

How to do texturing with OpenGL direct state access?

How do you use textures with direct state access in OpenGL? I have the following in my code, which seems to work: ...
LinAGKar's user avatar
  • 183
10 votes
1 answer
524 views

What are sample gaps during scan conversion?

In this tutorial, It is very often the case that triangles are rendered that share edges. OpenGL offers a guarantee that, so long as the shared edge vertex positions are identical, there will be no ...
AlexWei's user avatar
  • 237
9 votes
1 answer
3k views

OpenGL specular shading - Gradient banding issues

I use Phong shading as my lighting model. Nevertheless, the specular shading produces gradients in the light cone: Hopefully you can see the gradient starting from the lower left corner expanding ...
enne87's user avatar
  • 601
7 votes
1 answer
220 views

Proper architecture for rendering history of streamed data (points)

Overview My program receives some data points (0-400 per sec). ...
BPiek's user avatar
  • 307
7 votes
3 answers
14k views

How to do error handling with OpenGL?

Whenever I make semantic or syntax errors in OpenGL, either I get a black screen or the program crashes. I looked up on internet on how to do error handling in OpenGL and in the documentations I found ...
user8277998's user avatar
5 votes
0 answers
355 views

Incorrect instanced rendering

Previously, to render a bunch of quads, I was simply using a few uniforms (one for a model matrix and another for the texture layer ID). However, I'd rather not have to loop through each quad and set ...
Darkilon's user avatar
5 votes
3 answers
12k views

Understanding VAO and VBO

I'm reading through Learn OpenGL to refresh the basic concepts as I haven't touched in quite some time. Specifically I still think I cannot quite understand the meaning of VAO and VBO, the book mainly ...
user8469759's user avatar
5 votes
2 answers
485 views

Why do identical polygons not z-fight in OpenGL?

Typically when coplanar or nearly coplanar polygons are rendered in OpenGL, the textures of each polygon mix together in a non-deterministic way. My understanding is that this is caused by the limited ...
Quantum64's user avatar
  • 153
5 votes
1 answer
3k views

Bloom in DirectX

How can I make an object give the effect that it is giving out light when it isn't? I basically want to make an object glow, for example Neon Lights. Also Area Lights in my engine work properly but to ...
Arjan Singh's user avatar
  • 2,481
4 votes
1 answer
308 views

Material Layering

So after reading this Unreal Engine 4 Documentation page: https://docs.unrealengine.com/latest/INT/Engine/Rendering/Materials/LayeredMaterials/ (Which describes how to use material layering in UE4) ...
Arjan Singh's user avatar
  • 2,481
4 votes
2 answers
3k views

OpenGL animation - turn into mp4 movie

Does anyone know how to do run an OpenGL animation and then convert it into a mp4 movie? I've been trying with apitrace and ffmpeg but I get horrible quality output...
mikeglaz's user avatar
  • 269
3 votes
2 answers
388 views

Triangle - Why is it the basic building block for complex shapes

I was recently learning about OpenGL and computer graphics development. I have a question regarding the usage of triangle as the basic building block, or basic shape to develop complex shapes. Is ...
Osama Asif C Infinitum's user avatar
3 votes
1 answer
256 views

setting up integer texture and binding as image pt. 2

Made a new question as suggested, follow up to that one. I was experimenting with texture declaration to find solution and thats how I done that before (...
mdkdy's user avatar
  • 2,089
3 votes
1 answer
2k views

How to dynamically calculate texture coordinates in a vertex shader with OpenGL?

I modified my code, and tried to pass a set of integers specifying the face of a cube (top, bottom left...) to the vertex shader in order to draw multiple instances of a cube face. I did this by ...
Makogan's user avatar
  • 1,656
3 votes
1 answer
1k views

Shader storage buffer indexing by 4 bytes instead of 3?

I am trying to send rendering information for an instancing rendering using shader buffer objects. My current problem is that I have 2 shader buffer objects, one which works just fine, and another ...
Makogan's user avatar
  • 1,656
3 votes
2 answers
2k views

Setting up integer texture and binding as image

When I set up a texture as float it works (color is written - BTW I'm doing voxelization): ...
mdkdy's user avatar
  • 2,089
2 votes
1 answer
4k views

Multiple VAO share a VBO

Let's say I have a have 10 different terrains. Each terrain have the same x and z coordinates, but they have different y coordinate, normals and colors. The indices used for element rendering is also ...
remi000's user avatar
  • 240
2 votes
1 answer
371 views

LoopBlinn Cubic Curve Rendering - Serpentine arteffect

I am trying to implement the Loop-Blinn cubic curve in java using the following source codes GPU-Curve-Rendering and WebCore. Both of them are showing few arteffects and i cannot figure out why. Here ...
codeKhor's user avatar
1 vote
1 answer
597 views

How are textures projected onto 3d models in texture painting applications

In most modeling software you can texture paint onto 3d models using so called stencil textures. They basically project a texture from the viewport view onto the model as seen for instance in the ...
Lenny White's user avatar
1 vote
1 answer
372 views

How to instanced and indirect render geometry [OpenGL]

I've a lots of objects, which have the same geometry. Right now I am using instanced rendering to render these objects. This is working very well. But I am trying to increase the performance of the ...
Thomas's user avatar
  • 1,027
1 vote
1 answer
269 views

How to use maximum resolution (pixel density) with OpenGL in MS Windows

CodeBlocks offers an example program in C, that uses OpenGL. It draws a single multicoloured rotating triangle. I have been building on this example. I am a novice in C and in OpenGL. I believe that I ...
Simon's user avatar
  • 153
1 vote
1 answer
2k views

How do you load multiple textures into an array texture with OpenGL?

I have been reading the OpenGL documentation but it is not clear to me how to achieve the following. Say we have an array of strings. Each string in the array is a valid relative path to an image ...
Makogan's user avatar
  • 1,656
0 votes
1 answer
67 views

Lines not disappearing after being drawn in OpenGL

I am creating a Bezier curve tool in OpenGL and every time my program draws something in motion with cursor coordinates I see the previously drawn lines on the screen for a second or two before they ...
Arjan Singh's user avatar
  • 2,481
0 votes
1 answer
266 views

Raytracing in OpenGL or Vulkan?

I was looking at this glass ball rendering with an image inside of it (zoom out to see the glass ball), and noticed that it looks like they simulate the refraction of light as it crosses from inside ...
HelloGoodbye's user avatar
0 votes
1 answer
191 views

Convert one triangle to another in matrix4x4?

The context openGL instances learning. I want to transform a reference triangle to another one. So final goal is to have one triangle and the instance being a transformation of that initial triangle. ...
Kroma's user avatar
  • 103