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.

137 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
7 votes
0 answers
631 views

Code runs differently on different hardware

I wrote a 2D fluid-solver in OpenGL (code here) some time back. While it runs flawlessly on my onboard Intel GPU, the simulation very quickly "blows-up" when same code is run using nvidia card : ...
user avatar
  • 71
6 votes
0 answers
945 views

OpenGL texelFetch causes black stripes

THE SHORT VERSION In my fragment shader I'm reading (using texelFetch) multiple times the same texel from a texture (created by another fragment shader) and write it to the output render buffer. ...
user avatar
6 votes
0 answers
236 views

Cannot use more than a couple of MB in a shader storage buffer

I am implementing a simple ray tracer with OpenGL. I have a shader storage buffer with all the triangles so I can test them for intersections in a compute shader. It works fine up to a certain buffer ...
user avatar
5 votes
0 answers
908 views

Cascaded shadow maps. Seams between cascades

I implemented cascaded shadow maps, where shadow maps for each cascade is rendered to one canvas: The light projections for each cascade are calculated from the bounding spheres of camera sub-...
user avatar
  • 151
5 votes
0 answers
821 views

Drawing to framebuffer texture - texture then split in half

I am doing exercises from the OpenGL SuperBible 6th Ed. I have managed to set up rendering into a framebuffer texture and then rendering from that texture to a cube. But for some reason, when the ...
user avatar
5 votes
1 answer
2k views

Manually fetching 8 neighboring texels from 3D texture greatly decreases performance

I'm implementing manual interpolation between texels in a 3D texture to be able to discard some of them when needed. Compared to hardware interpolation, this process takes a lot of time. If I simply ...
user avatar
4 votes
0 answers
186 views

selectively setting stencil value based on vertex property in vertex shader

Just like the question says. Is it possible to selectively set the value of the stencil buffer based on a property of a vertex, like the value of its normal, during its vertex processing phase? ...
user avatar
4 votes
0 answers
600 views

OpenGL ES vertex/fragment shaders - Blinn phong

I'm developing a simple educational project to study OpenGL ES. I'm try to render some simple OBJ models using Blinn-Phong. The first version of the of my implementation calculate all the lighting ...
user avatar
4 votes
0 answers
953 views

How to disable Perspective Correction in Texture Coordinates Interpolation in OpenGL(without using shaders)?

I need to do planar reflection mapping in OpenGL. By using a virtual camera (with a reversed camera ray) at the back of reflective plane (a mirror), I rendered the scene to texture, which is then ...
user avatar
  • 41
4 votes
0 answers
316 views

How to make double working in OpenGL 4.1 on OS X ( Intel HD Graphics 5000 )?

I've recently rebuild shaders for my program and it stopped "working" ( black screen ) on OS X ( El Capitan ), but it's ok on Linux on GTX 660. I've tested it on another Apple hardware and it worked ...
user avatar
  • 141
4 votes
0 answers
310 views

Indexing gl_TessLevelOuter[] with gl_InvocationID on a tessellation control shader

I'm using hardware tessellation to render a terrain mesh with variable LOD. I have this snippet on my tessellation control shader: ...
user avatar
  • 218
4 votes
0 answers
347 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 ...
user avatar
3 votes
0 answers
115 views

Renderdoc reports incorrect OpenGL API usage, can't figure out why

I'm rendering some UI using an immediate-mode UI library, so each frame it produces some meshes, which I then load into buffers and render, only to get some strange errors from Renderdoc: You can see ...
user avatar
3 votes
0 answers
418 views

How to implement PCSS correctly?

I'm trying to implement PCSS in OpenGL/GLSL, but I have problems understanding the details especially the conversions between the coordinate spaces. The existing implementations are so different from ...
user avatar
  • 31
3 votes
0 answers
272 views

Comparing different sampling methods for GGX IBL

I have made a demo that shades a sphere with an environment map. I wanted to compare 3 different ways of sampling the environment. Uniform sampling. Importance sampling with the NDF as suggested in ...
user avatar
3 votes
0 answers
146 views

Projective Texture / Shadow Mapping -- Why is the perspective division performed in the fragment shader?

I've just worked my way through this OpenGL shadow mapping tutorial. While I understand the basic algorithm, one thing puzzles me: During the 2nd render pass all vertices are transformed into the clip ...
user avatar
3 votes
0 answers
280 views

Circular pattern aliasing in voxel ray tracer

I am doing a voxel based raytracer. In other words, I first voxelize the scene using rasterization and I proceed to raytrace the volume in a 3D image to generate a final frame. Currently I noticed ...
user avatar
  • 1,449
