Questions tagged [c++]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1
vote
1answer
178 views

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

This is what I'm doing: vertex shader: ...
1
vote
1answer
314 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
277 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. ...
7
votes
2answers
507 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
2k 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. ...
5
votes
1answer
266 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
907 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
103 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
542 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
606 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
2k 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 ...
8
votes
2answers
661 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
724 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
1k views

How to get the GLFW_CONTEXT_VERSION_MAJOR value?

This code snippet: ...
10
votes
1answer
2k 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 ...
3
votes
3answers
215 views

Is there a difference between window and screen in computer graphics?

I've been reading some code which setups a ray tracer and I've realized I've a doubt regarding what's a screen and what's a window in this context. Here's the relevant code using Qt: ...
5
votes
1answer
2k views

Modern way of light sources in OpenGL?

In older versions of OpenGL there were things like: glLight(...) gl_LightSourceParameters The modern way of doing lighting is passing light source parameters manually to the shader in vao-s? Or ...
5
votes
1answer
183 views

How to rasterize a line when the background color is not always white?

I've to rasterize a line taking into account not only the background color of the screen, which is white, but also the color of other objects in the scene. In my case, I've just another object, a ...
1
vote
3answers
324 views

How are the colors for each pixel from a Ray Tracer stored in an Image?

I have begun learning how to create a Ray Tracer and 1 thing I am confused about is how the pixel color from a Ray Tracer is stored into an image. Do we use SetPixel...
4
votes
1answer
228 views

Material Layering

So after reading this Unreal Engine 4 Documentation page: https://docs.unrealengine.com/latest/INT/Engine/Rendering/Materials/LayeredMaterials/ (Which describes how to use material layering in UE4) ...
4
votes
1answer
295 views

Flexible Vertex Format Constants in Direct3D 11

How do you migrate Flexible Vertex Format Constants (or FVF codes) from DirectX 9 to Direct3D 11? Old code: ...
5
votes
2answers
116 views

Problem with Basic Diffuse Lighting

So recently I have been learning how to implement Diffuse Lighting in DirectX and I have done so with the following code: ...
3
votes
1answer
295 views

Creating a gently moving 2D fog effect

I am trying to create a fog-like effect, similar to that found using perlin noise. I know where I can find information about that effect, but it's harder for me to tell if it's an efficient route for ...
1
vote
1answer
402 views

How to use Shaders with vertex & index buffers?

I'm trying to render a randomly generated terrain with vertex buffers and OpenGL. I want to use a shader to color the terrain, but it seemms like my shader isn't used. I have used shaders before when ...
7
votes
1answer
300 views

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

I'm attempting to perform an intersection test using ray casting (not sure if correct term so please forgive me if not) and am outputting the intersections as a point cloud, and the point cloud shows ...
3
votes
1answer
842 views

Compute shader not updating buffer, or vertex buffer unable to read the updates

I'm learning OpenGL compute shaders and following this guy's code, and I have stuff drawing, but not updating. The particles are spread out in their starting positions, but they stay there. ...
7
votes
1answer
159 views

Proper architecture for rendering history of streamed data (points)

Overview My program receives some data points (0-400 per sec). ...
4
votes
1answer
215 views

Can't make blending work

I have a 3 dimensional dataset where each value of the dataset is normalized to [0, 1]. I want to visualize this dataset by using texture, and blending. However, it ...
4
votes
1answer
111 views

Uniform not set, despite valid location

I try to write a simple triangle mesh renderer with OpenGL. ...
5
votes
2answers
448 views

How to check which API's are available on a given machine?

I'm building an engine, which has Vulkan for its primary rendering engine. But to have at least some backwards compatibility with devices that don't have drivers for it (mainly mobile) I want to ...
6
votes
1answer
430 views

Perspective correct interpolation of normal values

I'm currently writing a software rasterizer and I'm at the point where I can draw arbitrary triangles with vertex colors and perspective correct texture mapping. I do point and directional lighting by ...
6
votes
1answer
500 views

Open GL Shader Storage Buffer Objects to replace Vertex Attributes

At first: I already posted this on the stackoverflow community. I'm new and didn't know about this community here. I apologize. I basically got the same question as the guy who asked here: https://...
7
votes
1answer
802 views

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

