Hot answers tagged

22 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: ...
user avatar
  • 1,029
12 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 ...
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 ...
user avatar
  • 2,037
5 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. ...
user avatar
  • 333
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 ...
user avatar
  • 5,882
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 &= \...
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 ...
user avatar
  • 1,575
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 ...
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 ...
user avatar
  • 6,450
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" ...
user avatar
  • 331
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. ...
user avatar
  • 3,556

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