Home | History | Annotate | Download | only in GLES_CM
      1 /*
      2 * Copyright (C) 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 #ifndef GLES_CM_CONTEX_H
     17 #define GLES_CM_CONTEX_H
     18 
     19 #include <GLcommon/GLDispatch.h>
     20 #include <GLcommon/GLESpointer.h>
     21 #include <GLcommon/GLESbuffer.h>
     22 #include <GLcommon/GLEScontext.h>
     23 #include <map>
     24 #include <vector>
     25 #include <string>
     26 
     27 
     28 typedef std::map<GLfloat,std::vector<int> > PointSizeIndices;
     29 
     30 class GLEScmContext: public GLEScontext
     31 {
     32 public:
     33     void init();
     34     GLEScmContext();
     35 
     36     void setActiveTexture(GLenum tex);
     37     void  setClientActiveTexture(GLenum tex);
     38     GLenum  getActiveTexture() { return GL_TEXTURE0 + m_activeTexture;};
     39     GLenum  getClientActiveTexture() { return GL_TEXTURE0 + m_clientActiveTexture;};
     40     void setupArraysPointers(GLESConversionArrays& fArrs,GLint first,GLsizei count,GLenum type,const GLvoid* indices,bool direct);
     41     void drawPointsArrs(GLESConversionArrays& arrs,GLint first,GLsizei count);
     42     void drawPointsElems(GLESConversionArrays& arrs,GLsizei count,GLenum type,const GLvoid* indices);
     43     virtual const GLESpointer* getPointer(GLenum arrType);
     44     int  getMaxTexUnits();
     45 
     46     virtual bool glGetIntegerv(GLenum pname, GLint *params);
     47     virtual bool glGetBooleanv(GLenum pname, GLboolean *params);
     48     virtual bool glGetFloatv(GLenum pname, GLfloat *params);
     49     virtual bool glGetFixedv(GLenum pname, GLfixed *params);
     50 
     51     ~GLEScmContext();
     52 protected:
     53 
     54     bool needConvert(GLESConversionArrays& fArrs,GLint first,GLsizei count,GLenum type,const GLvoid* indices,bool direct,GLESpointer* p,GLenum array_id);
     55 private:
     56     void setupArrayPointerHelper(GLESConversionArrays& fArrs,GLint first,GLsizei count,GLenum type,const GLvoid* indices,bool direct,GLenum array_id,GLESpointer* p);
     57     void setupArr(const GLvoid* arr,GLenum arrayType,GLenum dataType,GLint size,GLsizei stride,GLboolean normalized, int pointsIndex = -1);
     58     void drawPoints(PointSizeIndices* points);
     59     void drawPointsData(GLESConversionArrays& arrs,GLint first,GLsizei count,GLenum type,const GLvoid* indices_in,bool isElemsDraw);
     60     void initExtensionString();
     61 
     62     GLESpointer*          m_texCoords;
     63     int                   m_pointsIndex;
     64     unsigned int          m_clientActiveTexture;
     65 };
     66 
     67 #endif
     68 
     69