3 votes
0 answers
110 views

How can i achieve reflections like this?

I was in my elevator when i saw this... As you can see here that reflections are kind of stretched. What causes this? And how can we achieve something like this in computer graphics?
user avatar
3 votes
0 answers
70 views

Super basic question: OpenGL version/install issue

I'm running a Python program whose GUI uses OpenGL. I'm getting all sorts of graphics error messages. I want to check the OpenGL version to make sure it's all good, but the OpenGL Extensions Viewer ...
user avatar
3 votes
0 answers
85 views

What is a good algorithm, and framework, to calculate centres of gravity or mass (cog)?

I'd like to take an photograph, subdivide it into a tesselation, either of squares, or (ideally), hexagons, and then find the centre of gravity (or, if you prefer, centre of mass) of each cell of the ...
user avatar
3 votes
0 answers
939 views

Represent vector with arrow

Another code review question. I am trying to draw an arrow to represent a vector. I have started with an unit arrow with vertices defined as follows: ...
user avatar
  • 243
3 votes
0 answers
168 views

Strange behaviour of glDisableVertexAttribArray() on devices

In my graphics engine, based on OpenGL ES 2.0 I am using standardized name for shader attributes like it is done in libGDX (such as a_position, a_normal, etc.). When 'activating' my vertex buffer for ...
user avatar
2 votes
0 answers
29 views

GLFW: create embeddable opengl child window and set parent on Mac?

Is this possible with GLFW? AFAIK you can't use GLFW to create a child window per se, so the question probably boils down on how to turn a GLFW created, opengl enabled window into a child window and ...
user avatar
2 votes
0 answers
238 views

OpenGL: read texture mipmap level 0 and render to same texture mipmap level 1

I am trying to generate mipmaps, which are based on depthbuffer values. To generate the next mipmap level, I am trying to read in the 4 pixels of the upper mipmap level per pixel. Unlike the usual ...
user avatar
  • 499
2 votes
0 answers
73 views

Atmospheric scattering band/seperation artifact

I am currently experimenting with some atmospheric scattering in glsl in my OpenGL engine. I am experiencing a strange phenomena where a strange band / separation artifact appears along the middle of ...
user avatar
2 votes
0 answers
200 views

How to retrieve data from Compute Shader to CPU?

I want to retrieve data that has created by the compute shader but have no clue how it works. After researching a few forums and articles on how it should work and this is what I came up with. Compute ...
user avatar
2 votes
0 answers
114 views

Why there are calculation differences in WebGL and OpenGL

I am currently implementing the Mandelbrot fractal on the GPU. I wrote two programs: the first in OpenGL (desktop C++ application) and the second in WebGL (static webpage). The two programs use almost ...
user avatar
  • 43
2 votes
0 answers
104 views

GLSL broken access operator

I've been following a guide to learn OpenGL, and I'm now learning how to do post-processing. In particular, I'm trying to apply a blur to my rendering through the following kernel: $\frac{\begin{...
user avatar
  • 21
2 votes
0 answers
453 views

fragment shader median/weigthed sum of neighbors depth values (optimization)

I've implemented a ping pong rendering that does something according to constraints on the current fragment : (1) The value of the fragment depth is equal to the median of neighbors depth values (2) ...
user avatar
2 votes
0 answers
137 views

Image Laplacian incomprehension

I am reading and trying to implement a research paper. It uses openGL to define which part of an image to use in order to reconstitute a big image composited of several images. In order to do so, I ...
user avatar
2 votes
0 answers
95 views

Artifacts (numerical errors?) in rasterisation renderer

This might be not laser precision question but this issue appeared a long time ago when first trying to render some scene with 3D models in rasterisation renderer and apply some lighting, ...
user avatar
  • 2,047
2 votes
0 answers
159 views

With OpenGL, is it correct to apply model transformation to rotate the camera?

Having taken a basic CG course, I remember that transformations are relative, so rotating the camera is identical to rotating the view in the opposite direction. Right now I want to implement camera ...
user avatar
2 votes
0 answers
221 views

Is there a difference in how ATI cards draw triangle strips vs Nvidia cards that would cause ATI cards to output nothing?

I have a rendering system that I use for drawing height maps. The system uses triangle strips of indexed verts in a vao. The system has worked fine on the 3 Nvidia cards I have tried it on across ...
user avatar
2 votes
0 answers
537 views

Can't render multiple VAO's?

