Changeset 26 for trunk/Classes/SDL/src/video/SDL_renderer_gles.c
- Timestamp:
- 2010-05-28 07:39:52 (2 years ago)
- File:
-
- 1 edited
-
trunk/Classes/SDL/src/video/SDL_renderer_gles.c (modified) (14 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Classes/SDL/src/video/SDL_renderer_gles.c
r19 r26 33 33 // KP: render queue and automatic z-order support 34 34 #include "RenderQueue.h" 35 36 extern unsigned char gFlippedGL; 37 extern unsigned char gInitializedGL; 38 39 unsigned char gInitializedGL = 0; 35 40 36 41 #if defined(__QNXNTO__) … … 343 348 */ 344 349 350 glClearDepthf(1.0f); 351 345 352 data->glDisable(GL_CULL_FACE); 346 353 data->updateSize = SDL_TRUE; … … 358 365 data->glEnableClientState(GL_TEXTURE_COORD_ARRAY); 359 366 glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST); 360 data->glClearColor(0.0f,0.0f,0.5f,1.0f); 367 data->glClearColor(0.0f,0.0f,0.0f,1.0f); 368 glClearStencil(0); 361 369 362 370 // KP: multitexture support used for effects like greyscale … … 368 376 GLuint texID; 369 377 glGenTextures(1, &texID); 370 glBindTexture(GL_TEXTURE_2D, texID); 378 //glBindTexture(GL_TEXTURE_2D, texID); 379 cacheBindTexture(GL_TEXTURE_2D, texID, 1); 371 380 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); 372 381 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); … … 396 405 glMatrixMode(GL_MODELVIEW); 397 406 glLoadIdentity(); 407 #ifdef __IPAD__ 408 glViewport(0, 0, 768, 1024); 409 if (gFlippedGL) 410 glRotatef(90, 0, 0, 1); 411 else 412 glRotatef(-90, 0, 0, 1); 413 glOrthof(0.0, (GLfloat) 1024, (GLfloat) 768, 0.0, 0, 100.0f); 414 #else 398 415 glViewport(0, 0, 320, 480); 399 glRotatef(-90, 0, 0, 1); 400 glOrthof(0.0, (GLfloat) 480, (GLfloat) 320, 0.0, 400, -400); 401 416 if (gFlippedGL) 417 glRotatef(90, 0, 0, 1); 418 else 419 glRotatef(-90, 0, 0, 1); 420 glOrthof(0.0, (GLfloat) 480, (GLfloat) 320, 0.0, 0, 100.0f); 421 #endif 402 422 #else 403 423 data->glMatrixMode(GL_PROJECTION); … … 411 431 data->updateSize = SDL_FALSE; 412 432 } 433 434 gInitializedGL = 1; 413 435 return 0; 414 436 } … … 631 653 GLenum result; 632 654 633 renderdata->glGetError();655 // renderdata->glGetError(); 634 656 // renderdata->glEnable(data->type); 635 657 SetupTextureUpdate(renderdata, texture, pitch); … … 638 660 pixels); 639 661 // renderdata->glDisable(data->type); 662 663 #ifndef NDEBUG 640 664 result = renderdata->glGetError(); 641 665 if (result != GL_NO_ERROR) { … … 643 667 return -1; 644 668 } 669 #endif 645 670 return 0; 646 671 } … … 720 745 GLES_SetBlendMode(data, renderer->blendMode); 721 746 722 data->glColor4f((GLfloat) renderer->r * inv255f,747 cacheColor4f((GLfloat) renderer->r * inv255f, 723 748 (GLfloat) renderer->g * inv255f, 724 749 (GLfloat) renderer->b * inv255f, … … 746 771 GLES_SetBlendMode(data, renderer->blendMode); 747 772 748 data->glColor4f((GLfloat) renderer->r * inv255f,773 cacheColor4f((GLfloat) renderer->r * inv255f, 749 774 (GLfloat) renderer->g * inv255f, 750 775 (GLfloat) renderer->b * inv255f, … … 797 822 GLshort maxy = rect->y + rect->h; 798 823 799 GLshort vertices[ 8];824 GLshort vertices[12]; 800 825 vertices[0] = minx; 801 826 vertices[1] = miny; 802 vertices[2] = maxx;803 vertices[3] = m iny;804 vertices[4] = min x;805 vertices[5] = maxy;806 vertices[6] = m axx;827 vertices[2] = 0; 828 vertices[3] = maxx; 829 vertices[4] = miny; 830 vertices[5] = 0; 831 vertices[6] = minx; 807 832 vertices[7] = maxy; 833 vertices[8] = 0; 834 vertices[9] = maxx; 835 vertices[10] = maxy; 836 vertices[11] = 0; 808 837 /* 809 838 data->glVertexPointer(3, GL_SHORT, 0, vertices); … … 964 993 maxv *= texturedata->texh; 965 994 966 GLshort vertices[ 8];995 GLshort vertices[12]; 967 996 GLfloat texCoords[8]; 968 997 969 998 vertices[0] = minx; 970 999 vertices[1] = miny; 971 vertices[2] = maxx;972 vertices[3] = m iny;973 vertices[4] = min x;974 vertices[5] = maxy;975 vertices[6] = m axx;1000 vertices[2] = 0; 1001 vertices[3] = maxx; 1002 vertices[4] = miny; 1003 vertices[5] = 0; 1004 vertices[6] = minx; 976 1005 vertices[7] = maxy; 1006 vertices[8] = 0; 1007 vertices[9] = maxx; 1008 vertices[10] = maxy; 1009 vertices[11] = 0; 977 1010 978 1011 texCoords[0] = minu; … … 1030 1063 // KP: clear the buffer after rendering 1031 1064 //GLES_RenderData *data = (GLES_RenderData *) renderer->driverdata; 1032 glClear( /*GL_COLOR_BUFFER_BIT |*/ GL_DEPTH_BUFFER_BIT ); 1065 // glClear( /*GL_COLOR_BUFFER_BIT |*/ GL_DEPTH_BUFFER_BIT ); 1066 glClear(GL_DEPTH_BUFFER_BIT); 1033 1067 } 1034 1068
Note: See TracChangeset
for help on using the changeset viewer.