Skip to main content
30 votes
Accepted

What does "makeContextCurrent" do exactly?

OpenGL is a state machine. An OpenGL context holds that state. The state contains information such as which textures are bound to which texture units, which attachments the current FBO has, and things ...
user1118321's user avatar
  • 3,421
9 votes
Accepted

Modern way of light sources in OpenGL?

Why are they deprecated? Those functions are deprecated because the OpenGL API moved in favor of a programmable pipeline in contrast with the old fixed pipeline. The programmable pipeline allows the ...
Samu's user avatar
  • 546
9 votes
Accepted

Ray casting in fan configuration produces point cloud with curvature, how to eliminate curvature?

The direction vectors start at +15 degrees on the YZ plane, and continue in increments of -2 degrees down to -15. There's your problem—by generating the rays that way, you're doing something more ...
Nathan Reed's user avatar
  • 25.1k
8 votes
Accepted

How do I create a Win32 window with a Vulkan context?

There's no such thing as a Vulkan context, the way there is with OpenGL. This is because Vulkan is a lower level API and an OpenGL context ties together a number of concepts that are distinct in the ...
Jherico's user avatar
  • 521
7 votes
Accepted

Role of PDF of Uniform Random Sampling in a path tracer

Firstly, as @trichoplax correctly pointed out, your randomPoint function calculates a point in a cube, then uses rejection sampling to return all points that are inside a unit sphere. In order to ...
RichieSams's user avatar
  • 3,782
7 votes
Accepted

Generate this kind of 2d burst or pulse algorithm?

Rather than using an image, I would suggest doing this kind of effect using a shader. I'm not familiar with Cocos2d-x, but some quick googling suggests that it can work with shaders. You'd use a pixel ...
Nathan Reed's user avatar
  • 25.1k
7 votes

How can I utilize all cores of CPU In my ray tracer with std::thread?

This is not really a CG issue but you appear to have an integer division problem. Assuming mMaxThreads is an integer, ...
Olivier's user avatar
  • 1,585
6 votes
Accepted

Open GL Shader Storage Buffer Objects to replace Vertex Attributes

The counter you want is built in the shader as gl_VertexID. However you have 16 attributes of 4 components each to work with. Take 2 components for the texture ...
ratchet freak's user avatar
6 votes
Accepted

Path tracer not rendering shadows

The problem appears to be unintentionally transparent surfaces Although the image is grainy, it is sufficiently clear to estimate that all of the darker regions are due to surfaces facing away from ...
trichoplax is on Codidact now's user avatar
6 votes
Accepted

Artifacts when gamma correcting

Short answer, set the precision of the image to a higher value. Long answer, When looking at a gamma correction curve, you can see that the lower values get changed much more, this means that the ...
bram0101's user avatar
  • 1,605
6 votes

How to handle a parametric equation in raytracing?

Many years ago I worked on a ray tracer that handled parametric surfaces, so this is unlikely to be state of the art, but, IIRC, I used a combination of interval arithmetic with (binary?) subdivision ...
Simon F's user avatar
  • 4,296
5 votes

Path tracer not rendering shadows

is it correct having such a big light? I don't see any problem with having a big area light. That said, it also depends on the scale of your scene. If the light is large compared to it, shadows will ...
Julien Guertault's user avatar
5 votes

How to compensate low amount of rays reaching the light in a Path Tracer

A note first From the look of your screen capture, I suspect there might still be a bug in your code. Noise is to be expected with only 16 spp, but your picture still looks surprisingly dark to me. ...
Julien Guertault's user avatar
5 votes

Resulting Probabilty Density in Path Tracer for paths using Next Event Estimation

I don't have any experience with Gradient Domain Path Tracing, but here are my thoughts: There seems to be a different problem If you look carefully at the little spikes of distortion in the final ...
trichoplax is on Codidact now's user avatar
5 votes
Accepted

Swap buffers twice does not show the first scene

If you swap buffers, you have a triangle in your screen and a empty color buffer in the other side. No, you do not. Buffer swapping does not necessarily mean that the current contents of the front ...
Nicol Bolas's user avatar
  • 9,842
