Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [opengl]

For questions involving use of the OpenGL graphics library.

1
vote
1answer
29 views

GBuffer: Framebuffer with different texture format types?

I rely on this answer from Nathan Reed: How much precision do I need in my G-Buffer? It is proposed to use two different texture formats for one Gbuffer. However as far as I know, color texture ...
0
votes
1answer
30 views

OpenGL Unable to retrieve the values of data sent to shader using textures

I've been following these tutorials and i can't figure out how to send data to shaders using textures. https://en.wikibooks.org/wiki/OpenGL_Programming/Scientific_OpenGL_Tutorial_02 In this tutorial ...
-1
votes
2answers
51 views

How do I use texture coordinates of a .obj file in OpenGL?

I have an obj file, with texture coordinates (indicated by vt). How would I use this to load textures in OpenGL?
1
vote
1answer
58 views

Specular/Diffuse light on an icosahedron opengl

I'm having a problem with my model here. I draw an icosahedron using GLUT, and the radius is set to 0.8. The info of the coordinates are listed below: (X and Z are calculated since our radius is 0.8) ...
1
vote
1answer
28 views

GL_SAMPLE_ALPHA_TO_COVERAGE and depth testing

I am currently looking into alternatives to my current, somewhat slow but exact, OIT approach. Specifically, GL_SAMPLE_ALPHA_TO_COVERAGE to convert the alpha value into a per-sample mask. ...
-1
votes
2answers
82 views

How to use multisampling with “if … return” in a fragment shader?

I draw transparent figures by depth peeling, the result is ugly when I render to multisample (a grid appears) ...
-1
votes
0answers
19 views

Compose multiple images in a single SDL surface

In this piece of code i managed to load a image with SDL and then succesfully pass it as a texture. Basically ...
0
votes
1answer
50 views

Efficiently drawing multiple instances of 3D objects

I was able to write the following working code to draw any number of "sprites" (defined as 2 tringles, 6 vertices) ...
0
votes
1answer
56 views

Convert shader from GLsl 1.50 to 1.30

I'm a newbie with OpenGl and I'm stuck in following the tutorial. I found this tutorial with these shaders ...
0
votes
1answer
44 views

Why is glreadpixels only working in certain cases?

If I try to read the screen with glreadpixels and then draw the same thing again using gldrawpixels it works, BUT if and only if ...
1
vote
1answer
102 views

Is a single shader and 1x1 pixel white sampler more efficient than frequent switching between shaders with and without samplers?

I have some existing OpenGL code that I am porting to Vulkan. The question is somewhat relevant to both OpenGL and Vulkan. I am rendering some primitives using textures, some single channel, others ...
1
vote
1answer
100 views

Translate an arcball camera upwards or left-right

This problem is giving me a really hard time. I'm always looking at the origin and have a camera that moves around it in an arcball mode. That part works beautifully: I'm calculating the camera ...
2
votes
1answer
79 views

Project vertex onto plane

What I have: a plane given by its normal$\ n $ and a point on the plane$\ p $. a 3D-point$\ v $. a direction$\ d$. What I need: the projection of$\ v$ along$\ d$ onto the plane. How can I ...
1
vote
1answer
59 views

Drawing Directed Lines (with arrow endings)

I am working on a simple graph viewer with OpenGL. My problem with is directed edges. I tried to draw arrow endings with GL_TRIANGLES but somehow my calculations are off. I've used direction cosine ...
1
vote
1answer
69 views

Is it possible to access adjacent vertex data in tessellation evaluation shader?

I'm trying to render thick cubic Bezier curves using the whole OpenGL 4.5 pipeline: I render a patch with 4 control points. Vertex shader is simply pass-through to tessellation control shader. ...
2
votes
1answer
76 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 ...
2
votes
2answers
131 views

How can I draw this style of grid?

I'm trying to write code (in any language) to render this 3D grid, matching the look and colors as closely as possible:
0
votes
1answer
41 views

