markAllStateDirty();\r
\r
matrixMode = GL_MODELVIEW;\r
+ texture2D = false;\r
}\r
\r
Context::~Context()\r
\r
for(int type = 0; type < TEXTURE_TYPE_COUNT; type++)\r
{\r
- for(int sampler = 0; sampler < MAX_TEXTURE_IMAGE_UNITS; sampler++)\r
+ for(int sampler = 0; sampler < MAX_TEXTURE_UNITS; sampler++)\r
{\r
mState.samplerTexture[type][sampler].set(NULL);\r
}\r
light[index].attenuation.quadratic = quadratic;\r
}\r
\r
+void Context::setTexture2D(bool enable)\r
+{\r
+ texture2D = enable;\r
+}\r
+\r
void Context::setLineWidth(GLfloat width)\r
{\r
mState.lineWidth = width;\r
break;\r
case GL_TEXTURE_BINDING_2D:\r
{\r
- if(mState.activeSampler < 0 || mState.activeSampler > MAX_TEXTURE_IMAGE_UNITS - 1)\r
+ if(mState.activeSampler < 0 || mState.activeSampler > MAX_TEXTURE_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_TEXTURE_IMAGE_UNITS - 1)\r
+ if(mState.activeSampler < 0 || mState.activeSampler > MAX_TEXTURE_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_TEXTURE_IMAGE_UNITS - 1)\r
+ if(mState.activeSampler < 0 || mState.activeSampler > MAX_TEXTURE_UNITS - 1)\r
{\r
error(GL_INVALID_OPERATION);\r
return false;\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
+ case GL_MAX_TEXTURE_UNITS: *params = MAX_TEXTURE_UNITS; 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
case GL_MAX_MODELVIEW_STACK_DEPTH:\r
case GL_MAX_PROJECTION_STACK_DEPTH:\r
case GL_MAX_TEXTURE_STACK_DEPTH:\r
+ case GL_MAX_TEXTURE_UNITS:\r
return 1;\r
default:\r
UNREACHABLE();\r
case GL_MAX_MODELVIEW_STACK_DEPTH:\r
case GL_MAX_PROJECTION_STACK_DEPTH:\r
case GL_MAX_TEXTURE_STACK_DEPTH:\r
+ case GL_MAX_TEXTURE_UNITS:\r
return true;\r
default:\r
ASSERT(isQueryParameterFloat(pname) || isQueryParameterBool(pname));\r
\r
void Context::applyTextures()\r
{\r
- for(int samplerIndex = 0; samplerIndex < MAX_TEXTURE_IMAGE_UNITS; samplerIndex++)\r
+ for(int samplerIndex = 0; samplerIndex < MAX_TEXTURE_UNITS; samplerIndex++)\r
{\r
UNIMPLEMENTED();\r
TextureType textureType = TEXTURE_2D;\r
\r
for(int type = 0; type < TEXTURE_TYPE_COUNT; type++)\r
{\r
- for(int sampler = 0; sampler < MAX_TEXTURE_IMAGE_UNITS; sampler++)\r
+ for(int sampler = 0; sampler < MAX_TEXTURE_UNITS; sampler++)\r
{\r
if(mState.samplerTexture[type][sampler].id() == texture)\r
{\r
{\r
MAX_VERTEX_ATTRIBS = 16,\r
MAX_VARYING_VECTORS = 10,\r
- MAX_TEXTURE_IMAGE_UNITS = 16,\r
+ MAX_TEXTURE_UNITS = 2,\r
MAX_DRAW_BUFFERS = 1,\r
MAX_LIGHTS = 8,\r
\r
BindingPointer<Renderbuffer> renderbuffer;\r
\r
VertexAttribute vertexAttribute[MAX_VERTEX_ATTRIBS];\r
- BindingPointer<Texture> samplerTexture[TEXTURE_TYPE_COUNT][MAX_TEXTURE_IMAGE_UNITS];\r
+ BindingPointer<Texture> samplerTexture[TEXTURE_TYPE_COUNT][MAX_TEXTURE_UNITS];\r
\r
GLint unpackAlignment;\r
GLint packAlignment;\r
void setLightAttenuationLinear(int index, float linear);\r
void setLightAttenuationQuadratic(int index, float quadratic);\r
\r
+ void setTexture2D(bool enabled);\r
+\r
void setLineWidth(GLfloat width);\r
\r
void setGenerateMipmapHint(GLenum hint);\r
sw::MatrixStack textureStack0;\r
sw::MatrixStack textureStack1;\r
\r
+ bool texture2D;\r
+\r
ResourceManager *mResourceManager;\r
\r
static Device *device;\r
\r
if(context)\r
{\r
- if(texture < GL_TEXTURE0 || texture > GL_TEXTURE0 + es1::MAX_TEXTURE_IMAGE_UNITS - 1)\r
+ if(texture < GL_TEXTURE0 || texture > GL_TEXTURE0 + es1::MAX_TEXTURE_UNITS - 1)\r
{\r
return error(GL_INVALID_ENUM);\r
}\r
case GL_LIGHT6: context->setLight(6, false); break;\r
case GL_LIGHT7: context->setLight(7, false); break;\r
case GL_FOG: UNIMPLEMENTED(); break;\r
- case GL_TEXTURE_2D: UNIMPLEMENTED(); break;\r
+ case GL_TEXTURE_2D: context->setTexture2D(false); break;\r
case GL_ALPHA_TEST: UNIMPLEMENTED(); break;\r
case GL_COLOR_LOGIC_OP: UNIMPLEMENTED(); break;\r
case GL_POINT_SMOOTH: UNIMPLEMENTED(); break;\r
case GL_LIGHT6: context->setLight(6, true); break;\r
case GL_LIGHT7: context->setLight(7, true); break;\r
case GL_FOG: UNIMPLEMENTED(); break;\r
- case GL_TEXTURE_2D: UNIMPLEMENTED(); break;\r
+ case GL_TEXTURE_2D: context->setTexture2D(true); break;\r
case GL_ALPHA_TEST: UNIMPLEMENTED(); break;\r
case GL_COLOR_LOGIC_OP: UNIMPLEMENTED(); break;\r
case GL_POINT_SMOOTH: UNIMPLEMENTED(); break;\r