🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Need help understanding orthographic projection for UI rendering

Started by
11 comments, last by EBZ 4 years, 1 month ago

There's no height/width ratio in the ortho matrix (pseudo-code, right handed, no depth version). it is simply a transform to a unit cube in the range -1/1 on all axes, oriented at the center:

mat4 ortho( left, right, bottom, top ) {
	mat4_t result = identity;
	result[0][0] = 2 / (right - left);
	result[1][1] = 2 / (top - bottom);
	result[2][2] = -1;
	result[3][0] = -(right + left) / (right - left);
	result[3][1] = -(top + bottom) / (top - bottom);
	return result;
}
Advertisement

Thank you all for your answers! Granted, they were great replies, I really appreciate it ?

This topic is closed to new replies.

Advertisement