Jump to content

  • Log In with Google      Sign In   
  • Create Account

StanLee

Member Since 16 Mar 2012
Offline Last Active Today, 09:20 AM

Posts I've Made

In Topic: Atomic Add for Float Type

Yesterday, 04:52 PM

I understand. =) I will stick to the NV extension for now, but try this out later. Thanks! =)


In Topic: Atomic Add for Float Type

Yesterday, 01:55 PM

Hmmm, so only NV has atomics on floats. Maybe I'll stick to only NV support for now.

 

By using integeres, do you mean converting them to integer values before saving them in the buffer? 


In Topic: Faces of cube map not fitting together

09 November 2015 - 07:11 AM

Thanks Hodgman! That was exactly the problem.smile.png  After passing the fov in radians everything worked perfectly fine. I somewhere defined the symbol GLM_FORCED_RADIANS and from then on the function took the angle in radians and not in degrees. rolleyes.gif


In Topic: Faces of cube map not fitting together

09 November 2015 - 02:47 AM

I have tried out your suggestion but the problem remains. I have even fixed the camera position to the origin:

auto viewMatrix = glm::lookAt(glm::vec3(0), glm::vec3(viewDir + glm::vec3(0)), up);
cubeMapContext._V = cubeMapContext._MV = viewMatrix;
cubeMapContext._MVP = cubeMapContext._P * cubeMapContext._MV;
_sceneGraph->renderSubtree(cubeMapContext);

What I have also tried out is loading a cube map to see if my cube map rendering works correctly. And indeed it is, when loading a cube map everything fits perfectly together. Only when I generate the cube map myself as described above the faces don't fit together. Here is my shader code for the cube map rendering:

#version 430

layout(location=0) in vec3 vertex;

out vec3 ex_uv;

uniform mat4 mvp;

void main(){
  ex_uv = vertex;
  gl_Position = mvp * vec4(vertex, 1.f);
}
#version 430

in vec3 ex_uv;

out vec4 color;

uniform samplerCube cubeMap;

void main(){
  color = texture(cubeMap, ex_uv);
}

And this is the client code initiating the rendering of the cube map:

void render(const SceneContext& context, const glm::mat4x4& tmat){
  glEnable(GL_TEXTURE_CUBE_MAP_SEAMLESS);
  _shader->bind(); //Calls: glUseProgram(shaderProgramID);
  _shader->loadMatrix4("mvp", glm::value_ptr(context._MVP)); // int _uniID = glGetUniformLocation(shaderProgramID, "mvp"); 
                                                             // glUniformMatrix4fv(_uniID, 1, GL_FALSE, valuePtr);
  _shader->loadUniform("cubeMap", _cubeMap->bind()); // glUniform1i(uniID, x); //uniID = _cubeMap->bind()
  _unitCube->bindVertices(0); // glEnableVertexAttribArray(location); //location = 0
                              // glBindBuffer(GL_ARRAY_BUFFER, _vBufferID);
                              // glVertexAttribPointer(location, 3, GL_FLOAT, GL_FALSE, 0, 0);
                              // glBindBuffer(GL_ARRAY_BUFFER, 0);
  _unitCube->render(); // glDrawArrays(GL_TRIANGLES, 0, _vertices.size());
  _unitCube->unbind(); // glDisableVertexAttribArray(0);
  _shader->unbind(); // glUseProgram(0);
  glDisable(GL_TEXTURE_CUBE_MAP_SEAMLESS);
}

Is there maybe conceptually something wrong? I only want to create an environment map/panoramic view of my sponza scene. Isn't it possible to do it the way I do?

Regards,

Stan


In Topic: 3D Texture upload fails

09 May 2015 - 01:36 AM

I checked the data again and I saw that they only use 12 bits, i.e. the original data values are in a range from 0 - 4095. That means my values are clamped to [0, 4095/65535 = 0.062485].

That makes sense, of course! Thank you guys! smile.png


PARTNERS