Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong sign of component in matrix for orthographic projection #790

Closed
SDraw opened this issue Jul 17, 2018 · 1 comment
Closed

Wrong sign of component in matrix for orthographic projection #790

SDraw opened this issue Jul 17, 2018 · 1 comment
Assignees
Milestone

Comments

@SDraw
Copy link

SDraw commented Jul 17, 2018

Component [2,2] in matrix for orthographic projection has wrong sign resulting some problems.
Currently code of build function is:

template<typename T>
	GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> ortho(T left, T right, T bottom, T top)
	{
		mat<4, 4, T, defaultp> Result(static_cast<T>(1));
		Result[0][0] = static_cast<T>(2) / (right - left);
		Result[1][1] = static_cast<T>(2) / (top - bottom);
		Result[3][0] = - (right + left) / (right - left);
		Result[3][1] = - (top + bottom) / (top - bottom);
		return Result;
	}

And what code was in 0.9.8.4:

template <typename T>
	GLM_FUNC_QUALIFIER tmat4x4<T, defaultp> ortho
	(
		T left, T right,
		T bottom, T top
	)
	{
		tmat4x4<T, defaultp> Result(static_cast<T>(1));
		Result[0][0] = static_cast<T>(2) / (right - left);
		Result[1][1] = static_cast<T>(2) / (top - bottom);
		Result[2][2] = - static_cast<T>(1); // This line was forgotten in new releases
		Result[3][0] = - (right + left) / (right - left);
		Result[3][1] = - (top + bottom) / (top - bottom);
		return Result;
	}
@SDraw SDraw changed the title Wrong sign of component in orthogonal matrix Wrong sign of component in matrix for orthographic projection Jul 17, 2018
@Groovounet Groovounet added this to the GLM 0.9.9 milestone Jul 21, 2018
@Groovounet Groovounet self-assigned this Jul 21, 2018
Groovounet pushed a commit that referenced this issue Jul 21, 2018
@Groovounet
Copy link
Member

Woah, this is quite a major issue... :/
This issue is fixed in master branch for GLM 0.9.9.1 release.
Thanks for contributing,
Christophe

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants