comparison src/video/SDL_renderer_gles.c @ 2949:4eabc35fbb4a

Modified OpenGL ES render driver to support new SDL_RenderFill, SDL_RenderLine, and SDL_RenderPoint.
author Holmes Futrell <hfutrell@umail.ucsb.edu>
date Thu, 01 Jan 2009 23:47:33 +0000
parents 017d4334accf
children 0faae272a372
comparison
equal deleted inserted replaced
2948:31f207e27452 2949:4eabc35fbb4a
630 data->glColor4f((GLfloat) renderer->r * inv255f, 630 data->glColor4f((GLfloat) renderer->r * inv255f,
631 (GLfloat) renderer->g * inv255f, 631 (GLfloat) renderer->g * inv255f,
632 (GLfloat) renderer->b * inv255f, 632 (GLfloat) renderer->b * inv255f,
633 (GLfloat) renderer->a * inv255f); 633 (GLfloat) renderer->a * inv255f);
634 634
635 /* FIXME: 635 GLshort vertices[2];
636 data->glBegin(GL_POINTS); 636 vertices[0] = x;
637 data->glVertex2i(x, y); 637 vertices[1] = y;
638 data->glEnd(); 638
639 */ 639 data->glVertexPointer(2, GL_SHORT, 0, vertices);
640 data->glEnableClientState(GL_VERTEX_ARRAY);
641 data->glDrawArrays(GL_POINTS, 0, 1);
642 data->glDisableClientState(GL_VERTEX_ARRAY);
643
640 return 0; 644 return 0;
641 } 645 }
642 646
643 static int 647 static int
644 GLES_RenderLine(SDL_Renderer * renderer, int x1, int y1, int x2, int y2) 648 GLES_RenderLine(SDL_Renderer * renderer, int x1, int y1, int x2, int y2)
650 data->glColor4f((GLfloat) renderer->r * inv255f, 654 data->glColor4f((GLfloat) renderer->r * inv255f,
651 (GLfloat) renderer->g * inv255f, 655 (GLfloat) renderer->g * inv255f,
652 (GLfloat) renderer->b * inv255f, 656 (GLfloat) renderer->b * inv255f,
653 (GLfloat) renderer->a * inv255f); 657 (GLfloat) renderer->a * inv255f);
654 658
655 /* FIXME: 659 GLshort vertices[4];
656 data->glBegin(GL_LINES); 660 vertices[0] = x1;
657 data->glVertex2i(x1, y1); 661 vertices[1] = y1;
658 data->glVertex2i(x2, y2); 662 vertices[2] = x2;
659 data->glEnd(); 663 vertices[3] = y2;
660 */ 664
665 data->glVertexPointer(2, GL_SHORT, 0, vertices);
666 data->glEnableClientState(GL_VERTEX_ARRAY);
667 data->glDrawArrays(GL_LINES, 0, 2);
668 data->glDisableClientState(GL_VERTEX_ARRAY);
669
661 return 0; 670 return 0;
662 } 671 }
663 672
664 static int 673 static int
665 GLES_RenderFill(SDL_Renderer * renderer, const SDL_Rect * rect) 674 GLES_RenderFill(SDL_Renderer * renderer, const SDL_Rect * rect)
671 data->glColor4f((GLfloat) renderer->r * inv255f, 680 data->glColor4f((GLfloat) renderer->r * inv255f,
672 (GLfloat) renderer->g * inv255f, 681 (GLfloat) renderer->g * inv255f,
673 (GLfloat) renderer->b * inv255f, 682 (GLfloat) renderer->b * inv255f,
674 (GLfloat) renderer->a * inv255f); 683 (GLfloat) renderer->a * inv255f);
675 684
676 /* FIXME: 685 GLshort minx = rect->x;
677 data->glRecti(rect->x, rect->y, rect->x + rect->w, rect->y + rect->h); 686 GLshort maxx = rect->x + rect->w;
678 */ 687 GLshort miny = rect->y;
688 GLshort maxy = rect->y + rect->h;
689
690 GLshort vertices[8];
691 vertices[0] = minx;
692 vertices[1] = miny;
693 vertices[2] = maxx;
694 vertices[3] = miny;
695 vertices[4] = minx;
696 vertices[5] = maxy;
697 vertices[6] = maxx;
698 vertices[7] = maxy;
699
700 data->glVertexPointer(2, GL_SHORT, 0, vertices);
701 data->glEnableClientState(GL_VERTEX_ARRAY);
702 data->glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
703 data->glDisableClientState(GL_VERTEX_ARRAY);
704
679 return 0; 705 return 0;
680 } 706 }
681 707
682 static int 708 static int
683 GLES_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture, 709 GLES_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture,