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
6 votes
1 answer
77 views

Can the uniform id be changed from run to run on the same machine?

I have a shader which has several uniform variables: uniform vec4 a; uniform vec4 b; uniform vec4 c; I'm getting these handles using ...
Netherwire's user avatar
3 votes
1 answer
1k views

GLUT OpenGL - Drawing Shapes using only GL_POINTS

I'm working on an assignment and I need to draw using only GL_POINTS. I realize this is an expensive approach but it's for the homework, so no GL_TRIANGLES / GL_POLYGON / GL_LINES etc. First, I'm ...
chris thomas's user avatar
7 votes
1 answer
465 views

How many 3D textures does OpenGL support

I'm making a voxel engine in OpenGL and wondering how many 3D textures I can have at once. They are fairly large (256x256x256 in GL_R32UI format). I want it to be able to run on any graphics card ...
Sam's user avatar
  • 198
15 votes
1 answer
3k views

Synchronizing successive OpenGL Compute Shader invocations

I have a couple of compute shaders that need to be executed in a certain order and whose outputs depend on previous inputs. Ideally, I'll never need to copy a buffer client-side and do all of my work ...
Mokosha's user avatar
  • 1,144
9 votes
1 answer
2k views

Shadow Mapping artefacts

I've been playing around with shadow mapping in OpenGL using depth textures. The depth texture is fine and I can map it onto the scene but I have some strange artefacts on the back of the object: My ...
Blarglenarf's user avatar
5 votes
0 answers
890 views

How Texture Prefetch works? [closed]

I know GPU prefetches textures and that's why dependent texture reads are slower, but how does it work and at what point that happens? EDIT: Split the content of this question into others as ...
Felipe Lira's user avatar
  • 1,236
9 votes
2 answers
285 views

When is it better to upload partial model matrices to the vertex shader?

As of now, when rendering my scene and while iterating through the scene graph, for each node its model matrix is calculated from the parent's model matrix and the scene node's pose. This is quite ...
Nero's user avatar
  • 1,310
4 votes
1 answer
116 views

Is there a way for me to record every shading sample for a deep texture

Im developing a deep texture processing engine. Right now I have a software renderer to generate the raster samples. Now, for bigger renders it would be nice to do this on hardware. Is there a ...
joojaa's user avatar
  • 8,397
10 votes
1 answer
2k views

Is it good practice to use all the available texture units?

When applying multiple textures to a mesh, like for bump-mapping, I usually bind the textures to the first few fixed texture units, e.g.: diffuse = unit 0, bump = unit 1, specular = unit 2, then keep ...
glampert's user avatar
  • 1,459
8 votes
0 answers
695 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 : ...
nilspin's user avatar
  • 81
9 votes
1 answer
2k views

Writing to a compressed texture using a compute shader, with no extra copies

I'm trying to figure out what the best way is to generate an OpenGL texture using a compute shader. So far, I've read that pixel buffer objects are good for non-blocking CPU -> GPU transfers, and that ...
Mokosha's user avatar
  • 1,144
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
6 votes
2 answers
3k views

How to reduce the number of draw calls when rendering one object multiple times?

Especially when rendering particle effects, the same object needs to be rendered several times with slightly modified properties. But these changes are often limited to properties like pose or ...
Nero's user avatar
  • 1,310
6 votes
1 answer
279 views

How to render an object that recieves shadows but does not cast them in a variance shadow mapping system?

I'm currently preparing to implement variance shadow mapping based on this article. However, one point it makes concerns me: Rendering only casters (and not receivers) into the variance shadow map ...
user avatar
8 votes
2 answers
763 views

Real-time translucency effect

While rendering my scene with OpenGL, I sometimes add an overlay which contains information, settings and a few draggable items. Currently, the overlay has a slightly transparent background to make ...
Nero's user avatar
  • 1,310
8 votes
1 answer
3k views

Using extensions in Android OpenGL ES 2.0

It is no secret that according to the official documentation extensions are not available under OpenGL ES 2.0. Nevertheless, the glext.h file present in the NDK platform-include directories makes me ...
Netherwire's user avatar
16 votes
2 answers
14k views

How to implement a trackball in OpenGL?

After so much reading about transformations it is time to implement a trackball for my app. I understand I have to create a vector from the origin to where the mouse is clicked and then another from ...
BRabbit27's user avatar
  • 969
9 votes
1 answer
542 views

Rendering fog underneath water

I'm aware of glFog, which blends between the fog and surface colour based on distance to the camera, like this: The equations are even given in the docs. But the fog is applied immediately in front ...
jozxyqk's user avatar
  • 669
16 votes
3 answers
6k views

What are some methods to render transparency in OpenGL

Alpha blending can be turned on to make surfaces transparent, like so: ...
jozxyqk's user avatar
  • 669
71 votes
6 answers
51k 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
10 votes
1 answer
2k views

Is it possible to alpha blend multiple render targets using a specified alpha?

Say I have render targets 0 through N and RT 0 happens to have in its fourth component an alpha channel specified by a material or mask or something. Is it possible to have the hardware compositor ...
jeremyong's user avatar
  • 267
27 votes
2 answers
18k views

What is fwidth and how does it work?

The OpenGL documentation states that fwidth returns the sum of the absolute value of derivatives in x and y. What does this mean in less mathematical terms, and is ...
ApoorvaJ's user avatar
  • 587
14 votes
1 answer
2k views

When to disable perspective correct interpolation ( noperspective )

In GLSL, perspective correct interpolation of vertex attributes is the default setting - one can disable it for specific vertex attributes by using the noperspective qualifier. Other than in post-...
gemse's user avatar
  • 243
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
18 votes
1 answer
2k views

Is there any way to generate primitives in a geometry shader without any input geometry?

A few years ago I tried to implement this GPU Gem in OpenGL to generate 3D procedural terrain using Marching Cubes. The article suggests to implement Marching Cubes in a geometry shader to maximum ...
Martin Ender's user avatar
  • 2,720
12 votes
2 answers
846 views

Is it possible to find out how many fragments made it through the stencil test?

I have an OpenGL application which uses stencil tests quite extensively to render irregular shapes (a bit like a simple 2-D CSG). If I could find out how many fragments passed the stencil test and ...
Martin Ender's user avatar
  • 2,720
12 votes
1 answer
771 views

Is modifying a texture (painting on it) considered a "state change"?

The convention in graphics is that performing fewer state changes is better than performing more state changes (switching shaders, binding buffers, binding textures, etc.). For textures, it is faster ...
TheBuzzSaw's user avatar

1
11 12 13 14
15