author | Faisal Memon <faisal.memon@nokia.com> |
Fri, 24 Sep 2010 13:15:40 +0100 | |
branch | bug235_bringup_0 |
changeset 42 | 2865e884ac3b |
parent 24 | a3f46bb01be2 |
permissions | -rw-r--r-- |
24 | 1 |
/* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). |
2 |
* |
|
3 |
* Permission is hereby granted, free of charge, to any person obtaining a |
|
4 |
* copy of this software and /or associated documentation files |
|
5 |
* (the "Materials "), to deal in the Materials without restriction, |
|
6 |
* including without limitation the rights to use, copy, modify, merge, |
|
7 |
* publish, distribute, sublicense, and/or sell copies of the Materials, |
|
8 |
* and to permit persons to whom the Materials are furnished to do so, |
|
9 |
* subject to the following conditions: |
|
10 |
* |
|
11 |
* The above copyright notice and this permission notice shall be included |
|
12 |
* in all copies or substantial portions of the Materials. |
|
13 |
* |
|
14 |
* THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
|
15 |
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
|
16 |
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
|
17 |
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, |
|
18 |
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR |
|
19 |
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE MATERIALS OR |
|
20 |
* THE USE OR OTHER DEALINGS IN THE MATERIALS. |
|
21 |
* |
|
22 |
* Initial Contributors: |
|
23 |
* Nokia Corporation - initial contribution. |
|
24 |
* |
|
25 |
* Contributors: |
|
26 |
* |
|
27 |
* Description: |
|
28 |
* |
|
29 |
*/ |
|
30 |
||
31 |
#ifndef _GLESARRAY_H_ |
|
32 |
#define _GLESARRAY_H_ |
|
33 |
||
34 |
#include <GLES/gl.h> |
|
35 |
#include <cstddef> |
|
36 |
#include "GLESBuffer.h" |
|
37 |
||
38 |
class GLESArrayPointer |
|
39 |
{ |
|
40 |
public: |
|
41 |
GLESArrayPointer(); |
|
42 |
GLESArrayPointer(const void* pointer, int stride, int size, GLenum type); |
|
43 |
||
44 |
int Size() { return m_size; } |
|
45 |
GLenum Type() { return m_type; } |
|
46 |
||
47 |
bool operator!=(void* pointer) { return m_pointer != pointer; } |
|
48 |
GLESArrayPointer& operator+=(int step) { m_pointer += step * m_stride; return *this; } |
|
49 |
const void* operator[](int i) { return m_pointer + i * m_stride; } |
|
50 |
||
51 |
private: |
|
52 |
const char* m_pointer; |
|
53 |
int m_stride; |
|
54 |
int m_size; |
|
55 |
GLenum m_type; |
|
56 |
}; |
|
57 |
||
58 |
class GLESArray |
|
59 |
{ |
|
60 |
public: |
|
61 |
GLESArray(); |
|
62 |
GLESArray(int size, GLenum type, int stride, void* pointer, const GLESBuffer* buffer, bool ownsData=false); |
|
63 |
~GLESArray(); |
|
64 |
||
65 |
int Size() const { return m_size; } |
|
66 |
GLenum Type() const { return m_type; } |
|
67 |
int Stride() const { return m_stride; } |
|
68 |
const void* Pointer() const { return m_pointer; } |
|
69 |
GLESArrayPointer ArrayPointer() const; |
|
70 |
const GLESBuffer* Buffer() const { return m_buffer; } |
|
71 |
unsigned int BufferName() const { return m_buffer ? m_buffer->name : 0; } |
|
72 |
const void* BufferPointer() const { return m_buffer ? m_buffer->data : NULL; } |
|
73 |
||
74 |
GLESArray* Convert(int count) const; |
|
75 |
||
76 |
void ReleaseBuffer() { m_buffer = NULL; } |
|
77 |
||
78 |
private: |
|
79 |
int m_size; |
|
80 |
GLenum m_type; |
|
81 |
int m_stride; |
|
82 |
void* m_pointer; |
|
83 |
bool m_ownsData; |
|
84 |
const GLESBuffer* m_buffer; |
|
85 |
}; |
|
86 |
||
20
d2d6724aef32
Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
87 |
#endif // _GLESARRAY_H_ |