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 [c++]

The tag has no usage guidance.

1
vote
0answers
47 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
31 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
68 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 ...
0
votes
0answers
31 views

Dragging an object on a plane with respect to the camera

this is a long description but I hope the solution is simple: I have a 3D pointCloud with a vtk box (displayed at 0,0,0) and I want to drag the box on the XY plane with my mouse cursor (Zero movement ...
1
vote
1answer
59 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
42 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
48 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
104 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
35 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
0answers
67 views

How to solve the equation x = Mx + b using markov chains?

I am unable to find the mistake in my code. I've used the following input: M = [0.5,0.0, 0.0,0.25] b = [1.0,1.0] The answer for x should be ...
0
votes
1answer
105 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
138 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
115 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
79 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 ...
4
votes
1answer
206 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
57 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
141 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
374 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
140 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
355 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
260 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
120 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
339 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
226 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
98 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
101 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
86 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
299 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
419 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
253 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
144 views

Strange behaviour in vertex shader with divisions

This is the vertex shader code: ...
1
vote
2answers
240 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
438 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
101 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
154 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
135 views

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

This is what I'm doing: vertex shader: ...
1
vote
1answer
238 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
139 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
371 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
860 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. ...
6
votes
1answer
208 views

Artifacts when gamma correcting

Doing post-process gamma correction is showing texture artifacts, here is a small example on a skybox: The first image is gamma correcting on the skybox shader and seems correct, the lower is doing ...
1
vote
2answers
604 views

Can you batch vertex data and still sort by depth?

In order to reduce the amount of draw calls per frame I've decided to use a vertex array object to store vertex data from several different meshes. More precisely, I use the vao to the define the ...
1
vote
1answer
94 views

Does programs like After effects and Unity engine use graphics library to render custom guis?

I was always interested how programs like: Unity, AE, godot engine and other render their custom guis. So my question is, do they use graphics library to render custom guis or something else. If they ...
1
vote
1answer
358 views

How can I send custom bitmap to frame buffer?

I was trying to make a CPU-based ray tracer but I know after all the calculation I will end up with an array of pixels. I don't know how to paint it on the screen. What are the various ways to do that?...
1
vote
1answer
267 views

Point respect to plane

How do I classify a point with respect to a plane, returning whether the point is inside, outside, or coplanar? I know that if a point is on the plane the Dot product + the plane distance would equal ...
2
votes
2answers
1k views

Can one VAO store multiple calls to glVertexAttribPointer?

If no, Should I create a new VAO for every VBO that has its own vertex attribute configurations? Could you please give me a snippet code example that shows how to use one VAO for multiple VBOs? All ...
7
votes
1answer
476 views

What is a good approach for handling uniforms in modern OpenGL?

I'm creating a renderer using modern OpenGL (3.1 and up) and now I'm trying to create an efficient but flexible way of handling uniforms. I've been reading up on uniform buffer objects and on what a '...
3
votes
2answers
419 views

How to watch image being ray traced?

In my ray tracer, I render my images out to a .PPM file and then view it in photoshop. To make things easier and faster I want my ray tracer to open up another window and show the image being rendered ...
4
votes
1answer
679 views

How to get the GLFW_CONTEXT_VERSION_MAJOR value?

This code snippet: ...
7
votes
1answer
850 views

What does “makeContextCurrent” do exactly?

I am pretty confused about that function. GLFW Context reference says as follow: This function makes the OpenGL or OpenGL ES context of the specified window current on the calling thread. A ...