Commit 7462601f by Nicolas Capens

Implement glFrustum() for OpenGL ES 1.1.

Change-Id: Iedf1f5d64a3346a0b4cf081cfcd383c8dc67b775 Reviewed-on: https://swiftshader-review.googlesource.com/2590Reviewed-by: 's avatarMaxime Grégoire <mgregoire@google.com> Reviewed-by: 's avatarNicolas Capens <capn@google.com> Tested-by: 's avatarNicolas Capens <capn@google.com>
parent fec8129f
...@@ -6239,7 +6239,7 @@ void APIENTRY glFogiv(GLenum pname, const GLint *params) ...@@ -6239,7 +6239,7 @@ void APIENTRY glFogiv(GLenum pname, const GLint *params)
void APIENTRY glFrustum(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar) void APIENTRY glFrustum(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar)
{ {
TRACE("(*)"); TRACE("(GLdouble left = %f, GLdouble right = %f, GLdouble bottom = %f, GLdouble top = %f, GLdouble zNear = %f, GLdouble zFar = %f)", left, right, bottom, top, zNear, zFar);
gl::Context *context = gl::getContext(); gl::Context *context = gl::getContext();
......
...@@ -2646,6 +2646,11 @@ void Context::multiply(const GLfloat *m) ...@@ -2646,6 +2646,11 @@ void Context::multiply(const GLfloat *m)
currentMatrixStack().multiply(m); currentMatrixStack().multiply(m);
} }
void Context::frustum(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar)
{
currentMatrixStack().frustum(left, right, bottom, top, zNear, zFar);
}
void Context::ortho(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar) void Context::ortho(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar)
{ {
currentMatrixStack().ortho(left, right, bottom, top, zNear, zFar); currentMatrixStack().ortho(left, right, bottom, top, zNear, zFar);
......
...@@ -445,6 +445,7 @@ public: ...@@ -445,6 +445,7 @@ public:
void translate(GLfloat x, GLfloat y, GLfloat z); void translate(GLfloat x, GLfloat y, GLfloat z);
void scale(GLfloat x, GLfloat y, GLfloat z); void scale(GLfloat x, GLfloat y, GLfloat z);
void multiply(const GLfloat *m); void multiply(const GLfloat *m);
void frustum(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar);
void ortho(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar); void ortho(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar);
private: private:
......
...@@ -113,8 +113,8 @@ namespace sw ...@@ -113,8 +113,8 @@ namespace sw
float A = (r + l) / (r - l); float A = (r + l) / (r - l);
float B = (t + b) / (t - b); float B = (t + b) / (t - b);
float C = -(f + n) / (r - n); float C = -(f + n) / (f - n);
float D = -2 * r * n / (f - n); float D = -2 * f * n / (f - n);
Matrix frustum(2 * n / (r - l), 0, A, 0, Matrix frustum(2 * n / (r - l), 0, A, 0,
0, 2 * n / (t - b), B, 0, 0, 2 * n / (t - b), B, 0,
......
...@@ -1868,7 +1868,14 @@ void GL_APIENTRY glFrontFace(GLenum mode) ...@@ -1868,7 +1868,14 @@ void GL_APIENTRY glFrontFace(GLenum mode)
void GL_APIENTRY glFrustumf(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar) void GL_APIENTRY glFrustumf(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar)
{ {
UNIMPLEMENTED(); TRACE("(GLfloat left = %f, GLfloat right = %f, GLfloat bottom = %f, GLfloat top = %f, GLfloat zNear = %f, GLfloat zFar = %f)", left, right, bottom, top, zNear, zFar);
es1::Context *context = es1::getContext();
if(context)
{
context->frustum(left, right, bottom, top, zNear, zFar);
}
} }
void GL_APIENTRY glFrustumx(GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar) void GL_APIENTRY glFrustumx(GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar)
...@@ -2874,7 +2881,7 @@ void GL_APIENTRY glNormalPointer(GLenum type, GLsizei stride, const GLvoid *poin ...@@ -2874,7 +2881,7 @@ void GL_APIENTRY glNormalPointer(GLenum type, GLsizei stride, const GLvoid *poin
{ {
TRACE("(GLenum type = 0x%X, GLsizei stride = %d, const GLvoid *pointer = 0x%0.8p)", type, stride, pointer); TRACE("(GLenum type = 0x%X, GLsizei stride = %d, const GLvoid *pointer = 0x%0.8p)", type, stride, pointer);
glVertexAttribPointer(sw::Normal, 3, type, false, stride, pointer); glVertexAttribPointer(sw::Normal, 3, type, false, stride, pointer);
} }
void GL_APIENTRY glOrthof(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar) void GL_APIENTRY glOrthof(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment