mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 04:09:13 +00:00
LibGL: Transpose matrix in glGetDoublev
and glGetFloatv
We were returning row-major matrices when OpenGL clients are expecting column-major instead.
This commit is contained in:
parent
16255d161e
commit
08826d60ad
Notes:
sideshowbarker
2024-07-17 20:35:19 +09:00
Author: https://github.com/gmta
Commit: 08826d60ad
Pull-request: https://github.com/SerenityOS/serenity/pull/12017
Reviewed-by: https://github.com/bgianfo ✅
1 changed files with 8 additions and 5 deletions
|
@ -1941,12 +1941,15 @@ void SoftwareGLContext::get_floating_point(GLenum pname, T* params)
|
|||
{
|
||||
RETURN_WITH_ERROR_IF(m_in_draw_state, GL_INVALID_OPERATION);
|
||||
|
||||
// Handle special matrix cases first
|
||||
auto flatten_and_assign_matrix = [¶ms](const FloatMatrix4x4& matrix) {
|
||||
// Handle matrix retrieval first
|
||||
auto flatten_and_assign_matrix = [¶ms](FloatMatrix4x4 const& matrix) {
|
||||
auto elements = matrix.elements();
|
||||
for (size_t i = 0; i < 4; ++i)
|
||||
for (size_t j = 0; j < 4; ++j)
|
||||
params[i * 4 + j] = static_cast<T>(elements[i][j]);
|
||||
for (size_t i = 0; i < 4; ++i) {
|
||||
for (size_t j = 0; j < 4; ++j) {
|
||||
// Return transposed matrix since OpenGL defines them as column-major
|
||||
params[i * 4 + j] = static_cast<T>(elements[j][i]);
|
||||
}
|
||||
}
|
||||
};
|
||||
switch (pname) {
|
||||
case GL_MODELVIEW_MATRIX:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue