Home | History | Annotate | Download | only in GLcommon
      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:
     26    GLESbuffer():ObjectData(BUFFER_DATA),m_size(0),m_usage(GL_STATIC_DRAW),m_data(NULL),m_wasBound(false){}
     27    GLuint getSize(){return m_size;};
     28    GLuint getUsage(){return m_usage;};
     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);
     33    bool  fullyConverted(){return m_conversionManager.size() == 0;};
     34    void  setBinded(){m_wasBound = true;};
     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