Skip to main content
Share Your Experience: Take the 2024 Developer Survey

Questions tagged [c++]

General-purpose programming language used widely in game development and CPU-intensive tasks.

Filter by
Sorted by
Tagged with
2 votes
0 answers
19 views

glMultiDrawArraysIndirect is not drawing anything

This code works: ...
Mason Hawver's user avatar
0 votes
0 answers
32 views

Environment map: inverting (phi, theta) to (x,y,z) mapping

I'm currently working on a ray tracer in C++ as an assignment. This ray tracer needs to take into account environment maps, which I also need to implement a part of. From my understanding of an ...
Derek Kwon's user avatar
0 votes
1 answer
83 views

Forward path tracing versus backward path tracing. How may I achieve realistic shading in forward path tracing?

I have a forward path tracer. Essentially, it looks flat: This is the backward path tracer in comparison: My question is: How do I get pseudorandom lighting like with the backward path tracer, when ...
shawn_halayka's user avatar
0 votes
1 answer
66 views

Vulkan memcpy from image works, but memcpy to image not working

Using Vulkan, I am reading from an image to a vector of unsigned char. It works great. ...
shawn_halayka's user avatar
0 votes
0 answers
67 views

What performance to expect from an optimised pathtracer?

I am currently writing a fairly basic pathtracer as a compute shader in C++/CUDA, which has been running on a GTX 1080, and I have noticed that when logging some statistics, I get around ~1 billion ...
Jack Freeth's user avatar
0 votes
0 answers
128 views

Path tracer -- How to debug erroneous behaviour?

Edit: I've pinpointed the problem. If I change: local_colour *= (rayPayload.color.r*mask.r + rayPayload.color.g*mask.g + rayPayload.color.b*mask.b); into ...
shawn_halayka's user avatar
2 votes
1 answer
57 views

What is a smart way to fill in the 'next' pointer of a opposite half-edge of a boundary?

I was reading this question regarding half edges from 3 years ago and the selected answer seemed pretty smart to me. However, while actually implementing it I'm confused at the part where I have to ...
ThisAccountIsForGameDev's user avatar
0 votes
0 answers
222 views

Vulkan backward-only path tracer with caustics

TL;DR -- who has discovered, in the past, a backward-only path tracer that generates caustics not needing extra convergence of any kind? I'm collecting similar algorithms, in order to fully understand ...
shawn_halayka's user avatar
1 vote
1 answer
97 views

Vulkan Syscalls

I'm working on educating myself more about computer graphics, and the more I learn and play with the technology, the more I get frustrated by the dependencies on C++ (even though I know why it exists)....
Sienna's user avatar
  • 111
-1 votes
1 answer
379 views

How to send data from a C# application to a C++ DLL?

I have a C++ graphics engine and I would like to build an editor for it in C#. I want to be able to send data from the editor to the engine such as what tool is being used and any user-defined ...
Arjan Singh's user avatar
  • 2,511
0 votes
1 answer
106 views

Triangle Rasterization Shaking Issues

I am making a Software renderer, and I noticed that there is a screen shaking like effect happening. shown in the first video: I tried doing filling without clipping against the small square, and the ...
Serilena's user avatar
0 votes
0 answers
67 views

How would you represent a mesh with tris and quads?

My understanding is that, while subdivision algorithms like Catmull-Clark can work for any polygonal mesh (including triangles) it's preferable to start with a quad mesh. Currently my rendering engine ...
Chris Gnam's user avatar
1 vote
1 answer
87 views

convert right handed matrix into left handed forward/up/right vectors

I have an openGL style matrix (column major, right handed ) that needs to be converted into two vectors (forward and up) I've managed to find, in a weird way, a solution that matches the the ...
ytrox's user avatar
  • 31
1 vote
1 answer
187 views

Converting points, vectors, normals between world and object space for a ray tracer gives weird results

I'm writing a ray tracer but having trouble converting rays and normals between world space and object space. I am creating a Ray, then transforming it with transformation matrices, calculating ...
Cedric's user avatar
  • 13
1 vote
1 answer
45 views

Why does my uniform only update once?

I have a work thread function which updates the value of a float called scale: ...
lewis's user avatar
  • 21
3 votes
1 answer
2k views

OpenGL and GLUT in x64 on Windows (Visual C++ 2019)

I'm just starting to self-learn OpenGL. I have OpenGL A Primer (2nd edition) by Edward Angel and I found this useful site for setting up OpenGL with Visual Studio 2019 on Windows: https://www....
Dave's user avatar
  • 131
-1 votes
1 answer
566 views

Is a line drawn using vectors, triangles or polygons within OpenGL? [closed]

