Hot answers tagged

23 votes

Get vector length with GLM

Sorry folks for posting such a trivial issue! The issue is solved. I was using the wrong function. Here goes the correct one: ...
sajis997's user avatar
  • 1,229
11 votes

Multiple viewports with modern OpenGL?

If you are writing your own Vertex/Fragment Shader there is another additional possibility to do this. It is much more complicated but might be useful for you and/or others. Additionally it speeds up ...
Christian_B's user avatar
9 votes
Accepted

Multiple viewports with modern OpenGL?

Rendering to different viewports (parts) of the same screen can be done as follows: For example splitting screen into four parts and rendering the same scene four times to each corner with different ...
mdkdy's user avatar
  • 2,119
4 votes

Multiple viewports with modern OpenGL?

This is a copy of @narthex's answer, except with only the viewports since that is all you need. I'm not sure why the frame buffer / blend stuff is included in his answer. ...
default's user avatar
  • 323
4 votes
Accepted

Ray-tracing the Cornell Box results in really inconsistent image

Two symptoms There appear to be two problems with the image. The background is showing through along the line between adjacent triangles. The colour displayed is not always from the closest ...
trichoplax is on Codidact now's user avatar
4 votes
Accepted

Three quaternions interpolation with barycentric coordinates

Defining the problem The weighted arithmetic mean $\mu$, of a set of vectors, minimizes squared L2 norm of the error ($v_i$) to all elements of the set. $$ \begin{equation} \begin{split} v_i &= \...
Jacob Panikulam's user avatar
4 votes
Accepted

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

It seems to me, to be that your different positions and normals are not in the same space. Having them in the same space is important because else it might think the normal is pointing left while it ...
bram0101's user avatar
  • 1,595
3 votes
Accepted

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

I wasn't placing the lightposition into view space before passing it in. vec4 LightPosition_view=view*LightPosition; //put lp into view space with the rest When ...
Charlie's user avatar
  • 203
2 votes

understanding glm::perspective vs glm::ortho

I don't understand why, if I make the first argument to glm::lookAt be glm::vec3(0.0f, 0.0f, 2.0f), I see nothing. It's because of the up vector. If you think about the look-at operation, you specify ...
Dan Hulme's user avatar
  • 6,700
2 votes

Multiple viewports with modern OpenGL?

These are all good answers, and yet there is another way: (Isn't there always?) Due to the growing popularity of virtual reality, the folks at OculusVR have developed a trio of "Multiview" ...
Jack's user avatar
  • 341
1 vote
Accepted

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

I think you have the wrong order of matrix multiplication. ...
Kevin Reid's user avatar
1 vote

Screen to World coordinates glm::unProject

You can calculate the world position of the pixel on near plane quite easily by first defining Normalized Device Coordinates (NDC) for the point and then transforming the NDC back to the world space. ...
JarkkoL's user avatar
  • 3,616

Only top scored, non community-wiki answers of a minimum length are eligible