LibGL: Implement glTexCoord2f

This commit is contained in:
Jesse Buhagiar 2021-05-23 20:38:18 +10:00 committed by Ali Mohammad Pur
parent 4f324ba4d7
commit e21ba0cd12
Notes: sideshowbarker 2024-07-18 17:22:08 +09:00
5 changed files with 19 additions and 0 deletions

View file

@ -256,6 +256,7 @@ GLAPI void glHint(GLenum target, GLenum mode);
GLAPI void glReadBuffer(GLenum mode);
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 glTexCoord2f(GLfloat s, GLfloat t);
#ifdef __cplusplus
}

View file

@ -58,6 +58,7 @@ public:
virtual void gl_read_buffer(GLenum mode) = 0;
virtual void gl_read_pixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels) = 0;
virtual void gl_tex_image_2d(GLenum target, GLint level, GLint internal_format, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid* data) = 0;
virtual void gl_tex_coord(GLfloat s, GLfloat t, GLfloat r, GLfloat q) = 0;
virtual void present() = 0;
};

View file

@ -140,6 +140,11 @@ void glVertex4sv(const GLshort* v)
g_gl_context->gl_vertex(v[0], v[1], v[2], v[3]);
}
void glTexCoord2f(GLfloat s, GLfloat t)
{
g_gl_context->gl_tex_coord(s, t, 0.0f, 0.0f);
}
void glRotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z)
{
g_gl_context->gl_rotate(angle, x, y, z);

View file

@ -646,6 +646,17 @@ void SoftwareGLContext::gl_vertex(GLdouble x, GLdouble y, GLdouble z, GLdouble w
m_error = GL_NO_ERROR;
}
// FIXME: We need to add `r` and `q` to our GLVertex?!
void SoftwareGLContext::gl_tex_coord(GLfloat s, GLfloat t, GLfloat, GLfloat)
{
auto& vertex = vertex_list.last(); // Get the last created vertex
vertex.u = s;
vertex.v = t;
m_error = GL_NO_ERROR;
}
void SoftwareGLContext::gl_viewport(GLint x, GLint y, GLsizei width, GLsizei height)
{
APPEND_TO_CALL_LIST_AND_RETURN_IF_NEEDED(gl_viewport, x, y, width, height);

View file

@ -67,6 +67,7 @@ public:
virtual void gl_read_buffer(GLenum mode) override;
virtual void gl_read_pixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels) override;
virtual void gl_tex_image_2d(GLenum target, GLint level, GLint internal_format, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid* data) override;
virtual void gl_tex_coord(GLfloat s, GLfloat t, GLfloat r, GLfloat q) override;
virtual void present() override;