Trying to understand how OpenGL generates what is seen as images & graphics and these questions come up. Are 3D lines (which should be drawn using vectors) drawn using triangles or polygons? Or ...
AncientTides's user avatar
1 vote
0 answers
76 views

parallelizing a software rasterizer algorithm using opencl

I've written a small software rasterizer using OpenCL and would like to optimize and parallelize it more, currently I'm scanning the whole screen and see if the triangle overlaps with the pixels.. I ...
Andre Ahmed's user avatar
0 votes
1 answer
207 views

Computing vertex normals in mesh triangle soup

I am using c++. I have to find vertex normal in mesh. The mesh is triangle soup. The winding order is inconsistent. I know that it is the sum of all faces normals arround the vertex. But I don't know ...
Vladimir Yanakiev's user avatar
1 vote
0 answers
79 views

Perlin noise is mysteriously ignored when the pattern is rotated 45 degrees

I am creating different coloring patterns for my CPU raytracer, such as checker, gradient, ring, stripe pattern etc. The problems started when I tried to create a perturbation pattern (of a subpattern)...
Ave Milia's user avatar
  • 121
0 votes
1 answer
243 views

Split a string of line segments into several other line segments

I have written a code to extend "n" points, constituting "n-1" lines ,to constitute more lines so you can map "m" data to "m" lines with m > n-1. This is the ...
Aminos's user avatar
  • 103
0 votes
0 answers
36 views

How do I make "attribute vec0.5" in GLSL. Sorry if it confuses

Is it possible, in OpenGL (specifically in WebGL), to use a single value from buffer for multiple shader iterations? Like to put the same element from buffer into shader attribute multiple times? Like:...
Forprix's user avatar
0 votes
0 answers
81 views

How to make sure that triangles share edges (also not overlap each other) when rendering a quadrilateral?

Here is my simple scanline-based triangle rasterizer using pure integer arithmetic. I adapted the code from this Stack Overflow answer The below code attempts to render a coloured quadrilateral by ...
Jimmy Yang's user avatar
-1 votes
1 answer
948 views

Hosting OpenGL C++ Window in C# WPF

I am following this tutorial on how to host Win32 OpenGL windows in WPF. There is also a Microsoft walkthrough on how to Host a Win32 Control in WPF that is useful aswell. The original project is from ...
Arjan Singh's user avatar
  • 2,511
0 votes
1 answer
700 views

How to rotate and move group of objects in OpenGL?

What do I have now? I have a cube consisting of 6 planes. All these planes I generate in XY coordinates and then place them by matrix transformations. I need to rotate my cube along the global axis ...
Андрей Петров's user avatar
0 votes
1 answer
112 views

How to give C++ GLUT project an Editor/UI?

I want to render my OpenGL GLUT project to a window/control in C# WPF. I have read articles online from Microsoft on how to do it but I am very confused. Does anyone have any experience with this? ...
Arjan Singh's user avatar
  • 2,511
1 vote
2 answers
161 views

Why is there a straight line between my bezier paths?

I have created a bezier curve tool and each time I draw a bezier curve segment I get a straight line between each mouse click. I don't understand why this is happening and was wondering if someone ...
Arjan Singh's user avatar
  • 2,511
1 vote
1 answer
158 views

Defining the proper sdf for this structure

I am making a procedural sdf (just a bunch of cubes) based of an image. The idea is very simple. We have a stencil image: Each texel in the image corresponds to a 3D cube. So to ray trace what I am ...
Makogan's user avatar
  • 1,726
1 vote
1 answer
338 views

3D head mesh morphing from one mesh into another using coding

I have 2 3D head images and want to morph one into the other (animation) without using blender etc. I want to do it using coding preferably using C++, C# or python(libraries are ok). I have done 2D ...
suleman butt's user avatar
0 votes
0 answers
97 views

How to delete a face using open mesh?

Pretty much the title I am trying to delete a few faces of a mesh using open mesh, like this: ...
Makogan's user avatar
  • 1,726
0 votes
1 answer
118 views

Question about using glVertexAttribArray

After defining an attribute pointer, why can't I just reuse it? I have a VAO bound so shouldn't it just accept the AttributePointer I defined with the last VAO? ...
R34P3R76's user avatar
0 votes
0 answers
71 views

ray triangle mesh intersection triangles inverted

I'm trying to render a dodecahedron triangle mesh and the triangles seem flipped or mirrored somehow. The first picture is what I should be getting, the second picture is what I'm getting and the last ...
Dodeca's user avatar
  • 1
0 votes
0 answers
78 views

16 bit SNORM format not correctly storing Z component?

I generate a normal GBuffer in my engine, and I store it using a R16G16B16A16_SNORM format like this: ...
H3XXX's user avatar
  • 115
0 votes
1 answer
156 views

