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_POINTER_H 17 #define GLES_POINTER_H 18 19 #include <GLES/gl.h> 20 #include "GLESbuffer.h" 21 22 class GLESpointer 23 { 24 25 public: 26 GLESpointer(); 27 GLenum getType() const; 28 GLint getSize() const; 29 GLsizei getStride() const; 30 const GLvoid* getArrayData() const; 31 GLvoid* getBufferData() const; 32 GLuint getBufferName() const; getNormalized()33 GLboolean getNormalized() const { return m_normalize ? GL_TRUE : GL_FALSE; } 34 const GLvoid* getData() const; 35 unsigned int getBufferOffset() const; 36 void redirectPointerData(); 37 void getBufferConversions(const RangeList& rl,RangeList& rlOut); bufferNeedConversion()38 bool bufferNeedConversion(){ return !m_buffer->fullyConverted();} 39 void setArray (GLint size,GLenum type,GLsizei stride,const GLvoid* data,bool normalize = false); 40 void setBuffer(GLint size,GLenum type,GLsizei stride,GLESbuffer* buf,GLuint bufferName,int offset,bool normalize = false); 41 bool isEnable() const; 42 bool isNormalize() const; 43 bool isVBO() const; 44 void enable(bool b); 45 46 private: 47 GLint m_size; 48 GLenum m_type; 49 GLsizei m_stride; 50 bool m_enabled; 51 bool m_normalize; 52 const GLvoid* m_data; 53 GLESbuffer* m_buffer; 54 GLuint m_bufferName; 55 unsigned int m_buffOffset; 56 bool m_isVBO; 57 }; 58 #endif 59