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
10
votes
1answer
2k views

What is the modern equivalent of display lists?

Display lists were an OpenGL feature that could, in theory, accelerate any part of the API by storing a group of commands for later use. In my understanding, this makes a lot of sense with regards to ...
5
votes
1answer
66 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 ...
2
votes
1answer
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 ...
6
votes
1answer
366 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 ...
13
votes
1answer
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 ...
8
votes
1answer
1k 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 ...
4
votes
0answers
708 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 ...
8
votes
2answers
242 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 ...
3
votes
1answer
103 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 ...
9
votes
1answer
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 ...
7
votes
0answers
567 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 : ...
8
votes
1answer
1k 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 ...
13
votes
1answer
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 ...
10
votes
4answers
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 ...
5
votes
2answers
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 ...
5
votes
1answer
249 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 ...
7
votes
2answers
656 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 ...
7
votes
1answer
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 ...
16
votes
2answers
12k 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 ...
8
votes
1answer
471 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 ...
14
votes
3answers
5k views

What are some methods to render transparency in OpenGL

Alpha blending can be turned on to make surfaces transparent, like so: ...
67
votes
6answers
45k 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 ...
9
votes
1answer
1k 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 ...
23
votes
2answers
15k 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 ...
13
votes
1answer
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-...
17
votes
3answers
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 ...
17
votes
1answer
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 ...
11
votes
2answers
747 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 ...
11
votes
1answer
709 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 ...

1
9 10 11 12
13