Passing non-interleaved data to glBufferStorage without using glBufferSubData

I would like to use glBufferStorage to load data once into the vertex buffer. However sometimes I want to pass non-interleaved data from separate arrays like shown ...
Lenny White's user avatar
1 vote
1 answer
96 views

Stripping unnecessary data from C++ data structures before sending to GPU

I've recently been working on a particle system in my renderer and I've encountered a situation where my particle class on the C++ side has data I need to maintain my particle on that end, but that I ...
JHall's user avatar
  • 57
2 votes
1 answer
2k views

What is the Viewport?

Can someone please explain to me what the Viewport is. I've read the OpenGL wiki and doc.gl but they give me a definition that I don't understand at all. The definition they gave me is "...
Nathan's user avatar
  • 21
0 votes
1 answer
165 views

Understanding how gradient noise generation works

When attempting to compute the gradient noise derivatives I've seen the use of a function named "hash" and I don't understand its purpose (nor why they have commented that it should be ...
Frank Weslien's user avatar
3 votes
1 answer
269 views

Problem when performing IFFT for Tessendorf's ocean waves

I am implementing Jerry Tessendorf's ocean waves as described in his paper in c++ and OpenGL. I implemented two compute shaders, one for the h_tilde_0 and its conjugate, and one for the frequency ...
Facundo Pedro Astiz Meyer's user avatar
1 vote
2 answers
702 views

Reducing Cascaded Shadow Mapping Artifacts

I've been trying to get my cascaded shadow maps looking right for a while. I managed to fix the shimmering and most of the quantization artifacts, but for some reason the shadows still look really ...
Josh Lakin's user avatar
0 votes
1 answer
566 views

Can I write histogram equalization, blurring, sharpening grayscale image etc.. as shader programs with openGL?

...
Meganathan's user avatar
1 vote
1 answer
257 views

How to use trackball for rotating an camera matrix in eye frame

I have a QOpenGLWidget where I use camera transformation matrix(4,4), FOV and vectors Position(4), Up(4), Forward(4). I also have an ArcBall which I can use. I managed to implement zoom and pan by ...
nocturne's user avatar
  • 111
2 votes
1 answer
268 views

Environment map importance sampling (beginner)

beginner here. I am implementing importance sampling for environment maps in Scotty3D, a CMU CS project (but I am not a student). The task can be found here I have a problem with the sample's pdf, it ...
Pachiko's user avatar
  • 21
1 vote
1 answer
607 views

Half-Edge Data Structure with holes

I am trying to implement next/prev of edges in half-edge data structure. But I ran into this question. If there are two holes with a common vertex, will the closed loop of the edges run as in the ...
JoungCPPser's user avatar
0 votes
1 answer
460 views

My OpenGL program is not drawing filled polygons

I'm trying to learn OpenGL in c++ (I used it in Java) but I have a problem, I make a triangle, but it doesn't draw on GL_FILL and in GL_LINE it just draw a line, I can't find my mistake, I guess my ...
Yair Camborda Morocho's user avatar
0 votes
0 answers
378 views

Weird PIX behavior with DXC

Recently I've switched from FXC to DXC to compile shader model 6.0. It compiles well without errors (and runs well) but I can't debug shaders because on my netbook PIX says "failed to load PDB ...
Flone's user avatar
  • 1
1 vote
1 answer
4k views

Understanding fragment shader coordinate system

I'm trying to create an infinitely panable grid using fragment shaders (C++/OpenGL/GLSL), and I'm having a bit of difficulty understanding the coordinate system. This is my fragment shader code, ...
Andrew Woo's user avatar
0 votes
0 answers
54 views

Under what conditions does a mesh operation cause the mesh become non-manifold and how to avoid it?

I'm implementing some mesh operations (e.g. edge collapse, edge split, edge flip etc) and need to ensure applying such operations does not cause the mesh to become non-manifold. However, I'm not sure ...
Amir's user avatar
  • 241
0 votes
1 answer
62 views

Buggy behavior when applying specular reflection

I'm very new to computer graphics and trying to implement a raytracer based on the book Computer Graphics from Scratch. When I tried to add specular reflection, I don't get the output that look like ...
user avatar
0 votes
1 answer
118 views

(Ray tracing) Trouble converting to screen coordinates, objects being stretched

I followed along with Ray Tracing in One Weekend and managed to get the final output but I wanted to understand more about creating a camera and "painting" the screen since he didn't go over ...
Tippitytopkek's user avatar
0 votes
0 answers
903 views

Using multiple textures in a shader

Background: I am extracting the textures for a model with Assimp and sampling those textures in the fragment shader. I have multiple uniform sampler2D textureN ...
MasterReDWinD's user avatar

1
2 3 4 5