Stack Exchange Network

Stack Exchange network consists of 175 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 [c++]

The tag has no usage guidance.

2
votes
0answers
22 views

HalfEdge data structure in openmesh, create_face function explanation

Does anyone have experience with open-mesh or computational geometry and can kindly explain what exactly happens in the function below? ...
0
votes
1answer
72 views

smallpt: ray scattering and Importance Sampling

Introduction For those familiar with smallpt by Kevin Beason: In path tracing, when rays hit a surface, they are scattered and the theta angle (the angle between the normal to the surface and the ...
0
votes
1answer
81 views

smallpt: when to stop diffuse ray scattering

For those familiar with smallpt, the ray tracer in 99 lines: I am checking the code, and there is something that is not clear to me in the DIFFUSE ray scattering. After the rays are shot, they keep ...
0
votes
0answers
19 views

Help with efficient quadtree vertices indexing to avoid redundancy

I am creating a quad tree from ground zero, because I am going to collapse it from bottom up I am refining it with a certain LoD level. I am using glm for mathematics and opengl for rendering. ...
5
votes
0answers
101 views

How to account for self intersection with large ray tracing scenes?

I'm working on a hybrid real time ray tracing project and trying to tackle the problem of self-intersection with larger scenes due to loss of float accuracy. The logic I'm trying to use is based on ...
0
votes
1answer
92 views

Monte Carlo Importance Sampling

I am following the "Ray Tracing - the Rest of your Life" book by Peter Shirley and I am facing some troubles in the implementation of Monte Carlo importance sampling, and Direct light sampling. Monte ...
-3
votes
1answer
72 views

This function syntax is confusing me

gladLoadGLLoader((GLADloadproc)glfwGetProcAddress) I have never seen this syntax before. Presumably glfGetProcAddres is a function, but it has the brackets behind it. Is this only possible in open gl ...
0
votes
1answer
75 views

Ray tracing the next week: understanding Instances

My question is not about the code, but it's about the approach used by the author Peter Shirley (and apparently common practice in ray tracers) of handling Instances. To understand the question it's ...
1
vote
1answer
76 views

How can I control memory for command allocators and command queues in D3D12?

The D3D12 programming guide suggests specific allocation strategies for command queues and allocators, but the creation methods for those objects operate directly on queue/allocator pointers without ...
1
vote
1answer
59 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
vote
1answer
104 views

Do I need separate Graphics and Transfer commands?

I was following this tutorial on Vulkan https://vulkan-tutorial.com/Vertex_buffers/Staging_buffer and I decided to do this bit: The buffer copy command requires a queue family that supports ...
1
vote
1answer
289 views

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

I am aware of libraries that already do this (like GLFW), but I would actually prefer do all of the window and context creation by myself.
3
votes
0answers
157 views

ray-triangle intersection precision - c++

I'm building a software renderer but I think there might be some problem with my ray-triangle intersection accuracy. I implemented the algorithm referring to ...
0
votes
1answer
77 views

qt - view geomview (.off ) file

I want to open a .off file and view the content 3d model using libQGLViewer, qt-creator. I don't know how to display the 3d model after opening its .off file. ...
-1
votes
2answers
105 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
76 views

Why does DirectX use COM pointers and interfaces?

I have a rudimentary understanding of COM and I know that its main purpose is to enable interoperability between programs written in different languages. However I dont understand why that is useful ...
0
votes
0answers
45 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 ...
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
235 views

Weird artifacts in my ray tracer

I am getting weird artifacts in my simple ray tracer that I made using the book Ray Tracing in One Weekend by Peter Shirley. Example: (circular pattern on the ground and black tint on the spheres.) ...
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: ...
0
votes
1answer
257 views

Opengl black screen for a simple translation

i am a beginner to opengl following an online guide, I am trying to make a simple translation to my triangle. The triangle did render correctly when i made a float uniform to translate it, but when i ...
0
votes
1answer
143 views

Distorted OpenGL graphics in certain models of Intel GPUs under Windows; possible causes?

I'm not sure this is the best place to post this, but it definitely seemed more appropriate than programming. I'm one of the developers of Performous, essentially a karaoke (and instruments) game. We ...
1
vote
1answer
183 views

Issues with Multi-threaded Raytracing

I'm having some issues with my multi-threaded ray tracing implementation. It seems to only render about half of the image. Here is the picture: Here is the code: ...
1
vote
0answers
85 views

Adding Ozone to my sky simulation

I implemented a simulation for the colour of the sky a while ago by following the scratch a pixel tutorial: https://www.scratchapixel.com/lessons/procedural-generation-virtual-worlds/simulating-sky I ...
5
votes
1answer
391 views

Inverse value in a Perspective Matrix

I am a new leaner of computer graphics. I'm trying to understand a code I found online and I got stuck in the following formula: ...
1
vote
0answers
67 views

Image Processing: Photogrammetry [closed]

I am new to image processing but I am currently exploring myself in 3D reconstruction during my leisure time. I have decided to use openCV (eg. edge detection, possible?) in C++., maybe with a little ...
2
votes
1answer
178 views

Histogram of image intensities

I want to create a histogram of intensities 0.1, 0.2, .... 0.9, 1, from an image rendered using OpenGL and C++. How can I do this? Can I access the pixel intensities in the framebuffer somehow? Also, ...
2
votes
2answers
530 views

I'm trying to get a 2D screen position so I unproject a point from 3D into 2D screen coordinates by that following function:

I'm trying to get a 2D screen position so I unproject a point from 3D into 2D screen coordinates by that following function: ...
1
vote
0answers
229 views

How to properly release directx com objects

This one I am not getting even one bit. I started learning directx11 and using the basic dx initialization i tried a experiment by allowing an option to destroy the window and creating it again ...
1
vote
1answer
561 views

Vulkan best way of updating pipeline viewport

I have discovered that there are two ways to update the viewport (might be more, but not sure). Currently I am rebuilding the Pipeline when I resize my screen but there is a noticeable stutter as it ...
1
vote
0answers
355 views

360 degrees rotation around x axis

How do we rotate the camera around x axis 360 degrees, without having to flip the axis, meaning without having the strange flip after we go over +-90 degrees on <...
1
vote
1answer
121 views

How do I handle uniforms in a deferred renderer?

I'm currently working on a renderer that tries to minimize the amount of state changes when drawing objects. During each frame the client submits draw instances (the client provides a render state (...
3
votes
1answer
544 views

Please, help me to understand why my raytracing camera rotates in wrong directions?

I'm trying to build a raytracer and I use this article on how to build camera system. The problem is that when, after calculating ray direction in camera space, I multiply it by camera-to-world ...
1
vote
2answers
269 views

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

The biggest bottleneck of my code is fetching texture RGB values from memory. My code looks something like this: ...
1
vote
0answers
109 views

Finding Segments in Continuous line

I'm trying to break a continuous line segment into multiple, straight segments. I've tried using the Hough transform but have found it unreliable for getting the line segments I'm looking for and ...
5
votes
0answers
117 views

Computation of conservative AABB for clipped triangle

I'm currently trying to implement a fast algorithm for KD-Tree construction using SAH, as described in this paper: On building fast KD-trees for ray tracing, and on doing that in O(N log N) I found ...
2
votes
0answers
113 views

Image Laplacian incomprehension

I am reading and trying to implement a research paper. It uses openGL to define which part of an image to use in order to reconstitute a big image composited of several images. In order to do so, I ...
3
votes
1answer
339 views

Jos Stam's “Stable Fluids” boundary conditions

In the paper Stable Fluids by Jos Stam, I am confused about the boundaries in the set_bnd function in the code. I don't know what kind of boundaries is this. Is it Neumann boundary condition or ...
1
vote
1answer
544 views

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

I have been working on a ray tracer and I was trying to use multiple threads to maximize the performance. I tried couple of approaches but there's no difference in performance. Here's my shot... <...
4
votes
0answers
331 views

Problem with specular BRDF (Monte Carlo & Path Tracing)

Above on the left is my attempt and on the right is what I'm aiming for.As you can see my sphere with the specular brdf has a weird dark ring In my radiance function I am recursing through the ...
5
votes
2answers
153 views

Strange behaviour in vertex shader with divisions

This is the vertex shader code: ...
2
votes
2answers
368 views

Can somebody explain this Ray Tracing Function?

I am currently reading through Peter Shirley's Ray Tracing in One Weekend. In the beginning chapters where the author introduces diffuse surfaces we a presented with this function: ...
1
vote
1answer
569 views

Skia example code not writing an image

I am just trying to make a simple Skia program. A very simple program, but as I run this code, the output image file never writes anything. I am running this code on VS 2015 and included the skia.lib ...
4
votes
1answer
110 views

NormalMap problems: bumps work, but shade does not

I've been trying to figure this out for a few days now, but I just can't get it right. I've read multiple tutorials and possible explanations, I even watched a java tutorial without finding the ...
1
vote
1answer
187 views

How to organize Lights and Models?

I'm interested in how to organize in code (I prefer C++) lighting. Problem is: I have Scene which contains Model where model ...
1
vote
1answer
160 views

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

This is what I'm doing: vertex shader: ...
1
vote
1answer
281 views

Am I passing the correct matrices for my shader? openGL/C++

On page 89 of David Wolff - OpenGL 4.0 Shading Language Cookbook book, it suggests a way to set up up a Phong shader in the fragment stage. It lists some different matrices to pass via uniform, and I ...
1
vote
1answer
231 views

Swap buffers twice does not show the first scene

If you clear the color buffer and draw a triangle, you have nothing in the buffer that is shown in the screen and a triangle in the other buffer, so you have to swap buffers for showing the triangle. ...
8
votes
2answers
443 views

How to handle a parametric equation in raytracing?

After taking a look at the Mobius strip, I noticed its equation is really simple and tried to add it into my Raytracer. I tried a "naive" way by simply generating N...
6
votes
1answer
1k views

How can I generate mipmaps manually?

This question has an answer here: https://stackoverflow.com/questions/42596516/generating-mipmaps-manually It was a silly mistake. Sorry for the inconvenience. OpenGL is fairly difficult to learn. ...