I'm a newbie to OpenGL and I was following a series by "thebennybox" on Youtube. Specifically his series on modern opengl programming. I thought I would try to implement his Mesh wrapper using the ...
user avatar
2 votes
0 answers
137 views

Shadow Mapping Errors

I recently started to create a shadow mapping system in OpenTK. I ran into a problem: The depthtexture is always completly white -> no depth. Even if the color from the shader is changed (I know it ...
user avatar
  • 21
2 votes
0 answers
264 views

Projecting light shapes

I am wondering how professional light visualizer software (like Capture Argo - WYSIWYG - Realizzer - LightConverse) project the lights on the objects (like stage, floor, people), even projecting the ...
user avatar
1 vote
0 answers
42 views

efficient way to get min/max distance during rendering

I want to improve my shadow mapping depth precision by getting the minimum and maximum depth value within my shadow map. When having both values I would convert the depth map to convolution shadow map ...
user avatar
  • 499
1 vote
0 answers
25 views

AO Denoise Filter

I'm trying to implement a filter to denoise ambient occlusion data. What kind of filter do you suggest for the purpose? The techniques I've come across are the following: Gaussian filter (doesn't ...
user avatar
1 vote
0 answers
33 views

Variance Shadow Mapping (Shadow occurs when normal vector is close to light direction)

I am implementing Variance Shadow Mapping from Nvidia GPU Gems 3 Chapter 8: Summed-Area Variance Shadow Maps There they are talking about clamping the minimum variance to a very small value. I did ...
user avatar
  • 499
1 vote
0 answers
113 views

Generating cheap perfect outlines for meshes in WebGL

I am tasked with creating an outline shader in WebGL (i'm using WASM/Emscripten, so an OpenGL solution will work too) for meshes that the user can upload into our software (be it .obj, .fbx, .3ds), ...
user avatar
  • 111
1 vote
0 answers
74 views

"Interleaved rendering" in fragment shader

Intro I'm trying to render multi-channel images (more than 4 channels, for the purposes of feeding it to a Neural Network). Since OpenGL doesn't support it natively, I have multiple 4-channel render ...
user avatar
1 vote
0 answers
196 views

Is OpenGL to Metal translation layer plausible?

I am not sure if I understood it correctly, but OpenGL is high-level like Java and Metal is low-level like Assembly, aren't they? Apple seems to have abandoned OpenGL in favour of Metal, but there ...
user avatar
1 vote
1 answer
186 views

Problem using Decaling with Stencil to avoid Z-fighting

I need to create a decaling into a surface like a mesh, and to avoid Z-fighting I've been using Stencil Buffer to Turn-off depth test and make the decaling over the surface the Stencil Op permits. In ...
user avatar
1 vote
0 answers
129 views

OpenGL: "invalid value" error after call to `glGetBufferSubData`

My first question in this community. I have following code.The code is shortened for clarity, error checks skipped: ...
user avatar
1 vote
1 answer
208 views

PNG textures render correctly in Blender, but not in OpenGL program

I've been following the OpenGL tutorials from ThinMatrix and I've been able to load and render his stall.obj model along with his stall.png texture just fine. But when I try with my own models and ...
user avatar
1 vote
0 answers
66 views

GL_OUT_OF_MEMORY Error when glDispatchCompute takes longer

I built a simple Ray Tracer which takes use of OpenGL's Compute Shader and traces ".obj" Files. The results are passed to the Host-Program via glMapBufferRange after finishing computing. ...
user avatar
1 vote
0 answers
54 views

Creating a UI component library from scratch

I've been playing around with OpenGL and I'm trying to build out my own UI component library containing things like buttons, text views, labels, views, etc. Eventually I want to abstract it similar to ...
user avatar
  • 111
1 vote
0 answers
65 views

Conditionals and branching in shaders

This is a quite wide subject which implies a lot of topics such as the platform or the compiler, but I think that it could be useful for everyone to know more about this. A common mistake is to think ...
user avatar
  • 1,169
1 vote
0 answers
167 views

OpenGL/D3D11 offscreen render multiple buffering

Recently I've been looking at Vulkan, and one thing that I noticed is that the application is responsible for choosing which buffer to render to in the case of multiple buffering. This got me thinking:...
user avatar
1 vote
0 answers
112 views

What is the projection matrix of reverse (Byzantine) perspective?

I would like to construct a projection matrix for reverse perspective. I'm using OpenGL and tried to modify concepts from this excelent tutorial. I came up with: $$ \begin{bmatrix} 2\frac{(near-M)}{...
user avatar
  • 11