blob: f3a033234c275ad0b80fbb13dfe13a67c2fc27a3 [file] [log] [blame]
reed@google.comac10a2d2010-12-22 21:39:39 +00001/*
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
24class GrGpuGLFixed : public GrGpuGL {
25public:
26 GrGpuGLFixed();
27 virtual ~GrGpuGLFixed();
28
29 virtual void resetContext();
30
31protected:
32 // overrides from GrGpu
33 virtual bool flushGraphicsState(PrimitiveType type);
34 virtual void setupGeometry(uint32_t startVertex,
35 uint32_t startIndex,
36 uint32_t vertexCount,
37 uint32_t indexCount);
38
39private:
40 void resetContextHelper();
41
42 // when the texture is GL_RGBA we set the GL_COMBINE texture
43 // environment rgb operand 0 to be GL_COLOR to modulate each incoming frag's
44 // RGB by the texture's RGB. When the texture is GL_ALPHA we set
45 // the operand to GL_ALPHA so that the incoming frag's RGB is modulated
46 // by the texture's alpha.
47 enum TextureEnvRGBOperands {
48 kAlpha_TextureEnvRGBOperand,
49 kColor_TextureEnvRGBOperand,
50 };
51 TextureEnvRGBOperands fHWRGBOperand0;
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