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
1 vote
1 answer
381 views

Rendering a volume that might be completely clipped in OpenGL

Suppose that I have some world-space volume (which we may assume is a convex polyhedron with a small number of vertices), and I want to render its intersection with the view frustum, such that every ...
lisyarus's user avatar
  • 215
0 votes
1 answer
338 views

OpenGL pipeline stages, when is the primitive assembly executed?

The question is simple, I have this diagram from the Khronos page: And this diagram from the Learn OpenGL page In the first picture the Primitive assembly is executed for example after the Geometry ...
user8469759's user avatar
0 votes
1 answer
112 views

Rendering part of the scene inside bounding sphere

In this video https://youtu.be/0ckE-CZpXAo?t=445, it's suggested to render onto a sphere instead of screen quad to save computation time on lighting calculations. So you create a bounding sphere for ...
Lenny White's user avatar
6 votes
3 answers
13k 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
0 votes
2 answers
406 views

Is there a tool capable of drawing a triangular linear gradient fill?

I need to draw some shapes filled with linear gradients starting from every point and blending smoothly between points, like an OpenGL standard shading (I guess it is called ...
ivan866's user avatar
  • 111
2 votes
1 answer
701 views

Max number of elements in a vertex attribute

I want to load a vertex buffer with vertices of struct Vertex: ...
Lenny White's user avatar
0 votes
1 answer
192 views

Tessellation Controll Shader how to get maximum subdivisions limit?

I have a low-poly mesh and I want to add structure on the surface. The setup: The mesh consists of triangles. Within the TCS the pixel-length for each of the three edges will be calculated and ...
Thomas's user avatar
  • 1,136
1 vote
0 answers
98 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 ...
joethemow's user avatar
  • 111
0 votes
1 answer
3k views

Drawing a cube and wireframe opengl

I'm trying to render a cube and it's wireframe together using OpenGL The main function is this: ...
user8469759's user avatar
1 vote
1 answer
295 views

draw on cubemap with help of geometry shader each triangle covers each cubemap face (why??)

I want to do some complicated stuff but have problems with my geometry shader / FBO bindings. To hold it as easy as possible I reduced the code to a minimum. If this works, I could continue the hard ...
Thomas's user avatar
  • 1,136
2 votes
3 answers
379 views

How to paint onto 3d models

I have searched this topic for very long time and have found basically no information on it. If we have a 3d model with a uv layout. What is the basic technique for 3d painting on said model with a ...
Lenny White's user avatar
2 votes
2 answers
636 views

OpenGL - Recreate position in viewspace from depth values

Current state: I belive the reconstructed positions are correct. However, I still have the same problem as all the time. When I rotate around my single pointlight appears to be moving around also. I ...
the1bird's user avatar
  • 126
1 vote
1 answer
137 views

What is the simplest way to create basic 3d/isometric style images programatically like autocad/blender

I need the simplest route to programatically, via command line, through python or node, to create something like this using basic input of distance and 90 degree turn etc: https://i.stack.imgur.com/...
Mark's user avatar
  • 13
2 votes
1 answer
3k views

Using buffers correctly in OpenGL compute shaders

I'm re-writing an algorithm that I first wrote using matrix/vector operation into OpenGL kernels in order to try to maximiz the performances. I have a basic knowledge of OpenGL, so I was able to get ...
04348's user avatar
  • 23
1 vote
1 answer
255 views

How 3D painting software works

I am new to graphics programming and i'm learning opengl. I managed to make a really simple renderer where i can import models display theirs textures with all lighting. My goal is to make a simple ...
Abdelbaki Boukerche's user avatar
1 vote
1 answer
122 views

Using original vertices coordinates after clipping

Clipping is down in homogeneous clip space, therefore after multiplying the vertices by the model-view matrix. But as we do clipping in clip space, the position of the new vertices that we interpolate ...
Jojolatino's user avatar
0 votes
1 answer
466 views

Get binding point of sampler/image in shader

I have an image and a sampler declared in a shader as follow layout(binding = 5) uniform isampler2D heightmap; layout(binding = 3) uniform writeonly uimage2D info; ...
Aulaulz's user avatar
  • 161
0 votes
1 answer
132 views

OpenGL shader introspection/interface queries for images

I've been looking at Interface queries in order to prevent common mistakes that are time consuming to debug, such as forgetting to bind a buffer, binding the wrong resource type, etc. However, I wasn'...
Aulaulz's user avatar
  • 161
1 vote
1 answer
179 views

Is it possible to send Texture Buffer to shader dynamically?

I want to send a series of integer to the geometry shader, while the data will be modified every frame. But when I try to retrive the sampleBuffer in geometry shader, it seems to keep output zero. Am ...
Hanakuru's user avatar
1 vote
1 answer
411 views

Transfer the texture between two different sets of uv

Say I have a mesh with two sets of uvs. And I have a texture made for the first set of uvs. I would like to create a second texture that has the same relationship between its pixels and the second set ...
Lenny White's user avatar
2 votes
0 answers
553 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 ...
Ethan Ma's user avatar
1 vote
1 answer
338 views

Does atomic functions on same memory location cause an performance issue?

is it worse to do for each invocation an atomicAdd on the same memory location than doing for each invocation an atomicAdd to a unique memory location? (I know, atomicAdd does not make sense when each ...
Thomas's user avatar
  • 1,136
1 vote
0 answers
106 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 ...
MaT's user avatar
  • 1,219
1 vote
1 answer
649 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
855 views

When unsetting a VAO, should you also unbind the associated VBOs?

I'm working with a js/wasm/c++ program that uses object oriented programming when updating the OpenGL state. There are corresponding c++ classes for VBOs (vertex buffer) and VAOs (vertex array). ...
NateW's user avatar
  • 113
1 vote
1 answer
380 views

OpenGL Framebuffer with multiple Depthbuffers inside

I am trying to put multiple depthbuffers into one Framebuffer. I want to use VR and render both eyes at the same time: that means, in the geometry stage I want to clone the incoming triangle to two ...
Thomas's user avatar
  • 1,136
1 vote
2 answers
370 views

Why negate z when constructing projection matrix OpenGL

I constructed an orthographic projection matrix from this article on scratchpixel.com: ...
Lenny White's user avatar
0 votes
0 answers
179 views

Crystal ball rotation - I don't get why the code works

For context: I'm absolutely new to graphics programming and I've always had trouble getting the math. I had the task to write code for a crystal ball interface using OpenGL. There's an object in the ...
user avatar
2 votes
1 answer
875 views

How to scale signed distance field fonts properly?

I have a setup where I'm rendering a bunch of characters on a canvas with an SDF font. The users can zoom in to see the details of the smaller texts, but currently the smaller characters are quite ...
Endanke's user avatar
  • 131
1 vote
0 answers
233 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:...
Botond Máté's user avatar
2 votes
1 answer
296 views

Dynamic Ray-Triangle Intersection

I am working on a small simulation software which has a 3D Renderer that is using OpenGL. I render objects to the screen as triangle meshes. To be able to select the triangles on the screen, I have ...
cemklkn's user avatar
  • 23
2 votes
1 answer
211 views

Can the framebuffer in OpenGL jargon or its color buffer end up being the one and the same memory location as the one scanned by a display controller?

My understanding is: the 'framebuffer' in OpenGL is a collection of buffers: many (due to swapping or stereo rendering) color buffers, (only one?) z-buffer and (only one?) stencil buffer; each OpenGL ...
user1624691's user avatar
2 votes
1 answer
164 views

Rendering moist/wet materials like human anatomies for surgical simulators

Real human anatomies look wet/ moist when operated. I am looking for some good methods for rendering anatomies in a virtual simulation, and hence I have done a literature survey on 'Rendering wet ...
Argha Chakraborty'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
3 votes
1 answer
214 views

OpenGL task/mesh shader extension NV_mesh_shader not behaving as I expected

I am trying to get up to speed with the NV_mesh_shader extension from NVidia (on my RTX2080). Samples are rare, so I tried to come up with my own small sample. I am rendering a sphere (20 triangles) ...
pettersson's user avatar
0 votes
1 answer
96 views

Force int array to compact memory

I have following structure which i use as an uniform buffer object. ...
MrRabbit's user avatar
2 votes
1 answer
193 views

glutSolid* source code

I am trying to build a dedocohedron in OpenGL, and I know that there is a built-in function in GLUT for the purpose. I was wondering if there is a way to either see the sourcecode for those functions, ...
tado-mi's user avatar
  • 21
2 votes
1 answer
323 views

With vsync enabled where does the wait happen in OpenGL?

When having vsync enabled I'm imagining that OpenGL has an explicit wait function to try and keep the frame rate constant. If so where is this function implemented exactly? After running some tests <...
Lenny White's user avatar
3 votes
1 answer
835 views

Shader that transforms a mercator projection to equirectangular?

I am new in the OpenGL - GLSL and trying to make a shader that taking a mercator projection texture as a source and converting it to an equirectangular projection texture. Sample input: (1024x1024) ...
Hamid Reza Mohammadi's user avatar
0 votes
0 answers
29 views

Custom Create Maps in OpenGL

I am trying to create some procedurally created terrains for which i need to create noise maps. How do I create a texture of noise map in OpenGL and then pass that in my vertex shader as a heightMap? ...
Anon258's user avatar
2 votes
0 answers
151 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)}{...
Peter's user avatar
  • 21
1 vote
1 answer
715 views

OpenGL Render front and back faces with different shading for 3d modeller

I'm working on a simple 3d modeller and I would like to render the back facing triangles a bit darker, to easier differentiate between front and back faces. Like you can see in most modelling ...
Lenny White's user avatar
1 vote
1 answer
88 views

Do we have OpenGL shaders write out the intermediate *.o-esque file on first compile so that we can skip compiling them in run-time every single time?

Shaders get compiled during runtime every single time an app starts. I understand the reasoning for this is that there are so many GPU architectures out there that it does not make sense to ship pre-...
Harsh's user avatar
  • 113
-1 votes
1 answer
148 views

When do people need to work directly with a graphical API (eg: Direct3D) instead of using already made software?

I had this doubt in my head for several months and have been unable to find an answer anywhere on internet. I know what OpenGL, DirectX, Vulkan, Metal, etc... are, I already know what they are used ...
lorenzo's user avatar
  • 101
1 vote
1 answer
509 views

Passing mat4 array to GLSL succeeding but producing GL_INVALID_OPERATION

I'm currently passing an array of bone positions to GLSL for a skeletal animation shader; the positions are passing successfully but producing a GL_INVALID_OPERATION error. I'm passing the matrices ...
user avatar
0 votes
0 answers
456 views

Best practices fo OpenGL static buffer data : what is best for performance?

My question is : to allocate static mesh data (vertex/index buffers that never change), is it best : To go the "obvious" way : "1 mesh = 1 VBO", submitting data using glBufferData with GL_STATIC_DRAW ...
Scylardor's user avatar
  • 101
1 vote
2 answers
52 views

Older Api documentation

I am currently using a older IntelHd Gpu which supports Opengl3.1 (Glsl #version140). While trying to locate the relevant Api for this version ,the Khronos site only provides documentation for ...
srt111's user avatar
  • 121
1 vote
1 answer
624 views

Implicit conversion in glsl shaders

When specifying member values for a structure consisting of float values like vec3 or mat3, is it guaranteed that if an integer ...
Lenny White's user avatar
2 votes
1 answer
357 views

Vector graphics output from shader program

I’m fairly new to shader programs in general but I have a question concerning vector graphics. I understand that a pixel shader can generate the color information to draw some sort of geometry on ...
andyopayne's user avatar
0 votes
1 answer
586 views

How to read illum value from mtl file using Assimp library?

I am loading an OBJ file using the ASSIMP library. Following is the MTL file associated with the obj file. ...
user13184's user avatar

1
3 4
5
6 7
15