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_BUFFER_H 17 #define GLES_BUFFER_H 18 19 #include <stdio.h> 20 #include <GLES/gl.h> 21 #include <GLcommon/objectNameManager.h> 22 #include <GLcommon/RangeManip.h> 23 24 class GLESbuffer: public ObjectData { 25 public: GLESbuffer()26 GLESbuffer():ObjectData(BUFFER_DATA),m_size(0),m_usage(GL_STATIC_DRAW),m_data(NULL),m_wasBound(false){} getSize()27 GLuint getSize(){return m_size;}; getUsage()28 GLuint getUsage(){return m_usage;}; getData()29 GLvoid* getData(){ return m_data;} 30 bool setBuffer(GLuint size,GLuint usage,const GLvoid* data); 31 bool setSubBuffer(GLint offset,GLuint size,const GLvoid* data); 32 void getConversions(const RangeList& rIn,RangeList& rOut); fullyConverted()33 bool fullyConverted(){return m_conversionManager.size() == 0;}; setBinded()34 void setBinded(){m_wasBound = true;}; wasBinded()35 bool wasBinded(){return m_wasBound;}; 36 ~GLESbuffer(); 37 38 private: 39 GLuint m_size; 40 GLuint m_usage; 41 unsigned char* m_data; 42 RangeList m_conversionManager; 43 bool m_wasBound; 44 }; 45 46 typedef SmartPtr<GLESbuffer> GLESbufferPtr; 47 #endif 48