author | Jon Medhurst |
Fri, 22 Oct 2010 13:37:16 +0100 | |
branch | bug235_bringup_0 |
changeset 64 | 5023b77b78d4 |
parent 53 | c2ef9095503a |
permissions | -rw-r--r-- |
53
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
1 |
/* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
2 |
* |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
3 |
* Permission is hereby granted, free of charge, to any person obtaining a |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
4 |
* copy of this software and /or associated documentation files |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
5 |
* (the "Materials "), to deal in the Materials without restriction, |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
6 |
* including without limitation the rights to use, copy, modify, merge, |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
7 |
* publish, distribute, sublicense, and/or sell copies of the Materials, |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
8 |
* and to permit persons to whom the Materials are furnished to do so, |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
9 |
* subject to the following conditions: |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
10 |
* |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
11 |
* The above copyright notice and this permission notice shall be included |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
12 |
* in all copies or substantial portions of the Materials. |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
13 |
* |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
14 |
* THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
15 |
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
16 |
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
17 |
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
18 |
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
19 |
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE MATERIALS OR |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
20 |
* THE USE OR OTHER DEALINGS IN THE MATERIALS. |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
21 |
* |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
22 |
* Initial Contributors: |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
23 |
* Nokia Corporation - initial contribution. |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
24 |
* |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
25 |
* Contributors: |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
26 |
* |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
27 |
* Description: |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
28 |
* |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
29 |
*/ |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
30 |
|
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
31 |
#include "GLESArray.h" |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
32 |
#include "glesInternal.h" |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
33 |
#include "GLESBuffer.h" |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
34 |
#include "GLESContext.h" |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
35 |
|
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
36 |
GLESArrayPointer::GLESArrayPointer() : |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
37 |
m_pointer(NULL), |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
38 |
m_stride(0), |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
39 |
m_size(4), |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
40 |
m_type(GL_FLOAT) |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
41 |
{ |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
42 |
} |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
43 |
|
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
44 |
GLESArrayPointer::GLESArrayPointer(const void* pointer, int stride, int size, GLenum type) : |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
45 |
m_pointer(static_cast<const char*>(pointer)), |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
46 |
m_stride(stride), |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
47 |
m_size(size), |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
48 |
m_type(type) |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
49 |
{ |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
50 |
} |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
51 |
|
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
52 |
GLESArray::GLESArray() : |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
53 |
m_size(4), |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
54 |
m_type(GL_FLOAT), |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
55 |
m_stride(0), |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
56 |
m_pointer(NULL), |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
57 |
m_ownsData(false), |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
58 |
m_buffer(NULL) |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
59 |
{ |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
60 |
} |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
61 |
|
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
62 |
GLESArray::GLESArray(int size, GLenum type, int stride, void* pointer, const GLESBuffer* buffer, bool ownsData) : |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
63 |
m_size(size), |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
64 |
m_type(type), |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
65 |
m_stride(stride), |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
66 |
m_pointer(pointer), |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
67 |
m_ownsData(ownsData), |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
68 |
m_buffer(buffer) |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
69 |
{ |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
70 |
} |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
71 |
|
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
72 |
GLESArray::~GLESArray() |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
73 |
{ |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
74 |
if(m_ownsData) |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
75 |
{ |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
76 |
delete[] m_pointer; |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
77 |
} |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
78 |
} |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
79 |
|
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
80 |
GLESArrayPointer GLESArray::ArrayPointer() const |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
81 |
{ |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
82 |
int stride; |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
83 |
if(m_stride) |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
84 |
{ |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
85 |
stride = m_stride; |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
86 |
} |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
87 |
else |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
88 |
{ |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
89 |
switch(m_type) |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
90 |
{ |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
91 |
case GL_BYTE: |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
92 |
stride = sizeof(GLbyte); |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
93 |
break; |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
94 |
case GL_SHORT: |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
95 |
stride = sizeof(GLshort); |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
96 |
break; |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
97 |
case GL_FLOAT: |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
98 |
stride = sizeof(GLfloat); |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
99 |
break; |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
100 |
case GL_UNSIGNED_BYTE: |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
101 |
stride = sizeof(GLubyte); |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
102 |
break; |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
103 |
default: |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
104 |
GLES_ASSERT(false); |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
105 |
} |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
106 |
} |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
107 |
return GLESArrayPointer(m_pointer, m_size * stride, m_size, m_type); |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
108 |
} |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
109 |
|
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
110 |
GLESArray* GLESArray::Convert(int count) const |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
111 |
{ |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
112 |
if(m_type == GL_BYTE) |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
113 |
{ |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
114 |
const char* oldPtr = NULL; |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
115 |
unsigned int size = m_size; |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
116 |
if(m_buffer) |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
117 |
{ |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
118 |
oldPtr = static_cast<const char*>(m_buffer->data); |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
119 |
size = GLES_MIN(m_buffer->size / sizeof(GLbyte), count * size); |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
120 |
} |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
121 |
else |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
122 |
{ |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
123 |
oldPtr = static_cast<const char*>(m_pointer); |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
124 |
} |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
125 |
|
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
126 |
GLshort* newArr = GLES_NEW GLshort[count * m_size]; |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
127 |
if(newArr == NULL) |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
128 |
{ |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
129 |
return NULL; |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
130 |
} |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
131 |
int stride = m_stride ? m_stride : sizeof(GLbyte); |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
132 |
for(unsigned int i = 0; i < count * size; i++) |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
133 |
{ |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
134 |
newArr[i] = *reinterpret_cast<const GLbyte*>(oldPtr); |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
135 |
oldPtr += stride; |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
136 |
} |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
137 |
return GLES_NEW GLESArray(size, GL_SHORT, 0, newArr, NULL, true); |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
138 |
} |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
139 |
else if(m_type == GL_FIXED) |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
140 |
{ |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
141 |
const char* oldPtr = NULL; |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
142 |
unsigned int size = m_size; |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
143 |
if(m_buffer) |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
144 |
{ |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
145 |
oldPtr = static_cast<const char*>(m_buffer->data); |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
146 |
size = GLES_MIN(m_buffer->size / sizeof(GLfixed), count * size); |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
147 |
} |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
148 |
else |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
149 |
{ |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
150 |
oldPtr = static_cast<const char*>(m_pointer); |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
151 |
} |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
152 |
|
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
153 |
GLfloat* newArr = GLES_NEW GLfloat[count * m_size]; |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
154 |
if(newArr == NULL) |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
155 |
{ |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
156 |
return NULL; |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
157 |
} |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
158 |
int stride = m_stride ? m_stride : sizeof(GLfixed); |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
159 |
for(unsigned int i = 0; i < count * size; i++) |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
160 |
{ |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
161 |
newArr[i] = X_TO_F(*reinterpret_cast<const GLfixed*>(oldPtr)); |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
162 |
oldPtr += stride; |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
163 |
} |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
164 |
return GLES_NEW GLESArray(size, GL_FLOAT, 0, newArr, NULL, true); |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
165 |
} |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
166 |
else |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
167 |
{ |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
168 |
return GLES_NEW GLESArray(m_size, m_type, m_stride, m_buffer ? m_buffer->data : m_pointer, NULL); |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
169 |
} |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
170 |
|
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
171 |
return NULL; |
c2ef9095503a
Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff
changeset
|
172 |
} |