I am trying to implement my own Gradient Domain Path Tracer by following the code of this guy who already implemented it: https://gist.github.com/BachiLi/4f5c6e5a4fef5773dab1 I already managed to ...
5
votes
1answer
821 views

Role of PDF of Uniform Random Sampling in a path tracer

I am trying to implement my own path tracer but before arriving to the question I want to give you a short overview: In the implementation of the rendering equation I use some particular technique in ...
3
votes
1answer
282 views

Generate this kind of 2d burst or pulse algorithm?

I'm currently trying to develop a game using Cocos2d-x using C++. I really need to generate this burst or (donut-shaped) pulse. I'm having a difficult time how to generate such shape. At first, I was ...
3
votes
0answers
816 views

Represent vector with arrow

Another code review question. I am trying to draw an arrow to represent a vector. I have started with an unit arrow with vertices defined as follows: ...
3
votes
1answer
447 views

Ray-tracing the Cornell Box results in really inconsistent image

So I have a vector of glm::vec3 containing the triangles for the classic Cornell Box called triangles. The Draw method casts a ray for each pixel on the screen and ...
4
votes
1answer
593 views

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

I am trying to implement for research purposes a path tracer, but so far but results are not so good and I will explain you why. The general idea before getting to the code: I am working on paths ...
4
votes
2answers
549 views

Path tracer not rendering shadows

I am trying to implement for research purposes a gradient-domain path tracer. In order to achieve this step I first need a working Path tracer. I have been creating one so far but results are wrong ...
1
vote
1answer
709 views

OpenGL C++ Camera Rotation Problem

Currently for a university assignment I have been given a 3D rendering engine, capable of rendering a 3D world. One task is to create a first person camera for it (I know with OpenGL you don't have a ...
1
vote
1answer
1k views

Creating vector shapes using only C++ [closed]

I've been researching for quite a while and I couldn't find any explanation or at least a how to create a vector graphic application (specifically in windows) where I can create a 3D vector shape, say ...
1
vote
0answers
198 views

Free 3D Scene Simulation Framework [closed]

I want to visualize a scene with simple shapes (e.g. boxes, pyramides, etc.) and I am looking for a tool or framework in C/C++ to do this. Focus of the application is to parameterize the relative ...
14
votes
1answer
7k views

Get vector length with GLM

I am quite confused over how GLM library is behaving or I am using it improperly. glm::vec2 testVec(6,-4); float len = testVec.length(); I get the value ...
6
votes
2answers
970 views

OpenGL with SFML, create an n-pointed star?

Completely stuck on how to do this. Yes, it is a homework problem, but its the first we've had in the class so not too familiar with graphics. Also, seeing as its homework, please don't just give the ...
5
votes
1answer
607 views

Type conversion to GL-types

If I have a std::vector<Foo> and want to store its size in a GLuint, my compiler gives a warning that there is possible ...
1
vote
0answers
99 views

Selecting pixels within a circle having a decimal (non integer) radius

I want to select a pixel within a circle of a certain radius. But the radius is expressed in a decimal form (0.12). What does it mean to have a radius equal to 0.12? And concretely how to pick a pixel ...
5
votes
1answer
160 views

How should I generate the view position for a light at infinity when creating depth maps?

I'm working on implementing Bruneton's cloud rendering paper, which requires one to render a pair of depth maps, similar to how shadow mapping works. In this case, my light source is the sun (or ...
4
votes
1answer
171 views

How to set the GLFW OpenGL target?

I'm programming on a Mac and I'm learning OpenGL in the library GLFW. My problem is that my Mac supports OpenGL up to version 4.1, but when I try to compile the shaders with ...
4
votes
1answer
525 views

Angle between two points in Cartesian coordinate system C++

I'm trying to rotate a rectangle so that it faces another rectangle in a spiral. Im using the Bullet pyhics library and freeglut for the 3d application, for anyone interested https://github.com/...
8
votes
2answers
4k views

Archimedean spiral in C++

Im trying to plot the x and y positions of an Archimedean spiral in C++. So far I've been trying something like this, but no luck: ...