reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 1 | /* |
| 2 | Copyright 2010 Google Inc. |
| 3 | |
| 4 | Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | you may not use this file except in compliance with the License. |
| 6 | You may obtain a copy of the License at |
| 7 | |
| 8 | http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | |
| 10 | Unless required by applicable law or agreed to in writing, software |
| 11 | distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | See the License for the specific language governing permissions and |
| 14 | limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | |
| 18 | #ifndef GrGpuGLFixed_DEFINED |
| 19 | #define GrGpuGLFixed_DEFINED |
| 20 | |
| 21 | #include "GrGpuGL.h" |
| 22 | |
| 23 | // Fixed Pipeline OpenGL or OpenGL ES 1.x |
| 24 | class GrGpuGLFixed : public GrGpuGL { |
| 25 | public: |
| 26 | GrGpuGLFixed(); |
| 27 | virtual ~GrGpuGLFixed(); |
bsalomon@google.com | 1c13c96 | 2011-02-14 16:51:21 +0000 | [diff] [blame^] | 28 | |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 29 | virtual void resetContext(); |
| 30 | |
| 31 | protected: |
| 32 | // overrides from GrGpu |
| 33 | virtual bool flushGraphicsState(PrimitiveType type); |
bsalomon@google.com | 1c13c96 | 2011-02-14 16:51:21 +0000 | [diff] [blame^] | 34 | virtual void setupGeometry(int* startVertex, |
| 35 | int* startIndex, |
| 36 | int vertexCount, |
| 37 | int indexCount); |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 38 | |
| 39 | private: |
| 40 | void resetContextHelper(); |
| 41 | |
| 42 | // when the texture is GL_RGBA we set the GL_COMBINE texture |
bsalomon@google.com | 8531c1c | 2011-01-13 19:52:45 +0000 | [diff] [blame] | 43 | // environment rgb operand 0 to be GL_COLOR to modulate each incoming |
bsalomon@google.com | 1c13c96 | 2011-02-14 16:51:21 +0000 | [diff] [blame^] | 44 | // R,G, & B by the texture's R, G, & B. When the texture is alpha-only we |
| 45 | // set the operand to GL_ALPHA so that the incoming frag's R, G, &B are all |
bsalomon@google.com | 8531c1c | 2011-01-13 19:52:45 +0000 | [diff] [blame] | 46 | // modulated by the texture's A. |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 47 | enum TextureEnvRGBOperands { |
| 48 | kAlpha_TextureEnvRGBOperand, |
| 49 | kColor_TextureEnvRGBOperand, |
| 50 | }; |
bsalomon@google.com | 8531c1c | 2011-01-13 19:52:45 +0000 | [diff] [blame] | 51 | TextureEnvRGBOperands fHWRGBOperand0[kNumStages]; |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 52 | |
| 53 | void flushProjectionMatrix(); |
| 54 | |
| 55 | // are the currently bound vertex buffers/arrays laid |
| 56 | // out for text or other drawing. |
| 57 | bool fTextVerts; |
| 58 | |
| 59 | // On GL we have to build the base vertex offset into the |
| 60 | // glVertexPointer/glTexCoordPointer/etc |
| 61 | int fBaseVertex; |
| 62 | |
| 63 | GrGLTexture::Orientation fHWTextureOrientation; |
| 64 | |
| 65 | typedef GrGpuGL INHERITED; |
| 66 | }; |
| 67 | |
| 68 | #endif |