Fixed the viewport expressed in int not getting to the shader, needed to be convert to float

This commit is contained in:
samcake 2015-07-03 12:12:54 -07:00
parent 84b70fbaca
commit 4019a216d4
3 changed files with 3 additions and 3 deletions

View file

@ -42,7 +42,7 @@ public:
Mat4 _projectionViewUntranslated;
Mat4 _projection;
Mat4 _projectionInverse;
Vec4i _viewport;
Vec4 _viewport; // Public value is int but float in the shader to stay in floats for all the transform computations.
};
template< typename T >

View file

@ -86,7 +86,7 @@ void GLBackend::updateTransform() {
glGetIntegerv(GL_MATRIX_MODE, &originalMatrixMode);
// Check all the dirty flags and update the state accordingly
if (_transform._invalidViewport) {
_transform._transformCamera._viewport = _transform._viewport;
_transform._transformCamera._viewport = glm::vec4(_transform._viewport);
// Where we assign the GL viewport
glViewport(_transform._viewport.x, _transform._viewport.y, _transform._viewport.z, _transform._viewport.w);

View file

@ -51,7 +51,7 @@ void Skybox::render(gpu::Batch& batch, const ViewFrustum& viewFrustum, const Sky
static gpu::BufferPointer theBuffer;
static gpu::Stream::FormatPointer theFormat;
static gpu::BufferPointer theConstants;
int SKYBOX_CONSTANTS_SLOT = 0; // need to be defined by the compilation of the shader
static int SKYBOX_CONSTANTS_SLOT = 0; // need to be defined by the compilation of the shader
if (!thePipeline) {
auto skyVS = gpu::ShaderPointer(gpu::Shader::createVertex(std::string(Skybox_vert)));
auto skyFS = gpu::ShaderPointer(gpu::Shader::createPixel(std::string(Skybox_frag)));