src/video/SDL_renderer_gles.c
changeset 3547 8b18669c2663
parent 3536 0267b8b1595c
child 3641 1e2e19d51265
     1.1 --- a/src/video/SDL_renderer_gles.c	Sat Dec 12 00:08:45 2009 +0000
     1.2 +++ b/src/video/SDL_renderer_gles.c	Sat Dec 12 00:55:13 2009 +0000
     1.3 @@ -646,6 +646,8 @@
     1.4  GLES_RenderPoints(SDL_Renderer * renderer, const SDL_Point * points, int count)
     1.5  {
     1.6      GLES_RenderData *data = (GLES_RenderData *) renderer->driverdata;
     1.7 +    int i;
     1.8 +    GLshort *vertices;
     1.9  
    1.10      GLES_SetBlendMode(data, renderer->blendMode, 1);
    1.11  
    1.12 @@ -654,10 +656,16 @@
    1.13                      (GLfloat) renderer->b * inv255f,
    1.14                      (GLfloat) renderer->a * inv255f);
    1.15  
    1.16 -    data->glVertexPointer(2, GL_INT, 0, points);
    1.17 +    vertices = SDL_stack_alloc(GLshort, count*2);
    1.18 +    for (i = 0; i < count; ++i) {
    1.19 +        vertices[2*i+0] = (GLshort)points[i].x;
    1.20 +        vertices[2*i+1] = (GLshort)points[i].y;
    1.21 +    }
    1.22 +    data->glVertexPointer(2, GL_SHORT, 0, vertices);
    1.23      data->glEnableClientState(GL_VERTEX_ARRAY);
    1.24      data->glDrawArrays(GL_POINTS, 0, count);
    1.25      data->glDisableClientState(GL_VERTEX_ARRAY);
    1.26 +    SDL_stack_free(vertices);
    1.27  
    1.28      return 0;
    1.29  }
    1.30 @@ -666,6 +674,8 @@
    1.31  GLES_RenderLines(SDL_Renderer * renderer, const SDL_Point * points, int count)
    1.32  {
    1.33      GLES_RenderData *data = (GLES_RenderData *) renderer->driverdata;
    1.34 +    int i;
    1.35 +    GLshort *vertices;
    1.36  
    1.37      GLES_SetBlendMode(data, renderer->blendMode, 1);
    1.38  
    1.39 @@ -674,7 +684,12 @@
    1.40                      (GLfloat) renderer->b * inv255f,
    1.41                      (GLfloat) renderer->a * inv255f);
    1.42  
    1.43 -    data->glVertexPointer(2, GL_INT, 0, points);
    1.44 +    vertices = SDL_stack_alloc(GLshort, count*2);
    1.45 +    for (i = 0; i < count; ++i) {
    1.46 +        vertices[2*i+0] = (GLshort)points[i].x;
    1.47 +        vertices[2*i+1] = (GLshort)points[i].y;
    1.48 +    }
    1.49 +    data->glVertexPointer(2, GL_SHORT, 0, vertices);
    1.50      data->glEnableClientState(GL_VERTEX_ARRAY);
    1.51      if (count > 2 && 
    1.52          points[0].x == points[count-1].x && points[0].y == points[count-1].y) {
    1.53 @@ -685,6 +700,7 @@
    1.54          data->glDrawArrays(GL_LINE_STRIP, 0, count);
    1.55      }
    1.56      data->glDisableClientState(GL_VERTEX_ARRAY);
    1.57 +    SDL_stack_free(vertices);
    1.58  
    1.59      return 0;
    1.60  }