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