{\r
Device *Context::device = 0;\r
\r
-Context::Context(const egl::Config *config, const Context *shareContext) : mConfig(config)\r
+Context::Context(const egl::Config *config, const Context *shareContext)\r
+ : modelViewStack(MAX_MODELVIEW_STACK_DEPTH),\r
+ projectionStack(MAX_PROJECTION_STACK_DEPTH),\r
+ textureStack0(MAX_TEXTURE_STACK_DEPTH),\r
+ textureStack1(MAX_TEXTURE_STACK_DEPTH)\r
{\r
device = getDevice();\r
\r
mHasBeenCurrent = false;\r
\r
markAllStateDirty();\r
+\r
+ matrixMode = GL_MODELVIEW;\r
}\r
\r
Context::~Context()\r
\r
for(int type = 0; type < TEXTURE_TYPE_COUNT; type++)\r
{\r
- for(int sampler = 0; sampler < MAX_COMBINED_TEXTURE_IMAGE_UNITS; sampler++)\r
+ for(int sampler = 0; sampler < MAX_TEXTURE_IMAGE_UNITS; sampler++)\r
{\r
mState.samplerTexture[type][sampler].set(NULL);\r
}\r
case GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT:\r
*params = MAX_TEXTURE_MAX_ANISOTROPY;\r
break;\r
+ case GL_MODELVIEW_MATRIX:\r
+ for(int i = 0; i < 16; i++)\r
+ {\r
+ params[i] = modelViewStack.current()[i % 4][i / 4];\r
+ }\r
+ break;\r
+ case GL_PROJECTION_MATRIX:\r
+ for(int i = 0; i < 16; i++)\r
+ {\r
+ params[i] = projectionStack.current()[i % 4][i / 4];\r
+ }\r
+ break;\r
default:\r
return false;\r
}\r
break;\r
case GL_TEXTURE_BINDING_2D:\r
{\r
- if(mState.activeSampler < 0 || mState.activeSampler > MAX_COMBINED_TEXTURE_IMAGE_UNITS - 1)\r
+ if(mState.activeSampler < 0 || mState.activeSampler > MAX_TEXTURE_IMAGE_UNITS - 1)\r
{\r
error(GL_INVALID_OPERATION);\r
return false;\r
break;\r
case GL_TEXTURE_BINDING_CUBE_MAP_OES:\r
{\r
- if(mState.activeSampler < 0 || mState.activeSampler > MAX_COMBINED_TEXTURE_IMAGE_UNITS - 1)\r
+ if(mState.activeSampler < 0 || mState.activeSampler > MAX_TEXTURE_IMAGE_UNITS - 1)\r
{\r
error(GL_INVALID_OPERATION);\r
return false;\r
break;\r
case GL_TEXTURE_BINDING_EXTERNAL_OES:\r
{\r
- if(mState.activeSampler < 0 || mState.activeSampler > MAX_COMBINED_TEXTURE_IMAGE_UNITS - 1)\r
+ if(mState.activeSampler < 0 || mState.activeSampler > MAX_TEXTURE_IMAGE_UNITS - 1)\r
{\r
error(GL_INVALID_OPERATION);\r
return false;\r
*params = mState.samplerTexture[TEXTURE_EXTERNAL][mState.activeSampler].id();\r
}\r
break;\r
- case GL_MAX_LIGHTS: *params = MAX_LIGHTS; break;\r
+ case GL_MAX_LIGHTS: *params = MAX_LIGHTS; break;\r
+ case GL_MAX_MODELVIEW_STACK_DEPTH: *params = MAX_MODELVIEW_STACK_DEPTH; break;\r
+ case GL_MAX_PROJECTION_STACK_DEPTH: *params = MAX_PROJECTION_STACK_DEPTH; break;\r
+ case GL_MAX_TEXTURE_STACK_DEPTH: *params = MAX_TEXTURE_STACK_DEPTH; break;\r
default:\r
return false;\r
}\r
case GL_TEXTURE_BINDING_2D:\r
case GL_TEXTURE_BINDING_CUBE_MAP_OES:\r
case GL_TEXTURE_BINDING_EXTERNAL_OES:\r
+ case GL_MAX_TEXTURE_UNITS:\r
return 1;\r
case GL_MAX_VIEWPORT_DIMS:\r
return 2;\r
return 4;\r
case GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT:\r
case GL_MAX_LIGHTS:\r
+ case GL_MAX_MODELVIEW_STACK_DEPTH:\r
+ case GL_MAX_PROJECTION_STACK_DEPTH:\r
+ case GL_MAX_TEXTURE_STACK_DEPTH:\r
return 1;\r
default:\r
UNREACHABLE();\r
case GL_VIEWPORT:\r
case GL_SCISSOR_BOX:\r
case GL_MAX_LIGHTS:\r
+ case GL_MAX_MODELVIEW_STACK_DEPTH:\r
+ case GL_MAX_PROJECTION_STACK_DEPTH:\r
+ case GL_MAX_TEXTURE_STACK_DEPTH:\r
return true;\r
default:\r
ASSERT(isQueryParameterFloat(pname) || isQueryParameterBool(pname));\r
device->setSpecularMaterialSource(sw::MATERIAL_MATERIAL);\r
device->setAmbientMaterialSource(sw::MATERIAL_MATERIAL);\r
device->setEmissiveMaterialSource(sw::MATERIAL_MATERIAL);\r
+\r
+ device->setProjectionMatrix(projectionStack.current());\r
+ device->setModelMatrix(modelViewStack.current());\r
+ device->setTextureMatrix(0, textureStack0.current());\r
+ device->setTextureMatrix(1, textureStack1.current());\r
+ device->setTextureTransform(0, textureStack0.isIdentity() ? 0 : 4, false);\r
+ device->setTextureTransform(1, textureStack1.isIdentity() ? 0 : 4, false);\r
}\r
\r
GLenum Context::applyVertexBuffer(GLint base, GLint first, GLsizei count)\r
\r
for(int type = 0; type < TEXTURE_TYPE_COUNT; type++)\r
{\r
- for(int sampler = 0; sampler < MAX_COMBINED_TEXTURE_IMAGE_UNITS; sampler++)\r
+ for(int sampler = 0; sampler < MAX_TEXTURE_IMAGE_UNITS; sampler++)\r
{\r
if(mState.samplerTexture[type][sampler].id() == texture)\r
{\r
return device;\r
}\r
\r
+void Context::setMatrixMode(GLenum mode)\r
+{\r
+ matrixMode = mode;\r
+}\r
+\r
+sw::MatrixStack &Context::currentMatrixStack()\r
+{\r
+ switch(matrixMode)\r
+ {\r
+ case GL_MODELVIEW: \r
+ return modelViewStack;\r
+ case GL_PROJECTION:\r
+ return projectionStack;\r
+ case GL_TEXTURE:\r
+ switch(mState.activeSampler)\r
+ {\r
+ case 0: return textureStack0;\r
+ case 1: return textureStack1;\r
+ }\r
+ break; \r
+ }\r
+\r
+ UNREACHABLE();\r
+ return textureStack0;\r
+}\r
+\r
+void Context::loadIdentity()\r
+{\r
+ currentMatrixStack().identity();\r
+}\r
+\r
+void Context::load(const GLfloat *m)\r
+{\r
+ currentMatrixStack().load(m);\r
+}\r
+\r
+void Context::pushMatrix()\r
+{\r
+ if(!currentMatrixStack().push())\r
+ {\r
+ return error(GL_STACK_OVERFLOW);\r
+ }\r
+}\r
+\r
+void Context::popMatrix()\r
+{\r
+ if(!currentMatrixStack().pop())\r
+ {\r
+ return error(GL_STACK_OVERFLOW);\r
+ }\r
+}\r
+\r
+void Context::rotate(GLfloat angle, GLfloat x, GLfloat y, GLfloat z)\r
+{\r
+ currentMatrixStack().rotate(angle, x, y, z);\r
+}\r
+\r
+void Context::translate(GLfloat x, GLfloat y, GLfloat z)\r
+{\r
+ currentMatrixStack().translate(x, y, z); \r
+}\r
+\r
+void Context::scale(GLfloat x, GLfloat y, GLfloat z)\r
+{\r
+ currentMatrixStack().scale(x, y, z);\r
+}\r
+\r
+void Context::multiply(const GLfloat *m)\r
+{\r
+ currentMatrixStack().multiply(m);\r
+}\r
+\r
+void Context::ortho(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar)\r
+{\r
+ currentMatrixStack().ortho(left, right, bottom, top, zNear, zFar);\r
+}\r
+\r
}\r
\r
// Exported functions for use by EGL\r
#include "RefCountObject.h"\r
#include "Image.hpp"\r
#include "Renderer/Sampler.hpp"\r
+#include "MatrixStack.hpp"\r
\r
#define GL_API\r
#include <GLES/gl.h>\r
enum\r
{\r
MAX_VERTEX_ATTRIBS = 16,\r
- MAX_UNIFORM_VECTORS = 256, // Device limit\r
- MAX_VERTEX_UNIFORM_VECTORS = 256 - 3, // Reserve space for gl_DepthRange\r
MAX_VARYING_VECTORS = 10,\r
MAX_TEXTURE_IMAGE_UNITS = 16,\r
- MAX_VERTEX_TEXTURE_IMAGE_UNITS = 4,\r
- MAX_COMBINED_TEXTURE_IMAGE_UNITS = MAX_TEXTURE_IMAGE_UNITS + MAX_VERTEX_TEXTURE_IMAGE_UNITS,\r
- MAX_FRAGMENT_UNIFORM_VECTORS = 224 - 3, // Reserve space for gl_DepthRange\r
MAX_DRAW_BUFFERS = 1,\r
MAX_LIGHTS = 8,\r
\r
+ MAX_MODELVIEW_STACK_DEPTH = 32,\r
+ MAX_PROJECTION_STACK_DEPTH = 2,\r
+ MAX_TEXTURE_STACK_DEPTH = 2,\r
+\r
IMPLEMENTATION_COLOR_READ_FORMAT = GL_RGB,\r
IMPLEMENTATION_COLOR_READ_TYPE = GL_UNSIGNED_SHORT_5_6_5\r
};\r
BindingPointer<Renderbuffer> renderbuffer;\r
\r
VertexAttribute vertexAttribute[MAX_VERTEX_ATTRIBS];\r
- BindingPointer<Texture> samplerTexture[TEXTURE_TYPE_COUNT][MAX_COMBINED_TEXTURE_IMAGE_UNITS];\r
+ BindingPointer<Texture> samplerTexture[TEXTURE_TYPE_COUNT][MAX_TEXTURE_IMAGE_UNITS];\r
\r
GLint unpackAlignment;\r
GLint packAlignment;\r
\r
Device *getDevice();\r
\r
+ void setMatrixMode(GLenum mode);\r
+ void loadIdentity();\r
+ void load(const GLfloat *m);\r
+ void pushMatrix();\r
+ void popMatrix();\r
+ void rotate(GLfloat angle, GLfloat x, GLfloat y, GLfloat z);\r
+ void translate(GLfloat x, GLfloat y, GLfloat z);\r
+ void scale(GLfloat x, GLfloat y, GLfloat z);\r
+ void multiply(const GLfloat *m);\r
+ void ortho(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar);\r
+\r
private:\r
virtual ~Context();\r
\r
bool cullSkipsDraw(GLenum drawMode);\r
bool isTriangleMode(GLenum drawMode);\r
\r
- const egl::Config *const mConfig;\r
-\r
State mState;\r
\r
BindingPointer<Texture2D> mTexture2DZero;\r
bool mFrontFaceDirty;\r
bool mDitherStateDirty;\r
\r
+ sw::MatrixStack ¤tMatrixStack();\r
+ GLenum matrixMode;\r
+ sw::MatrixStack modelViewStack;\r
+ sw::MatrixStack projectionStack;\r
+ sw::MatrixStack textureStack0;\r
+ sw::MatrixStack textureStack1;\r
+\r
ResourceManager *mResourceManager;\r
\r
static Device *device;\r
--- /dev/null
+#include "MatrixStack.hpp"\r
+\r
+#include "Common/Math.hpp"\r
+\r
+namespace sw\r
+{\r
+ MatrixStack::MatrixStack(int size)\r
+ {\r
+ stack = new Matrix[size];\r
+ stack[0] = 1;\r
+\r
+ top = 0;\r
+ this->size = size;\r
+ }\r
+\r
+ MatrixStack::~MatrixStack()\r
+ {\r
+ delete[] stack;\r
+ stack = 0;\r
+ }\r
+\r
+ void MatrixStack::identity()\r
+ {\r
+ stack[top] = 1;\r
+ }\r
+\r
+ void MatrixStack::load(const float *M)\r
+ {\r
+ stack[top] = Matrix(M[0], M[4], M[8], M[12],\r
+ M[1], M[5], M[9], M[13],\r
+ M[2], M[6], M[10], M[14],\r
+ M[3], M[7], M[11], M[15]);\r
+ }\r
+\r
+ void MatrixStack::load(const double *M)\r
+ {\r
+ stack[top] = Matrix((float)M[0], (float)M[4], (float)M[8], (float)M[12],\r
+ (float)M[1], (float)M[5], (float)M[9], (float)M[13],\r
+ (float)M[2], (float)M[6], (float)M[10], (float)M[14],\r
+ (float)M[3], (float)M[7], (float)M[11], (float)M[15]);\r
+ }\r
+\r
+ void MatrixStack::translate(float x, float y, float z)\r
+ {\r
+ stack[top] *= Matrix::translate(x, y, z);\r
+ }\r
+\r
+ void MatrixStack::translate(double x, double y, double z)\r
+ {\r
+ translate((float)x, (float)y, (float)z);\r
+ }\r
+\r
+ void MatrixStack::rotate(float angle, float x, float y, float z)\r
+ {\r
+ float n = 1.0f / sqrt(x*x + y*y + z*z);\r
+\r
+ x *= n;\r
+ y *= n;\r
+ z *= n;\r
+\r
+ float theta = angle * 0.0174532925f; // In radians\r
+ float c = cos(theta);\r
+ float _c = 1 - c;\r
+ float s = sin(theta);\r
+\r
+ // Rodrigues' rotation formula\r
+ sw::Matrix rotate(c+x*x*_c, x*y*_c-z*s, x*z*_c+y*s,\r
+ x*y*_c+z*s, c+y*y*_c, y*z*_c-x*s,\r
+ x*z*_c-y*s, y*z*_c+x*s, c+z*z*_c);\r
+\r
+ stack[top] *= rotate;\r
+ }\r
+\r
+ void MatrixStack::rotate(double angle, double x, double y, double z)\r
+ {\r
+ rotate((float)angle, (float)x, (float)y, (float)z);\r
+ }\r
+\r
+ void MatrixStack::scale(float x, float y, float z)\r
+ {\r
+ stack[top] *= Matrix::scale(x, y, z);\r
+ }\r
+\r
+ void MatrixStack::scale(double x, double y, double z)\r
+ {\r
+ scale((float)x, (float)y, (float)z);\r
+ }\r
+\r
+ void MatrixStack::multiply(const float *M)\r
+ {\r
+ stack[top] *= Matrix(M[0], M[4], M[8], M[12],\r
+ M[1], M[5], M[9], M[13],\r
+ M[2], M[6], M[10], M[14],\r
+ M[3], M[7], M[11], M[15]);\r
+ }\r
+\r
+ void MatrixStack::multiply(const double *M)\r
+ {\r
+ stack[top] *= Matrix((float)M[0], (float)M[4], (float)M[8], (float)M[12],\r
+ (float)M[1], (float)M[5], (float)M[9], (float)M[13],\r
+ (float)M[2], (float)M[6], (float)M[10], (float)M[14],\r
+ (float)M[3], (float)M[7], (float)M[11], (float)M[15]);\r
+ }\r
+\r
+ void MatrixStack::frustum(float left, float right, float bottom, float top, float zNear, float zFar)\r
+ {\r
+ float l = (float)left;\r
+ float r = (float)right;\r
+ float b = (float)bottom;\r
+ float t = (float)top;\r
+ float n = (float)zNear;\r
+ float f = (float)zFar;\r
+\r
+ float A = (r + l) / (r - l);\r
+ float B = (t + b) / (t - b);\r
+ float C = -(f + n) / (r - n);\r
+ float D = -2 * r * n / (f - n);\r
+\r
+ Matrix frustum(2 * n / (r - l), 0, A, 0,\r
+ 0, 2 * n / (t - b), B, 0,\r
+ 0, 0, C, D,\r
+ 0, 0, -1, 0);\r
+\r
+ stack[this->top] *= frustum;\r
+ }\r
+\r
+ void MatrixStack::ortho(double left, double right, double bottom, double top, double zNear, double zFar)\r
+ {\r
+ float l = (float)left;\r
+ float r = (float)right;\r
+ float b = (float)bottom;\r
+ float t = (float)top;\r
+ float n = (float)zNear;\r
+ float f = (float)zFar;\r
+\r
+ float tx = -(r + l) / (r - l);\r
+ float ty = -(t + b) / (t - b);\r
+ float tz = -(f + n) / (f - n);\r
+\r
+ Matrix ortho(2 / (r - l), 0, 0, tx,\r
+ 0, 2 / (t - b), 0, ty,\r
+ 0, 0, -2 / (f - n), tz,\r
+ 0, 0, 0, 1);\r
+\r
+ stack[this->top] *= ortho;\r
+ }\r
+\r
+ bool MatrixStack::push()\r
+ {\r
+ if(top >= size - 1) return false;\r
+\r
+ stack[top + 1] = stack[top];\r
+ top++;\r
+\r
+ return true;\r
+ }\r
+\r
+ bool MatrixStack::pop()\r
+ {\r
+ if(top <= 0) return false;\r
+\r
+ top--;\r
+\r
+ return true;\r
+ }\r
+\r
+ const Matrix &MatrixStack::current()\r
+ {\r
+ return stack[top];\r
+ }\r
+\r
+ bool MatrixStack::isIdentity() const\r
+ {\r
+ const Matrix &m = stack[top];\r
+\r
+ if(m.m[0][0] != 1.0f) return false;\r
+ if(m.m[0][1] != 0.0f) return false;\r
+ if(m.m[0][2] != 0.0f) return false;\r
+ if(m.m[0][3] != 0.0f) return false;\r
+\r
+ if(m.m[1][0] != 0.0f) return false;\r
+ if(m.m[1][1] != 1.0f) return false;\r
+ if(m.m[1][2] != 0.0f) return false;\r
+ if(m.m[1][3] != 0.0f) return false;\r
+\r
+ if(m.m[2][0] != 0.0f) return false;\r
+ if(m.m[2][1] != 0.0f) return false;\r
+ if(m.m[2][2] != 1.0f) return false;\r
+ if(m.m[2][3] != 0.0f) return false;\r
+\r
+ if(m.m[3][0] != 0.0f) return false;\r
+ if(m.m[3][1] != 0.0f) return false;\r
+ if(m.m[3][2] != 0.0f) return false;\r
+ if(m.m[3][3] != 1.0f) return false;\r
+\r
+ return true;\r
+ }\r
+}\r
--- /dev/null
+#ifndef OpenGL32_MatrixStack_hpp\r
+#define OpenGL32_MatrixStack_hpp\r
+\r
+#include "Renderer/Matrix.hpp"\r
+\r
+namespace sw\r
+{\r
+ class MatrixStack\r
+ {\r
+ public:\r
+ MatrixStack(int size = 2);\r
+\r
+ ~MatrixStack();\r
+\r
+ void identity();\r
+ void load(const float *M);\r
+ void load(const double *M);\r
+\r
+ void translate(float x, float y, float z);\r
+ void translate(double x, double y, double z);\r
+ void rotate(float angle, float x, float y, float z);\r
+ void rotate(double angle, double x, double y, double z);\r
+ void scale(float x, float y, float z);\r
+ void scale(double x, double y, double z);\r
+ void multiply(const float *M);\r
+ void multiply(const double *M);\r
+\r
+ void frustum(float left, float right, float bottom, float top, float zNear, float zFar);\r
+ void ortho(double left, double right, double bottom, double top, double zNear, double zFar);\r
+\r
+ bool push(); // False on overflow\r
+ bool pop(); // False on underflow\r
+\r
+ const Matrix ¤t();\r
+ bool isIdentity() const;\r
+\r
+ private:\r
+ int top;\r
+ int size;\r
+ Matrix *stack;\r
+ };\r
+}\r
+\r
+#endif // OpenGL32_MatrixStack_hpp\r
\r
if(context)\r
{\r
- if(texture < GL_TEXTURE0 || texture > GL_TEXTURE0 + es1::MAX_COMBINED_TEXTURE_IMAGE_UNITS - 1)\r
+ if(texture < GL_TEXTURE0 || texture > GL_TEXTURE0 + es1::MAX_TEXTURE_IMAGE_UNITS - 1)\r
{\r
return error(GL_INVALID_ENUM);\r
}\r
\r
void GL_APIENTRY glLoadIdentity(void)\r
{\r
- UNIMPLEMENTED();\r
+ TRACE("()");\r
+\r
+ try\r
+ {\r
+ es1::Context *context = es1::getContext();\r
+\r
+ if(context)\r
+ {\r
+ context->loadIdentity();\r
+ }\r
+ }\r
+ catch(std::bad_alloc&)\r
+ {\r
+ return error(GL_OUT_OF_MEMORY);\r
+ }\r
}\r
\r
void GL_APIENTRY glLoadMatrixf(const GLfloat *m)\r
{\r
- UNIMPLEMENTED();\r
+ TRACE("(const GLfloat *m)");\r
+\r
+ try\r
+ {\r
+ es1::Context *context = es1::getContext();\r
+\r
+ if(context)\r
+ {\r
+ context->load(m);\r
+ }\r
+ }\r
+ catch(std::bad_alloc&)\r
+ {\r
+ return error(GL_OUT_OF_MEMORY);\r
+ }\r
}\r
\r
void GL_APIENTRY glLoadMatrixx(const GLfixed *m)\r
\r
void GL_APIENTRY glMatrixMode(GLenum mode)\r
{\r
- UNIMPLEMENTED();\r
+ TRACE("(GLenum mode = 0x%X)", mode);\r
+\r
+ try\r
+ {\r
+ es1::Context *context = es1::getContext();\r
+\r
+ if(context)\r
+ {\r
+ context->setMatrixMode(mode);\r
+ }\r
+ }\r
+ catch(std::bad_alloc&)\r
+ {\r
+ return error(GL_OUT_OF_MEMORY);\r
+ }\r
}\r
\r
void GL_APIENTRY glMultMatrixf(const GLfloat *m)\r
{\r
- UNIMPLEMENTED();\r
+ TRACE("(const GLfloat *m)");\r
+\r
+ try\r
+ {\r
+ es1::Context *context = es1::getContext();\r
+\r
+ if(context)\r
+ {\r
+ context->multiply(m);\r
+ }\r
+ }\r
+ catch(std::bad_alloc&)\r
+ {\r
+ return error(GL_OUT_OF_MEMORY);\r
+ }\r
}\r
\r
void GL_APIENTRY glMultMatrixx(const GLfixed *m)\r
\r
void GL_APIENTRY glOrthof(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar)\r
{\r
- UNIMPLEMENTED();\r
+ 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);\r
+\r
+ try\r
+ {\r
+ es1::Context *context = es1::getContext();\r
+\r
+ if(context)\r
+ {\r
+ context->ortho(left, right, bottom, top, zNear, zFar);\r
+ }\r
+ }\r
+ catch(std::bad_alloc&)\r
+ {\r
+ return error(GL_OUT_OF_MEMORY);\r
+ }\r
}\r
\r
void GL_APIENTRY glOrthox(GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar)\r
\r
void GL_APIENTRY glPopMatrix(void)\r
{\r
- UNIMPLEMENTED();\r
+ TRACE("()");\r
+ \r
+ try\r
+ {\r
+ es1::Context *context = es1::getContext();\r
+\r
+ if(context)\r
+ {\r
+ context->popMatrix();\r
+ }\r
+ }\r
+ catch(std::bad_alloc&)\r
+ {\r
+ return error(GL_OUT_OF_MEMORY);\r
+ }\r
}\r
\r
void GL_APIENTRY glPushMatrix(void)\r
{\r
- UNIMPLEMENTED();\r
+ TRACE("()");\r
+ \r
+ try\r
+ {\r
+ es1::Context *context = es1::getContext();\r
+\r
+ if(context)\r
+ {\r
+ context->pushMatrix();\r
+ }\r
+ }\r
+ catch(std::bad_alloc&)\r
+ {\r
+ return error(GL_OUT_OF_MEMORY);\r
+ }\r
}\r
\r
void GL_APIENTRY glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels)\r
\r
void GL_APIENTRY glRotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z)\r
{\r
- UNIMPLEMENTED();\r
+ TRACE("(GLfloat angle = %f, GLfloat x = %f, GLfloat y = %f, GLfloat z = %f)", angle, x, y, z);\r
+ \r
+ try\r
+ {\r
+ es1::Context *context = es1::getContext();\r
+\r
+ if(context)\r
+ {\r
+ context->rotate(angle, x, y, z);\r
+ }\r
+ }\r
+ catch(std::bad_alloc&)\r
+ {\r
+ return error(GL_OUT_OF_MEMORY);\r
+ }\r
}\r
\r
void GL_APIENTRY glRotatex(GLfixed angle, GLfixed x, GLfixed y, GLfixed z)\r
\r
void GL_APIENTRY glScalef(GLfloat x, GLfloat y, GLfloat z)\r
{\r
- UNIMPLEMENTED();\r
+ TRACE("(GLfloat x = %f, GLfloat y = %f, GLfloat z = %f)", x, y, z);\r
+ \r
+ try\r
+ {\r
+ es1::Context *context = es1::getContext();\r
+\r
+ if(context)\r
+ {\r
+ context->scale(x, y, z);\r
+ }\r
+ }\r
+ catch(std::bad_alloc&)\r
+ {\r
+ return error(GL_OUT_OF_MEMORY);\r
+ }\r
}\r
\r
void GL_APIENTRY glScalex(GLfixed x, GLfixed y, GLfixed z)\r
\r
void GL_APIENTRY glTranslatef(GLfloat x, GLfloat y, GLfloat z)\r
{\r
- UNIMPLEMENTED();\r
+ TRACE("(GLfloat x = %f, GLfloat y = %f, GLfloat z = %f)", x, y, z);\r
+ \r
+ try\r
+ {\r
+ es1::Context *context = es1::getContext();\r
+\r
+ if(context)\r
+ {\r
+ context->translate(x, y, z);\r
+ }\r
+ }\r
+ catch(std::bad_alloc&)\r
+ {\r
+ return error(GL_OUT_OF_MEMORY);\r
+ }\r
}\r
\r
void GL_APIENTRY glTranslatex(GLfixed x, GLfixed y, GLfixed z)\r
<ClCompile Include="IndexDataManager.cpp" />\r
<ClCompile Include="libGLES_CM.cpp" />\r
<ClCompile Include="main.cpp" />\r
+ <ClCompile Include="MatrixStack.cpp" />\r
<ClCompile Include="RefCountObject.cpp" />\r
<ClCompile Include="Renderbuffer.cpp" />\r
<ClCompile Include="ResourceManager.cpp" />\r
<ClInclude Include="IndexDataManager.h" />\r
<ClInclude Include="main.h" />\r
<ClInclude Include="mathutil.h" />\r
+ <ClInclude Include="MatrixStack.hpp" />\r
<ClInclude Include="RefCountObject.h" />\r
<ClInclude Include="Renderbuffer.h" />\r
<ClInclude Include="resource.h" />\r
<ClCompile Include="libGLES_CM.cpp">\r
<Filter>Source Files</Filter>\r
</ClCompile>\r
+ <ClCompile Include="MatrixStack.cpp">\r
+ <Filter>Source Files</Filter>\r
+ </ClCompile>\r
</ItemGroup>\r
<ItemGroup>\r
<ClInclude Include="Buffer.h">\r
<ClInclude Include="..\include\GLES\glplatform.h">\r
<Filter>Header Files</Filter>\r
</ClInclude>\r
+ <ClInclude Include="MatrixStack.hpp">\r
+ <Filter>Header Files</Filter>\r
+ </ClInclude>\r
</ItemGroup>\r
<ItemGroup>\r
<ResourceCompile Include="libGLES_CM.rc" />\r