5 votes
Accepted

Strange behaviour in vertex shader with divisions

The vertex shader only runs per vertex, not for every point in the square. So the four vertices are mapped to (±2, ±2), and then the GPU draws a polygon between those vertices, which does cross the ...
Nathan Reed's user avatar
  • 25.1k
5 votes

How to use multithreading in 3D software renderer to speed up fetching texture values

It could be that you have to overcome a different bottleneck first. Have you ever read Jim Blinn's "The Truth About Texture Mapping"? (I had a quick search to see if I could find a non-paywalled ...
Simon F's user avatar
  • 4,296
5 votes

Vulkan best way of updating pipeline viewport

Both suggested methods are fine, but they should be preferred in certain situations. Dynamic state should be preferred in situations where you have many, perhaps thousands of, pipeline objects or you ...
aces's user avatar
  • 1,353
5 votes
Accepted

Why does DirectX use COM pointers and interfaces?

C++ has no defined ABI, so C++ programs can't link to libraries that were compiled with a different compiler. In addition, MS's Visual Studio C++ compiler is not ABI-stable, so you don't just have to ...
Dan Hulme's user avatar
  • 6,840
5 votes
Accepted

This function syntax is confusing me

The signature of glfwGetProcAddress is: GLFWglproc glfwGetProcAddress(const char *); It's a function that takes a string and ...
Sebastián Mestre's user avatar
5 votes
Accepted

Max number of elements in a vertex attribute

The standard solution is to reduce the amount of per-vertex data by only specifying the 4 indices that have the highest weights (and rescaling the weights to add up to 1.0). That way, you can pass 4 ...
Nicol Bolas's user avatar
  • 9,842
5 votes
Accepted

Understanding fragment shader coordinate system

Everything in this code functions as intended, until I try to translate the entire grid (grid lines) to the center of the screen by adding v_Resolution.x / 2 to uv.x. Not sure what your intention is ...
wychmaster's user avatar
  • 1,251
4 votes
Accepted

Ray-tracing the Cornell Box results in really inconsistent image

Two symptoms There appear to be two problems with the image. The background is showing through along the line between adjacent triangles. The colour displayed is not always from the closest ...
trichoplax is on Codidact now's user avatar
4 votes
Accepted

Proper architecture for rendering history of streamed data (points)

My advice would actually be to stick with solution 1 unless and until something more is needed. It's the simplest and easiest to understand, and it should be quite feasible to make it perform well. ...
Nathan Reed's user avatar
  • 25.1k
4 votes
Accepted

How to get the GLFW_CONTEXT_VERSION_MAJOR value?

According to the GLFW docs, the context version hint acts as a minimum version, i.e. the context you actually get may be a higher version than what you request. However, the context should be backward-...
Nathan Reed's user avatar
  • 25.1k
4 votes
Accepted

How to watch image being ray traced?

This is a very common question that most people in your situation (interested or fascinated shall I say in Computer Graphics) have and a problem they want to figure out. The solution is pretty simple, ...
user18490's user avatar
  • 656
4 votes
Accepted

My (ADS) shader doesn't render the light direction correctly

It seems to me, to be that your different positions and normals are not in the same space. Having them in the same space is important because else it might think the normal is pointing left while it ...
bram0101's user avatar
  • 1,605
4 votes

Strange behaviour in vertex shader with divisions

Going by the code in your vertex shader, the last set of vertices produces the following: ...
Noah Witherspoon's user avatar
4 votes
Accepted

How to unproject cursor with orthographic projection

I am still not 100% sure, if I understood your question, because of this sentence: Now however with orthographic projection the far and near plane are of the same size, so we can't calculate the ...
wychmaster's user avatar
  • 1,251
4 votes

What is the Viewport?

The viewport as specified by glViewport is just the rectangle in pixels on the screen that you wish to render to. Usually it's from (0,0) to (width, height) in ...
Nathan Reed's user avatar
  • 25.1k

Only top scored, non community-wiki answers of a minimum length are eligible