702 SDL_GL_SetAttribute(SDL_GL_BUFFER_SIZE, 16); // buffer should be 16 |
702 SDL_GL_SetAttribute(SDL_GL_BUFFER_SIZE, 16); // buffer should be 16 |
703 SDL_GL_SetAttribute(SDL_GL_ACCELERATED_VISUAL, 1); // prefer hw rendering |
703 SDL_GL_SetAttribute(SDL_GL_ACCELERATED_VISUAL, 1); // prefer hw rendering |
704 end; |
704 end; |
705 |
705 |
706 procedure SetupOpenGL; |
706 procedure SetupOpenGL; |
707 var name: array[byte] of char; |
707 var buf: array[byte] of char; |
708 AuxBufNum: LongInt = 0; |
708 AuxBufNum: LongInt = 0; |
709 tmpstr: AnsiString; |
709 tmpstr: AnsiString; |
710 tmpint: LongInt; |
710 tmpint: LongInt; |
711 tmpn: LongInt; |
711 tmpn: LongInt; |
712 begin |
712 begin |
713 {$IFDEF SDL2} |
713 {$IFDEF SDL2} |
714 name:= SDL_GetCurrentVideoDriver(); |
714 AddFileLog('Setting up OpenGL (using driver: ' + shortstring(SDL_GetCurrentVideoDriver()) + ')'); |
715 {$ELSE} |
715 {$ELSE} |
716 name:= SDL_VideoDriverName(name, sizeof(name)); |
716 buf[0]:= char(0); // avoid compiler hint |
|
717 AddFileLog('Setting up OpenGL (using driver: ' + shortstring(SDL_VideoDriverName(buf, sizeof(buf))) + ')'); |
717 {$ENDIF} |
718 {$ENDIF} |
718 |
719 |
719 AuxBufNum:= AuxBufNum; |
720 AuxBufNum:= AuxBufNum; |
720 AddFileLog('Setting up OpenGL (using driver: ' + shortstring(name) + ')'); |
|
721 |
721 |
722 {$IFDEF MOBILE} |
722 {$IFDEF MOBILE} |
723 // TODO: this function creates an opengles1.1 context |
723 // TODO: this function creates an opengles1.1 context |
724 // un-comment below and add proper logic to support opengles2.0 |
724 // un-comment below and add proper logic to support opengles2.0 |
725 //SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); |
725 //SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); |