Adding vbos to a vao once it has been created

Is it possible to add vbos to vbos after their creation? For example (pseudo-code): ...
6
votes
1answer
82 views

Do operating programs such as Microsoft Office or Windows Explorer use OpenGL to draw?

I have a server and my only monitor is plugged into its graphics card. My question is - do all programs (Windows explorer, Excel whatever) draw their output using the graphics card and more ...
0
votes
1answer
51 views

How to include OpenGL extension loader in my project

I have a modern OpenGL project hosted publicly. I want to create the easiest experience so someone can just clone the repo and have it just work. So far, I have included (as git submodules) the ...
2
votes
0answers
50 views

Identification of visible area of a plane in OpenGL

I have somewhat generalized version of this question: https://stackoverflow.com/questions/52475104/how-to-show-visible-part-of-planar-world-rendered-with-3d-perspective-on-topside -‎ I would also like ...
2
votes
2answers
127 views

What's the point of “work groups” for OpenGL compute shaders?

glDispatchCompute has the number of work groups as arguments. What is the point of having work groups? How are they useful, compared to just having NxM independent pixel calculations with a known (x,...
4
votes
1answer
86 views

How to apply wire texture for realistic rendering of embroidery?

I am building an algorithm which takes a bitmap image as input and render the image as an embroidery design. The different steps are : Vectorize the image, I keep only 5 colors (Done) Generate ...
-1
votes
2answers
82 views

Relatively new to OpenGL, need guidance/tips on an assignment with interactive user input

I'm currently taking a Computer Graphics class at university, and have been given an assignment which involves loading an obj file and manipulating it with keyboard and mouse controls (eg. arrow keys ...
2
votes
1answer
129 views

Why are depth buffer values clamped to (0, 1)?

This is a simple question. I know that in OpenGL or other graphics API, the values stored in the depth buffer are automatically clamped to (0,1). I just want to know why people do this instead of ...
1
vote
1answer
46 views

What does “region to be shaded” mean in the PCF paper?

I am reading the percentage closer filtering (PCF) paper by Reeves, W. et al. (https://graphics.pixar.com/library/ShadowMaps/paper.pdf). At at section 3.2, it mentioned that "each shading calculation ...
3
votes
2answers
66 views

Can gl_WorkGroupSize be set outside the compute shader?

I am migrating code from CUDA to OpenGL compute shaders. I could not find a way to set the local workgroup size outside the shader; is there a way to set gl_WorkGroupSize in the calling program like ...
0
votes
1answer
90 views

Multiple VAO share a EBO (OpenGL 3.3)

As mentioned here, multiple VAOs can share a single VBO. However, can multiple VAOs share a single EBO? For example, I want to create 2 rectangles. So, I do the following: ...
1
vote
1answer
45 views

Difference between relativeOffset and offset in VAO with Direct Access Ext

Using The DSA Ext with opengl , API calls to guide opengl to the buffer format are : ...
1
vote
1answer
84 views

Issue with loading a texture on the GPU with OpenGL 4.1 Core profile

I’ve been trying to render a texture on the whole screen in OpenGL 4.1 using the Core profile and followed a few tutorials on the matter, but all I have so far is a blank screen. I tried using my ...
1
vote
0answers
57 views

glTexSubImage3D throws GL_INVALID_ENUMERATION on NVIDIA

I'm having problems when using the following statement on different GPUs: glTexSubImage3D(target, 0, 0, 0, 0, width, height, layers, format, type, NULL); on ...
0
votes
0answers
49 views

How to compute size of OpenGL's image buffer?

I am trying to retrieve OpenGL's color buffer with the following code. My program is crasing in the line that makes the call to glReadPixels() apparently image.data ...
1
vote
0answers
303 views

How Skia uses OpenGL backend?

Skia 2D's one notable backend in OpenGL, but how does it work under the hood to render? Say, we need to draw an anti-aliased circle. Does Skia: make a quad (using 2 triangles) and paint the circle ...
1
vote
1answer
56 views

Drawing a plane super-imposing over another plane

I wish to draw a plane (A building's floor in this case) over a canvas plane (assume the plane is smooth). The planes are drawn as QUADS. The problem is that both plane are located at the same height....
0
votes
0answers
76 views

Hard edges appearing in voxel cone tracing (how to remove them?)

I am generating shadows using a voxel pyramid (commonly called voxel cone, although I hate that term). Some of my shadows come as expected, however some are very strange. For example in this image: ...
0
votes
0answers
35 views

Problem with imageStore to 3D texture on old AMD card

I've been updating an old project that does Marching Cubes using compute shaders, and it fails on my laptop with an old AMD GPU (7670M). After investigating a bit, I found the problem is with writing ...
0
votes
0answers
85 views

Changing coordinate system from texelFetch to textureLod is breaking the algebra

I have a scene rendered using texelFetch() and I am trying to modify the shader to use textureLod() instead. This is the image generated with texelFetch: When I try to change the shader to use ...
0
votes
0answers
146 views

OpenGL - Fit High/Low Resolution Image/Texture to a particular size Window

Consider a ray tracer written in OpenGL and using GLFW as a window toolkit. There are basically 2 options to display the ray-traced image. 1) Create a RenderBuffer ...
1
vote
0answers
64 views

Voxel cone tracing artifacts (what causes them and how to solve them)?

I am trying to generate soft shadows using voxel cone tracing. Which gives me the next images: In the first image you can see an artifact of a sequence of horizontal shadows alternating with ...
1
vote
0answers
110 views

How exactly do soft shadows get generated using a voxel cone tracing rendering technique?

Let's assume we have voxelized a scene, and all of our materials have an opacity level of 1. The reuslt would then look like: If we raytraced the final volume that gets generated after rasterization. ...
1
vote
2answers
164 views

How to convert from glBegin() and glEnd() to VBOs?

How to convert from glBegin() and glEnd() to VBOs (Vertex Buffer Objects)? I found a simple example here: ...
4
votes
2answers
118 views

What is OpenGL's paradigm?

OpenGL is not object-oriented, but more like "switches you turn on"? Like ...
0
votes
1answer
114 views

Self intersection artifacts in 3D image raytracing

I am developping a voxel raytracer for global illumination. I have been successful in multiple aspects but there is a problem I am not sure how to solve. The model works as most other Voxelization ...
0
votes
1answer
29 views

Texture units parameters in OpenGL

I am writing a procedural terrain renderer for OpenGL. To shade the terrain I use multitexturing, that is 4 material textures and a blend map which distributes them across the terrain (encoded in RGBA)...
0
votes
0answers
44 views

How to ensure that the raytrcing coordinate system is teh same as the projection one?

I have 2 shading models right now, one is using voxels the other one is the standard projection absed renderization method. Putting them side by side I have noticed that no matter what I do one is ...
3
votes
0answers
188 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 ...
1
vote
1answer
51 views

Can you avoid querying for a texture location in OpenGL?

The way I learnt to send a texture to a shader is more or less ...
2
votes
1answer
84 views

How to solve Z buffer artifacts

I am currently rendering a scene in the most standard fashion possible (triangle projection and Blinn-Phong for shading) However I am getting some artifacts: As you can see the lion head is not ...
1
vote
0answers
36 views

Handling varying texture sizes in an array texture

Say we've idetified that we have a varying number of textures that are upper capped by 2 parametrs. thus we allocate the maximum amount of memory needed to store all textures as follows: ...
1
vote
2answers
47 views

How to assign a texture to a single entry of a texture array?

The C++ psuedo code to transmit the idea of what I want to do would be: Texture_array tarr = Texture_array(6); tarr[0] = texture; Which I am attempting to do as ...