mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 23:27:35 +00:00
LibGL: Impement glLoadMatrixf and underlying function
This commit is contained in:
parent
ea0df0b5da
commit
f07a7f7b94
5 changed files with 32 additions and 0 deletions
|
@ -79,6 +79,7 @@ GLAPI void glFrustum(GLdouble left, GLdouble right, GLdouble bottom, GLdouble to
|
||||||
GLAPI GLenum glGetError();
|
GLAPI GLenum glGetError();
|
||||||
GLAPI GLubyte* glGetString(GLenum name);
|
GLAPI GLubyte* glGetString(GLenum name);
|
||||||
GLAPI void glLoadIdentity();
|
GLAPI void glLoadIdentity();
|
||||||
|
GLAPI void glLoadMatrixf(const GLfloat* matrix);
|
||||||
GLAPI void glMatrixMode(GLenum mode);
|
GLAPI void glMatrixMode(GLenum mode);
|
||||||
GLAPI void glPushMatrix();
|
GLAPI void glPushMatrix();
|
||||||
GLAPI void glPopMatrix();
|
GLAPI void glPopMatrix();
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
|
|
||||||
#include "GL/gl.h"
|
#include "GL/gl.h"
|
||||||
#include <AK/OwnPtr.h>
|
#include <AK/OwnPtr.h>
|
||||||
|
#include <LibGfx/Matrix4x4.h>
|
||||||
|
|
||||||
namespace GL {
|
namespace GL {
|
||||||
|
|
||||||
|
@ -25,6 +26,7 @@ public:
|
||||||
virtual GLenum gl_get_error() = 0;
|
virtual GLenum gl_get_error() = 0;
|
||||||
virtual GLubyte* gl_get_string(GLenum name) = 0;
|
virtual GLubyte* gl_get_string(GLenum name) = 0;
|
||||||
virtual void gl_load_identity() = 0;
|
virtual void gl_load_identity() = 0;
|
||||||
|
virtual void gl_load_matrix(const FloatMatrix4x4& matrix) = 0;
|
||||||
virtual void gl_matrix_mode(GLenum mode) = 0;
|
virtual void gl_matrix_mode(GLenum mode) = 0;
|
||||||
virtual void gl_push_matrix() = 0;
|
virtual void gl_push_matrix() = 0;
|
||||||
virtual void gl_pop_matrix() = 0;
|
virtual void gl_pop_matrix() = 0;
|
||||||
|
|
|
@ -35,6 +35,17 @@ void glPopMatrix()
|
||||||
g_gl_context->gl_pop_matrix();
|
g_gl_context->gl_pop_matrix();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void glLoadMatrixf(const GLfloat* matrix)
|
||||||
|
{
|
||||||
|
FloatMatrix4x4 mat(
|
||||||
|
matrix[0], matrix[1], matrix[2], matrix[3],
|
||||||
|
matrix[4], matrix[5], matrix[6], matrix[7],
|
||||||
|
matrix[8], matrix[9], matrix[10], matrix[11],
|
||||||
|
matrix[12], matrix[13], matrix[14], matrix[15]);
|
||||||
|
|
||||||
|
g_gl_context->gl_load_matrix(mat);
|
||||||
|
}
|
||||||
|
|
||||||
void glLoadIdentity()
|
void glLoadIdentity()
|
||||||
{
|
{
|
||||||
g_gl_context->gl_load_identity();
|
g_gl_context->gl_load_identity();
|
||||||
|
|
|
@ -494,6 +494,23 @@ void SoftwareGLContext::gl_load_identity()
|
||||||
m_error = GL_NO_ERROR;
|
m_error = GL_NO_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SoftwareGLContext::gl_load_matrix(const FloatMatrix4x4& matrix)
|
||||||
|
{
|
||||||
|
if (m_in_draw_state) {
|
||||||
|
m_error = GL_INVALID_OPERATION;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_current_matrix_mode == GL_PROJECTION)
|
||||||
|
m_projection_matrix = matrix;
|
||||||
|
else if (m_current_matrix_mode == GL_MODELVIEW)
|
||||||
|
m_model_view_matrix = matrix;
|
||||||
|
else
|
||||||
|
VERIFY_NOT_REACHED();
|
||||||
|
|
||||||
|
m_error = GL_NO_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
void SoftwareGLContext::gl_matrix_mode(GLenum mode)
|
void SoftwareGLContext::gl_matrix_mode(GLenum mode)
|
||||||
{
|
{
|
||||||
if (m_in_draw_state) {
|
if (m_in_draw_state) {
|
||||||
|
|
|
@ -25,6 +25,7 @@ public:
|
||||||
virtual GLenum gl_get_error() override;
|
virtual GLenum gl_get_error() override;
|
||||||
virtual GLubyte* gl_get_string(GLenum name) override;
|
virtual GLubyte* gl_get_string(GLenum name) override;
|
||||||
virtual void gl_load_identity() override;
|
virtual void gl_load_identity() override;
|
||||||
|
virtual void gl_load_matrix(const FloatMatrix4x4& matrix) override;
|
||||||
virtual void gl_matrix_mode(GLenum mode) override;
|
virtual void gl_matrix_mode(GLenum mode) override;
|
||||||
virtual void gl_push_matrix() override;
|
virtual void gl_push_matrix() override;
|
||||||
virtual void gl_pop_matrix() override;
|
virtual void gl_pop_matrix() override;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue