blob: 85db830e337193aa4ee36f9327d829c3ffe93f94 [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
bsalomon@google.com8531c1c2011-01-13 19:52:45 +000043 // environment rgb operand 0 to be GL_COLOR to modulate each incoming
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
46 // modulated by the texture's A.
reed@google.comac10a2d2010-12-22 21:39:39 +000047 enum TextureEnvRGBOperands {
48 kAlpha_TextureEnvRGBOperand,
49 kColor_TextureEnvRGBOperand,
50 };
bsalomon@google.com8531c1c2011-01-13 19:52:45 +000051 TextureEnvRGBOperands fHWRGBOperand0[kNumStages];
reed@google.comac10a2d2010-12-22 21:39:39 +000052
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