* commit '78d910ac22d2f2f226936a7b589fc7708a54bb48': 1.1 Translator: fix drawing of GL_POINT_SIZE_ARRAY
This commit is contained in:
@@ -136,31 +136,6 @@ void GLEScmContext::setupArraysPointers(GLESConversionArrays& cArrs,GLint first,
|
|||||||
s_glDispatch.glClientActiveTexture(activeTexture);
|
s_glDispatch.glClientActiveTexture(activeTexture);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLEScmContext::drawPoints(PointSizeIndices* points) {
|
|
||||||
|
|
||||||
GLushort* indices = NULL;
|
|
||||||
int last_size = 0;
|
|
||||||
|
|
||||||
//drawing each group of vertices by the points size
|
|
||||||
for(PointSizeIndices::iterator it = points->begin();it != points->end(); it++) {
|
|
||||||
int count = (*it).second.size();
|
|
||||||
int pointSize = (*it).first;
|
|
||||||
std::vector<int>& arr = (*it).second;
|
|
||||||
|
|
||||||
if(count > last_size) {
|
|
||||||
if(indices) delete [] indices;
|
|
||||||
indices = new GLushort[count];
|
|
||||||
}
|
|
||||||
int i = 0 ;
|
|
||||||
for(std::vector<int>::iterator it2 = arr.begin();it2 != arr.end();it2++) {
|
|
||||||
indices[i++] = (*it2);
|
|
||||||
}
|
|
||||||
s_glDispatch.glPointSize(pointSize);
|
|
||||||
s_glDispatch.glDrawElements(GL_POINTS,count,GL_UNSIGNED_SHORT,indices);
|
|
||||||
}
|
|
||||||
if(indices) delete [] indices;
|
|
||||||
}
|
|
||||||
|
|
||||||
void GLEScmContext::drawPointsData(GLESConversionArrays& cArrs,GLint first,GLsizei count,GLenum type,const GLvoid* indices_in,bool isElemsDraw) {
|
void GLEScmContext::drawPointsData(GLESConversionArrays& cArrs,GLint first,GLsizei count,GLenum type,const GLvoid* indices_in,bool isElemsDraw) {
|
||||||
const char *pointsArr = NULL;
|
const char *pointsArr = NULL;
|
||||||
int stride = 0;
|
int stride = 0;
|
||||||
@@ -179,23 +154,52 @@ void GLEScmContext::drawPointsData(GLESConversionArrays& cArrs,GLint first,GLsi
|
|||||||
stride = sizeof(GLfloat);
|
stride = sizeof(GLfloat);
|
||||||
}
|
}
|
||||||
|
|
||||||
//filling arrays before sorting them
|
|
||||||
PointSizeIndices points;
|
|
||||||
if(isElemsDraw) {
|
if(isElemsDraw) {
|
||||||
for(int i=0; i< count; i++) {
|
int tSize = type == GL_UNSIGNED_SHORT ? 2 : 1;
|
||||||
GLushort index = (type == GL_UNSIGNED_SHORT?
|
|
||||||
static_cast<const GLushort*>(indices_in)[i]:
|
int i = 0;
|
||||||
static_cast<const GLubyte*>(indices_in)[i]);
|
while(i<count)
|
||||||
GLfloat pSize = *((GLfloat*)(pointsArr+(index*stride)));
|
{
|
||||||
points[pSize].push_back(index);
|
int sStart = i;
|
||||||
|
int sCount = 1;
|
||||||
|
|
||||||
|
#define INDEX \
|
||||||
|
(type == GL_UNSIGNED_SHORT ? \
|
||||||
|
static_cast<const GLushort*>(indices_in)[i]: \
|
||||||
|
static_cast<const GLubyte*>(indices_in)[i])
|
||||||
|
|
||||||
|
GLfloat pSize = *((GLfloat*)(pointsArr+(INDEX*stride)));
|
||||||
|
i++;
|
||||||
|
|
||||||
|
while(i < count && pSize == *((GLfloat*)(pointsArr+(INDEX*stride))))
|
||||||
|
{
|
||||||
|
sCount++;
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
s_glDispatch.glPointSize(pSize);
|
||||||
|
s_glDispatch.glDrawElements(GL_POINTS, sCount, type, (char*)indices_in+sStart*tSize);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for(int i=0; i< count; i++) {
|
int i = 0;
|
||||||
GLfloat pSize = *((GLfloat*)(pointsArr+(first+i*stride)));
|
while(i<count)
|
||||||
points[pSize].push_back(i+first);
|
{
|
||||||
|
int sStart = i;
|
||||||
|
int sCount = 1;
|
||||||
|
GLfloat pSize = *((GLfloat*)(pointsArr+((first+i)*stride)));
|
||||||
|
i++;
|
||||||
|
|
||||||
|
while(i < count && pSize == *((GLfloat*)(pointsArr+((first+i)*stride))))
|
||||||
|
{
|
||||||
|
sCount++;
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
s_glDispatch.glPointSize(pSize);
|
||||||
|
s_glDispatch.glDrawArrays(GL_POINTS, first+sStart, sCount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
drawPoints(&points);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLEScmContext::drawPointsArrs(GLESConversionArrays& arrs,GLint first,GLsizei count) {
|
void GLEScmContext::drawPointsArrs(GLESConversionArrays& arrs,GLint first,GLsizei count) {
|
||||||
|
|||||||
@@ -555,12 +555,13 @@ GL_API void GL_APIENTRY glDrawArrays( GLenum mode, GLint first, GLsizei count)
|
|||||||
|
|
||||||
GLESConversionArrays tmpArrs;
|
GLESConversionArrays tmpArrs;
|
||||||
ctx->setupArraysPointers(tmpArrs,first,count,0,NULL,true);
|
ctx->setupArraysPointers(tmpArrs,first,count,0,NULL,true);
|
||||||
if(mode != GL_POINTS || !ctx->isArrEnabled(GL_POINT_SIZE_ARRAY_OES)){
|
if(mode == GL_POINTS && ctx->isArrEnabled(GL_POINT_SIZE_ARRAY_OES)){
|
||||||
ctx->dispatcher().glDrawArrays(mode,first,count);
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
ctx->drawPointsArrs(tmpArrs,first,count);
|
ctx->drawPointsArrs(tmpArrs,first,count);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ctx->dispatcher().glDrawArrays(mode,first,count);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GL_API void GL_APIENTRY glDrawElements( GLenum mode, GLsizei count, GLenum type, const GLvoid *elementsIndices) {
|
GL_API void GL_APIENTRY glDrawElements( GLenum mode, GLsizei count, GLenum type, const GLvoid *elementsIndices) {
|
||||||
@@ -577,11 +578,11 @@ GL_API void GL_APIENTRY glDrawElements( GLenum mode, GLsizei count, GLenum type
|
|||||||
}
|
}
|
||||||
|
|
||||||
ctx->setupArraysPointers(tmpArrs,0,count,type,indices,false);
|
ctx->setupArraysPointers(tmpArrs,0,count,type,indices,false);
|
||||||
if(mode != GL_POINTS || !ctx->isArrEnabled(GL_POINT_SIZE_ARRAY_OES)){
|
if(mode == GL_POINTS && ctx->isArrEnabled(GL_POINT_SIZE_ARRAY_OES)){
|
||||||
ctx->dispatcher().glDrawElements(mode,count,type,indices);
|
ctx->drawPointsElems(tmpArrs,count,type,indices);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
ctx->drawPointsElems(tmpArrs,count,type,indices);
|
ctx->dispatcher().glDrawElements(mode,count,type,indices);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user