Questions tagged [c++]

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

Filter by
Sorted by
Tagged with
0 votes
0 answers
27 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 ...
1 vote
1 answer
41 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 ...
  • 31
0 votes
0 answers
15 views

DirectX 11 - 3D - VBO indexing per object's buffered attributes?

If I have a series of vertices positions: (x1, y1, z1) (x2, y2, z2) (x3, y3, z3) ...
1 vote
1 answer
31 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 ...
  • 13
1 vote
1 answer
37 views

Why does my uniform only update once?

I have a work thread function which updates the value of a float called scale: ...
  • 21
2 votes
1 answer
131 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....
  • 121
0 votes
0 answers
50 views

PBRT: why normalize ray's direction

In PBRT Chapter Camera Model, when describing Camera::GenerateRay(), it writes It is important that the direction component of the returned ray be normalized—many ...
  • 161
0 votes
0 answers
25 views

Mesh operations using lasso and uniform sampling

In mesh mixer, I can draw a lasso the mesh, let's say it's a spline. I want to 1. draw on selected area 2. uniformly sample the vertices inside that region, and extract their faces/vertices as a patch....
-2 votes
1 answer
191 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 ...
0 votes
0 answers
50 views

Screen space to texture space transformation

I've built a deferred renderer that is able to do deferred decals, now I want to be able to bake that into textures. I have a texture (so screen space) that holds a deferred screen space decal that ...
1 vote
0 answers
47 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 ...
0 votes
1 answer
131 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 ...
0 votes
0 answers
76 views

show different texture in the rectangular block in a grid

I am trying to do a probabilistic simulation on a 20X20 grid. The simulation will generate numbers say 2, 3 or 4 and grid location say [5][4]. I will convert the ...
1 vote
0 answers
69 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)...
  • 121
0 votes
1 answer
139 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 ...
  • 103
0 votes
0 answers
32 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:...
0 votes
0 answers
60 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 ...
-1 votes
1 answer
357 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 ...
  • 2,463
0 votes
1 answer
421 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 ...
0 votes
1 answer
79 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? ...
  • 2,463
1 vote
2 answers
113 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 ...
  • 2,463
1 vote
1 answer
90 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 ...
  • 1,594
1 vote
1 answer
205 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 ...
0 votes
0 answers
41 views

Improving dual contouring convergence

I have my own implementation of dual contouring. Right now I am getting the following output: This is decent, but I am trying to get a better result (i.e. try to reduce the low level voxel noise as ...
  • 1,594
0 votes
0 answers
72 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: ...
  • 1,594
1 vote
1 answer
77 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? ...
0 votes
0 answers
66 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 ...
  • 1
0 votes
0 answers
53 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: ...
  • 115
-1 votes
1 answer
103 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 ...
1 vote
1 answer
92 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 ...
  • 57
1 vote
1 answer
694 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 "...
  • 11
0 votes
1 answer
120 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 ...
3 votes
1 answer
195 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 ...
1 vote
2 answers
324 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 ...
0 votes
1 answer
403 views

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

...
1 vote
1 answer
165 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 ...
  • 111
2 votes
1 answer
168 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 ...
  • 21
1 vote
1 answer
382 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 ...
0 votes
1 answer
341 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 ...
0 votes
0 answers
240 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 ...
  • 1
1 vote
1 answer
2k 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, ...
0 votes
0 answers
44 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 ...
  • 241
0 votes
1 answer
59 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
81 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 ...
0 votes
0 answers
408 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 ...
0 votes
1 answer
140 views

How to link Intel Open Image Denoise in Qt Creator and use it to denoise noisy Monte Carlo path tracing renderings?

I've been trying to link my the Intel Open Image Denoise libraries for about a week and still have no luck as of now. This could partly be because I am also novice in C++ stuff. So I need some help in ...
  • 241
0 votes
1 answer
436 views

Spline interpolation library in cpp

Have been searching a lot for a good spline interpolation library in cpp, came across one, which is the famous Eigen library , having the unsupported counterpart for spline fitting.<Here>. I ...
1 vote
1 answer
684 views

Vulkan clear color is wrong

I am following https://vulkan-tutorial.com/Introduction to get myself familiar with the Vulkan API. I have gotten to the point where my application is able to draw a triangle. But for some reason the ...
  • 111
1 vote
2 answers
364 views

Efficiently transferring only needed parts of the vertex data to the GPU (C++/OpenGL)

I have a situation, where I have an array of vertices on the CPU side, for which, besides rendering-relevant data, like their position, I have a lot of other data at each vertex. All vertex data is ...
user avatar
-1 votes
1 answer
216 views

Render fragments with uvs outside (0,1) range as transparent

I'm rendering an image onto a mesh. And I need to render fragments with uv coordinates that fall outside (0,1) range with full transparency. In the code below I'm specifying a border color with zero ...

1
2 3 4 5