summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Userland/Libraries/LibGL/GL/gl.h11
-rw-r--r--Userland/Libraries/LibGL/GLContext.h3
-rw-r--r--Userland/Libraries/LibGL/GLTexture.cpp32
-rw-r--r--Userland/Libraries/LibGL/GLVert.cpp15
-rw-r--r--Userland/Libraries/LibGL/SoftwareGLContext.cpp73
-rw-r--r--Userland/Libraries/LibGL/SoftwareGLContext.h7
6 files changed, 139 insertions, 2 deletions
diff --git a/Userland/Libraries/LibGL/GL/gl.h b/Userland/Libraries/LibGL/GL/gl.h
index a349d752c7..fa03be7797 100644
--- a/Userland/Libraries/LibGL/GL/gl.h
+++ b/Userland/Libraries/LibGL/GL/gl.h
@@ -528,8 +528,12 @@ GLAPI void glHint(GLenum target, GLenum mode);
GLAPI void glReadBuffer(GLenum mode);
GLAPI void glDrawBuffer(GLenum buffer);
GLAPI void glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels);
-GLAPI void glTexImage2D(GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid* data);
+GLAPI void glTexImage1D(GLenum target, GLint level, GLint internalFormat, GLsizei width, GLint border, GLenum format, GLenum type, GLvoid const* data);
+GLAPI void glTexImage2D(GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, GLvoid const* data);
+GLAPI void glTexImage3D(GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, GLvoid const* data);
GLAPI void glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid* data);
+GLAPI void glTexCoord2d(GLdouble s, GLdouble t);
+GLAPI void glTexCoord2dv(GLdouble const* v);
GLAPI void glTexCoord2f(GLfloat s, GLfloat t);
GLAPI void glTexCoord2fv(GLfloat const* v);
GLAPI void glTexCoord4fv(const GLfloat* v);
@@ -570,6 +574,7 @@ GLAPI void glStencilOp(GLenum sfail, GLenum dpfail, GLenum dppass);
GLAPI void glStencilOpSeparate(GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass);
GLAPI void glNormal3f(GLfloat nx, GLfloat ny, GLfloat nz);
GLAPI void glNormal3fv(GLfloat const* v);
+GLAPI void glNormalPointer(GLenum type, GLsizei stride, void const* pointer);
GLAPI void glRasterPos2i(GLint x, GLint y);
GLAPI void glMaterialf(GLenum face, GLenum pname, GLfloat param);
GLAPI void glMaterialfv(GLenum face, GLenum pname, GLfloat const* params);
@@ -594,6 +599,10 @@ GLAPI void glEvalMesh1(GLenum mode, GLint i1, GLint i2);
GLAPI void glEvalMesh2(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2);
GLAPI void glEvalPoint1(GLint i);
GLAPI void glEvalPoint2(GLint i, GLint j);
+GLAPI void glTexGend(GLenum coord, GLenum pname, GLdouble param);
+GLAPI void glTexGenf(GLenum coord, GLenum pname, GLfloat param);
+GLAPI void glTexGenfv(GLenum coord, GLenum pname, GLfloat const* params);
+GLAPI void glTexGeni(GLenum coord, GLenum pname, GLint param);
GLAPI void glRectf(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2);
GLAPI void glRecti(GLint x1, GLint y1, GLint x2, GLint y2);
GLAPI void glGetTexLevelParameteriv(GLenum target, GLint level, GLenum pname, GLint* params);
diff --git a/Userland/Libraries/LibGL/GLContext.h b/Userland/Libraries/LibGL/GLContext.h
index cd1c9591db..c9999a98e5 100644
--- a/Userland/Libraries/LibGL/GLContext.h
+++ b/Userland/Libraries/LibGL/GLContext.h
@@ -108,6 +108,7 @@ public:
virtual void gl_stencil_func_separate(GLenum face, GLenum func, GLint ref, GLuint mask) = 0;
virtual void gl_stencil_op_separate(GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass) = 0;
virtual void gl_normal(GLfloat nx, GLfloat ny, GLfloat nz) = 0;
+ virtual void gl_normal_pointer(GLenum type, GLsizei stride, void const* pointer) = 0;
virtual void gl_raster_pos(GLfloat x, GLfloat y, GLfloat z, GLfloat w) = 0;
virtual void gl_materialv(GLenum face, GLenum pname, GLfloat const* params) = 0;
virtual void gl_line_width(GLfloat width) = 0;
@@ -118,6 +119,8 @@ public:
virtual void gl_copy_tex_image_2d(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border) = 0;
virtual void gl_get_tex_parameter_integerv(GLenum target, GLint level, GLenum pname, GLint* params) = 0;
virtual void gl_rect(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2) = 0;
+ virtual void gl_tex_gen(GLenum coord, GLenum pname, GLdouble param) = 0;
+ virtual void gl_tex_gen_floatv(GLenum coord, GLenum pname, GLfloat const* params) = 0;
virtual void present() = 0;
};
diff --git a/Userland/Libraries/LibGL/GLTexture.cpp b/Userland/Libraries/LibGL/GLTexture.cpp
index 354b8be7ae..f9281de007 100644
--- a/Userland/Libraries/LibGL/GLTexture.cpp
+++ b/Userland/Libraries/LibGL/GLTexture.cpp
@@ -20,11 +20,23 @@ void glDeleteTextures(GLsizei n, const GLuint* textures)
g_gl_context->gl_delete_textures(n, textures);
}
+void glTexImage1D(GLenum target, GLint level, GLint internalFormat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid* data)
+{
+ dbgln("glTexImage1D({:#x}, {}, {:#x}, {}, {}, {:#x}, {:#x}, {:p}): unimplemented", target, level, internalFormat, width, border, format, type, data);
+ TODO();
+}
+
void glTexImage2D(GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid* data)
{
g_gl_context->gl_tex_image_2d(target, level, internalFormat, width, height, border, format, type, data);
}
+void glTexImage3D(GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid* data)
+{
+ dbgln("glTexImage3D({:#x}, {}, {:#x}, {}, {}, {}, {}, {:#x}, {:#x}, {:p}): unimplemented", target, level, internalFormat, width, height, depth, border, format, type, data);
+ TODO();
+}
+
void glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid* data)
{
g_gl_context->gl_tex_sub_image_2d(target, level, xoffset, yoffset, width, height, format, type, data);
@@ -62,6 +74,26 @@ void glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x
g_gl_context->gl_copy_tex_image_2d(target, level, internalformat, x, y, width, height, border);
}
+void glTexGend(GLenum coord, GLenum pname, GLdouble param)
+{
+ g_gl_context->gl_tex_gen(coord, pname, param);
+}
+
+void glTexGenf(GLenum coord, GLenum pname, GLfloat param)
+{
+ g_gl_context->gl_tex_gen(coord, pname, param);
+}
+
+void glTexGenfv(GLenum coord, GLenum pname, GLfloat const* params)
+{
+ g_gl_context->gl_tex_gen_floatv(coord, pname, params);
+}
+
+void glTexGeni(GLenum coord, GLenum pname, GLint param)
+{
+ g_gl_context->gl_tex_gen(coord, pname, param);
+}
+
void glGetTexLevelParameteriv(GLenum target, GLint level, GLenum pname, GLint* params)
{
g_gl_context->gl_get_tex_parameter_integerv(target, level, pname, params);
diff --git a/Userland/Libraries/LibGL/GLVert.cpp b/Userland/Libraries/LibGL/GLVert.cpp
index 31c82b5eb2..1b651683cd 100644
--- a/Userland/Libraries/LibGL/GLVert.cpp
+++ b/Userland/Libraries/LibGL/GLVert.cpp
@@ -140,6 +140,16 @@ void glVertex4sv(const GLshort* v)
g_gl_context->gl_vertex(v[0], v[1], v[2], v[3]);
}
+void glTexCoord2d(GLdouble s, GLdouble t)
+{
+ g_gl_context->gl_tex_coord(s, t, 0.0f, 0.0f);
+}
+
+void glTexCoord2dv(GLdouble const* v)
+{
+ g_gl_context->gl_tex_coord(v[0], v[1], 0.0f, 0.0f);
+}
+
void glTexCoord2f(GLfloat s, GLfloat t)
{
g_gl_context->gl_tex_coord(s, t, 0.0f, 0.0f);
@@ -165,6 +175,11 @@ void glNormal3fv(GLfloat const* v)
g_gl_context->gl_normal(v[0], v[1], v[2]);
}
+void glNormalPointer(GLenum type, GLsizei stride, void const* pointer)
+{
+ g_gl_context->gl_normal_pointer(type, stride, pointer);
+}
+
void glRectf(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2)
{
g_gl_context->gl_rect(x1, y1, x2, y2);
diff --git a/Userland/Libraries/LibGL/SoftwareGLContext.cpp b/Userland/Libraries/LibGL/SoftwareGLContext.cpp
index 997487fdc3..8aca34116c 100644
--- a/Userland/Libraries/LibGL/SoftwareGLContext.cpp
+++ b/Userland/Libraries/LibGL/SoftwareGLContext.cpp
@@ -2541,6 +2541,20 @@ void SoftwareGLContext::gl_normal(GLfloat nx, GLfloat ny, GLfloat nz)
m_current_vertex_normal = { nx, ny, nz };
}
+void SoftwareGLContext::gl_normal_pointer(GLenum type, GLsizei stride, void const* pointer)
+{
+ RETURN_WITH_ERROR_IF(m_in_draw_state, GL_INVALID_OPERATION);
+ RETURN_WITH_ERROR_IF(type != GL_BYTE
+ && type != GL_SHORT
+ && type != GL_INT
+ && type != GL_FLOAT
+ && type != GL_DOUBLE,
+ GL_INVALID_ENUM);
+ RETURN_WITH_ERROR_IF(stride < 0, GL_INVALID_VALUE);
+
+ dbgln_if(GL_DEBUG, "gl_normal_pointer({:#x}, {}, {:p}): unimplemented", type, stride, pointer);
+}
+
void SoftwareGLContext::gl_raster_pos(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
{
APPEND_TO_CALL_LIST_AND_RETURN_IF_NEEDED(gl_raster_pos, x, y, z, w);
@@ -2692,6 +2706,65 @@ void SoftwareGLContext::gl_rect(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble
gl_end();
}
+void SoftwareGLContext::gl_tex_gen(GLenum coord, GLenum pname, GLdouble param)
+{
+ APPEND_TO_CALL_LIST_AND_RETURN_IF_NEEDED(gl_tex_gen, coord, pname, param);
+ RETURN_WITH_ERROR_IF(m_in_draw_state, GL_INVALID_OPERATION);
+
+ RETURN_WITH_ERROR_IF(coord < GL_S || coord > GL_Q, GL_INVALID_ENUM);
+ RETURN_WITH_ERROR_IF(pname != GL_TEXTURE_GEN_MODE, GL_INVALID_ENUM);
+ RETURN_WITH_ERROR_IF(param != GL_EYE_LINEAR
+ && param != GL_OBJECT_LINEAR
+ && param != GL_SPHERE_MAP
+ && param != GL_NORMAL_MAP
+ && param != GL_REFLECTION_MAP,
+ GL_INVALID_ENUM);
+ RETURN_WITH_ERROR_IF((coord == GL_R || coord == GL_Q) && param == GL_SPHERE_MAP, GL_INVALID_ENUM);
+
+ dbgln_if(GL_DEBUG, "gl_tex_gen({:#x}, {:#x}, {}): unimplemented", coord, pname, param);
+}
+
+void SoftwareGLContext::gl_tex_gen_floatv(GLenum coord, GLenum pname, GLfloat const* params)
+{
+ APPEND_TO_CALL_LIST_AND_RETURN_IF_NEEDED(gl_tex_gen_floatv, coord, pname, params);
+ RETURN_WITH_ERROR_IF(m_in_draw_state, GL_INVALID_OPERATION);
+
+ RETURN_WITH_ERROR_IF(coord < GL_S || coord > GL_Q, GL_INVALID_ENUM);
+ RETURN_WITH_ERROR_IF(pname != GL_TEXTURE_GEN_MODE
+ && pname != GL_OBJECT_PLANE
+ && pname != GL_EYE_PLANE,
+ GL_INVALID_ENUM);
+
+ switch (pname) {
+ case GL_TEXTURE_GEN_MODE: {
+ auto param = static_cast<GLenum>(params[0]);
+ RETURN_WITH_ERROR_IF(param != GL_EYE_LINEAR
+ && param != GL_OBJECT_LINEAR
+ && param != GL_SPHERE_MAP
+ && param != GL_NORMAL_MAP
+ && param != GL_REFLECTION_MAP,
+ GL_INVALID_ENUM);
+ RETURN_WITH_ERROR_IF((coord == GL_R || coord == GL_Q) && param == GL_SPHERE_MAP, GL_INVALID_ENUM);
+
+ dbgln_if(GL_DEBUG, "gl_tex_gen_floatv({:#x}, {:#x}, {:p}): unimplemented", coord, pname, params);
+ break;
+ }
+ case GL_OBJECT_PLANE:
+ case GL_EYE_PLANE: {
+ GLfloat coefficient_p1 = params[0];
+ GLfloat coefficient_p2 = params[1];
+ GLfloat coefficient_p3 = params[2];
+ GLfloat coefficient_p4 = params[3];
+
+ dbgln_if(GL_DEBUG, "gl_tex_gen_floatv({:#x}, {:#x}, {:p}): unimplemented coefficients {} {} {} {}",
+ coord, pname, params, coefficient_p1, coefficient_p2, coefficient_p3, coefficient_p4);
+ break;
+ }
+ default:
+ VERIFY_NOT_REACHED();
+ }
+}
+
void SoftwareGLContext::present()
{
m_rasterizer.blit_to(*m_frontbuffer);
diff --git a/Userland/Libraries/LibGL/SoftwareGLContext.h b/Userland/Libraries/LibGL/SoftwareGLContext.h
index 6abec1efbc..025936c4d8 100644
--- a/Userland/Libraries/LibGL/SoftwareGLContext.h
+++ b/Userland/Libraries/LibGL/SoftwareGLContext.h
@@ -121,6 +121,7 @@ public:
virtual void gl_stencil_func_separate(GLenum face, GLenum func, GLint ref, GLuint mask) override;
virtual void gl_stencil_op_separate(GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass) override;
virtual void gl_normal(GLfloat nx, GLfloat ny, GLfloat nz) override;
+ virtual void gl_normal_pointer(GLenum type, GLsizei stride, void const* pointer) override;
virtual void gl_raster_pos(GLfloat x, GLfloat y, GLfloat z, GLfloat w) override;
virtual void gl_materialv(GLenum face, GLenum pname, GLfloat const* params) override;
virtual void gl_line_width(GLfloat width) override;
@@ -131,6 +132,8 @@ public:
virtual void gl_copy_tex_image_2d(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border) override;
virtual void gl_get_tex_parameter_integerv(GLenum target, GLint level, GLenum pname, GLint* params) override;
virtual void gl_rect(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2) override;
+ virtual void gl_tex_gen(GLenum coord, GLenum pname, GLdouble param) override;
+ virtual void gl_tex_gen_floatv(GLenum coord, GLenum pname, GLfloat const* params) override;
virtual void present() override;
@@ -316,7 +319,9 @@ private:
decltype(&SoftwareGLContext::gl_light_model),
decltype(&SoftwareGLContext::gl_bitmap),
decltype(&SoftwareGLContext::gl_copy_tex_image_2d),
- decltype(&SoftwareGLContext::gl_rect)>;
+ decltype(&SoftwareGLContext::gl_rect),
+ decltype(&SoftwareGLContext::gl_tex_gen),
+ decltype(&SoftwareGLContext::gl_tex_gen_floatv)>;
using ExtraSavedArguments = Variant<
FloatMatrix4x4>;