Home | History | Annotate | Download | only in GLES_V2
      1 /*
      2 * Copyright 2011 The Android Open Source Project
      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 #ifndef GLES_V2_CONTEXT_H
     18 #define GLES_V2_CONTEXT_H
     19 
     20 #include <GLcommon/GLDispatch.h>
     21 #include <GLcommon/GLEScontext.h>
     22 #include <GLcommon/objectNameManager.h>
     23 
     24 
     25 
     26 class GLESv2Context : public GLEScontext{
     27 public:
     28     void init();
     29     GLESv2Context();
     30     virtual ~GLESv2Context();
     31     void setupArraysPointers(GLESConversionArrays& fArrs,GLint first,GLsizei count,GLenum type,const GLvoid* indices,bool direct);
     32     int  getMaxTexUnits();
     33 
     34     // This whole att0 thing is about a incompatibility between GLES and OpenGL.
     35     // GLES allows a vertex shader attribute to be in location 0 and have a
     36     // current value, while OpenGL is not very clear about this, which results
     37     // in each implementation doing something different.
     38     void setAttribute0value(float x, float y, float z, float w);
     39     void validateAtt0PreDraw(unsigned int count);
     40     void validateAtt0PostDraw(void);
     41     const float* getAtt0(void) {return m_attribute0value;}
     42 
     43 protected:
     44     bool needConvert(GLESConversionArrays& fArrs,GLint first,GLsizei count,GLenum type,const GLvoid* indices,bool direct,GLESpointer* p,GLenum array_id);
     45 private:
     46     void setupArr(const GLvoid* arr,GLenum arrayType,GLenum dataType,GLint size,GLsizei stride,GLboolean normalized, int pointsIndex = -1);
     47     void initExtensionString();
     48 
     49     float m_attribute0value[4];
     50     GLfloat* m_att0Array;
     51     unsigned int m_att0ArrayLength;
     52     bool m_att0NeedsDisable;
     53 };
     54 
     55 #endif
     56