Hi there,
I made another test with a minimal Programm (see code). It just sets up the renderer , checks if v-sync is on, and displays a simple grafic. I get iterations from 6 ms to 47 ms. ( see list ).
I think v-sync isn't working here. Am I wrong ?
Michael
Code:
JNIEXPORT void JNICALL Java_de_editionchamaeleon_ECApp_ECActivity_SendScreenSizeToNative ( JNIEnv* pEnv, jobject pThis, jint pX , jint pY )
{
screenW = pX;
screenH = pY;
};
int main(int argc, char* argv[])
{
SDL_Window* m_window = SDL_CreateWindow( "GE" , 0, 0, screenW, screenH, SDL_WINDOW_BORDERLESS | SDL_WINDOW_OPENGL );
SDL_Renderer* m_renderer = SDL_CreateRenderer( m_window, -1, SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_ACCELERATED );
SDL_SetRenderDrawColor(m_renderer, 0, 255, 0, 255);
SDL_Surface* surface = IMG_Load( "grafic/loadAnimation.png" );
SDL_Texture* rawTexture = SDL_CreateTextureFromSurface( m_renderer, surface );
SDL_Rect SDL_srcRect = { 0,0,0,0 };
SDL_QueryTexture( rawTexture, NULL, NULL, &SDL_srcRect.w, &SDL_srcRect.h );
SDL_Rect SDL_destRect = { 0,0,0,0 };
SDL_destRect.w = screenW;
SDL_destRect.h = screenH;
SDL_RendererInfo info;
SDL_GetRendererInfo( m_renderer, &info );
string text;
if ( info.flags & (0x01 << 3))
{
text = "Renderer is SDL_RENDERER_TARGETTEXTURE";
__android_log_print ( ANDROID_LOG_VERBOSE, "Mw", text.c_str() );
}
if ( info.flags & (0x01 << 2))
{
text = "Renderer is SDL_RENDERER_PRESENTVSYNC";
__android_log_print ( ANDROID_LOG_VERBOSE, "Mw", text.c_str() );
}
if ( info.flags & (0x01 << 1))
{
text = "Renderer is SDL_RENDERER_ACCELERATED";
__android_log_print ( ANDROID_LOG_VERBOSE, "Mw", text.c_str() );
}
if ( info.flags & (0x01 ))
{
text = "Renderer is SDL_RENDERER_SOFTWARE";
__android_log_print ( ANDROID_LOG_VERBOSE, "Mw", text.c_str() );
}
int time1, time2, time3;
while (1)
{
time1 = SDL_GetTicks();
SDL_RenderClear( m_renderer );
SDL_RenderCopy( m_renderer, rawTexture, &SDL_srcRect, &SDL_destRect );
SDL_RenderPresent( m_renderer );
time2 = SDL_GetTicks();
time3 = time2 - time1;
ostringstream sstream;
sstream << time3 << " ms";
text = sstream.str();
__android_log_print ( ANDROID_LOG_VERBOSE, "Mw", text.c_str() );
}
}
and a get this:
Code:
01-18 17:26:05.973: V/Mw:(8200): Sending Screensize : 960 , 540
01-18 17:26:06.373: V/Mw(8200): Renderer is SDL_RENDERER_TARGETTEXTURE
01-18 17:26:06.373: V/Mw(8200): Renderer is SDL_RENDERER_PRESENTVSYNC
01-18 17:26:06.373: V/Mw(8200): Renderer is SDL_RENDERER_ACCELERATED
01-18 17:26:06.393: V/Mw(8200): 20 ms
01-18 17:26:06.403: V/Mw(8200): 11 ms
01-18 17:26:06.413: V/Mw(8200): 7 ms
01-18 17:26:06.413: V/Mw(8200): 5 ms
01-18 17:26:06.433: V/Mw(8200): 16 ms
01-18 17:26:06.453: V/Mw(8200): 17 ms
01-18 17:26:06.463: V/Mw(8200): 16 ms
01-18 17:26:06.483: V/Mw(8200): 16 ms
01-18 17:26:06.493: V/Mw(8200): 16 ms
01-18 17:26:06.513: V/Mw(8200): 17 ms
01-18 17:26:06.533: V/Mw(8200): 16 ms
01-18 17:26:06.553: V/Mw(8200): 18 ms
01-18 17:26:06.573: V/Mw(8200): 21 ms
01-18 17:26:06.583: V/Mw(8200): 17 ms
01-18 17:26:06.604: V/Mw(8200): 11 ms
01-18 17:26:06.614: V/Mw(8200): 16 ms
01-18 17:26:06.634: V/Mw(8200): 17 ms
01-18 17:26:06.654: V/Mw(8200): 17 ms
01-18 17:26:06.664: V/Mw(8200): 19 ms
01-18 17:26:06.684: V/Mw(8200): 16 ms
01-18 17:26:06.704: V/Mw(8200): 16 ms
01-18 17:26:06.734: V/Mw(8200): 29 ms
01-18 17:26:06.744: V/Mw(8200): 17 ms
01-18 17:26:06.764: V/Mw(8200): 15 ms
01-18 17:26:06.784: V/Mw(8200): 18 ms
01-18 17:26:06.794: V/Mw(8200): 15 ms
01-18 17:26:06.814: V/Mw(8200): 21 ms
01-18 17:26:06.834: V/Mw(8200): 12 ms
01-18 17:26:06.844: V/Mw(8200): 18 ms
01-18 17:26:06.864: V/Mw(8200): 16 ms
01-18 17:26:06.884: V/Mw(8200): 19 ms
01-18 17:26:06.904: V/Mw(8200): 17 ms
01-18 17:26:06.914: V/Mw(8200): 15 ms
01-18 17:26:06.934: V/Mw(8200): 14 ms
01-18 17:26:06.944: V/Mw(8200): 17 ms
01-18 17:26:06.964: V/Mw(8200): 17 ms
01-18 17:26:06.984: V/Mw(8200): 17 ms
01-18 17:26:06.994: V/Mw(8200): 17 ms
01-18 17:26:07.014: V/Mw(8200): 21 ms
01-18 17:26:07.034: V/Mw(8200): 13 ms
01-18 17:26:07.044: V/Mw(8200): 16 ms
01-18 17:26:07.064: V/Mw(8200): 17 ms
01-18 17:26:07.084: V/Mw(8200): 16 ms
01-18 17:26:07.094: V/Mw(8200): 17 ms
01-18 17:26:07.114: V/Mw(8200): 18 ms
01-18 17:26:07.134: V/Mw(8200): 16 ms
01-18 17:26:07.144: V/Mw(8200): 17 ms
01-18 17:26:07.164: V/Mw(8200): 16 ms
01-18 17:26:07.184: V/Mw(8200): 16 ms
01-18 17:26:07.194: V/Mw(8200): 17 ms
01-18 17:26:07.214: V/Mw(8200): 17 ms
01-18 17:26:07.234: V/Mw(8200): 16 ms
01-18 17:26:07.244: V/Mw(8200): 16 ms
01-18 17:26:07.264: V/Mw(8200): 17 ms
01-18 17:26:07.284: V/Mw(8200): 16 ms
01-18 17:26:07.294: V/Mw(8200): 17 ms
01-18 17:26:07.314: V/Mw(8200): 17 ms
01-18 17:26:07.334: V/Mw(8200): 16 ms
01-18 17:26:07.344: V/Mw(8200): 17 ms
01-18 17:26:07.364: V/Mw(8200): 17 ms
01-18 17:26:07.384: V/Mw(8200): 16 ms
01-18 17:26:07.394: V/Mw(8200): 17 ms
01-18 17:26:07.414: V/Mw(8200): 16 ms
01-18 17:26:07.434: V/Mw(8200): 16 ms
01-18 17:26:07.444: V/Mw(8200): 17 ms
01-18 17:26:07.464: V/Mw(8200): 17 ms
01-18 17:26:07.484: V/Mw(8200): 16 ms
01-18 17:26:07.494: V/Mw(8200): 17 ms
01-18 17:26:07.514: V/Mw(8200): 16 ms
01-18 17:26:07.534: V/Mw(8200): 16 ms
01-18 17:26:07.545: V/Mw(8200): 17 ms
01-18 17:26:07.565: V/Mw(8200): 16 ms
01-18 17:26:07.585: V/Mw(8200): 16 ms
01-18 17:26:07.595: V/Mw(8200): 17 ms
01-18 17:26:07.615: V/Mw(8200): 16 ms
01-18 17:26:07.635: V/Mw(8200): 16 ms
01-18 17:26:07.645: V/Mw(8200): 17 ms
01-18 17:26:07.665: V/Mw(8200): 17 ms
01-18 17:26:07.685: V/Mw(8200): 16 ms
01-18 17:26:07.695: V/Mw(8200): 17 ms
01-18 17:26:07.715: V/Mw(8200): 17 ms
01-18 17:26:07.735: V/Mw(8200): 16 ms
01-18 17:26:07.745: V/Mw(8200): 17 ms
01-18 17:26:07.765: V/Mw(8200): 17 ms
01-18 17:26:07.785: V/Mw(8200): 16 ms
01-18 17:26:07.795: V/Mw(8200): 17 ms
01-18 17:26:07.815: V/Mw(8200): 17 ms
01-18 17:26:07.835: V/Mw(8200): 16 ms
01-18 17:26:07.845: V/Mw(8200): 16 ms
01-18 17:26:07.865: V/Mw(8200): 16 ms
01-18 17:26:07.885: V/Mw(8200): 17 ms
01-18 17:26:07.895: V/Mw(8200): 17 ms
01-18 17:26:07.915: V/Mw(8200): 17 ms
01-18 17:26:07.935: V/Mw(8200): 16 ms
01-18 17:26:07.945: V/Mw(8200): 17 ms
01-18 17:26:07.965: V/Mw(8200): 17 ms
01-18 17:26:07.985: V/Mw(8200): 16 ms
01-18 17:26:07.995: V/Mw(8200): 18 ms
01-18 17:26:08.015: V/Mw(8200): 17 ms
01-18 17:26:08.035: V/Mw(8200): 16 ms
01-18 17:26:08.045: V/Mw(8200): 17 ms
01-18 17:26:08.065: V/Mw(8200): 17 ms
01-18 17:26:08.085: V/Mw(8200): 16 ms
01-18 17:26:08.095: V/Mw(8200): 16 ms
01-18 17:26:08.115: V/Mw(8200): 17 ms
01-18 17:26:08.135: V/Mw(8200): 16 ms
01-18 17:26:08.145: V/Mw(8200): 17 ms
01-18 17:26:08.165: V/Mw(8200): 17 ms
01-18 17:26:08.185: V/Mw(8200): 16 ms
01-18 17:26:08.195: V/Mw(8200): 17 ms
01-18 17:26:08.215: V/Mw(8200): 17 ms
01-18 17:26:08.235: V/Mw(8200): 16 ms
01-18 17:26:08.245: V/Mw(8200): 16 ms
01-18 17:26:08.265: V/Mw(8200): 17 ms
01-18 17:26:08.285: V/Mw(8200): 16 ms
01-18 17:26:08.295: V/Mw(8200): 17 ms
01-18 17:26:08.315: V/Mw(8200): 17 ms
01-18 17:26:08.335: V/Mw(8200): 16 ms
01-18 17:26:08.345: V/Mw(8200): 17 ms
01-18 17:26:08.365: V/Mw(8200): 17 ms
01-18 17:26:08.385: V/Mw(8200): 16 ms
01-18 17:26:08.395: V/Mw(8200): 17 ms
01-18 17:26:08.415: V/Mw(8200): 17 ms
01-18 17:26:08.435: V/Mw(8200): 16 ms
01-18 17:26:08.445: V/Mw(8200): 17 ms
01-18 17:26:08.465: V/Mw(8200): 17 ms
01-18 17:26:08.486: V/Mw(8200): 16 ms
01-18 17:26:08.496: V/Mw(8200): 17 ms
01-18 17:26:08.516: V/Mw(8200): 17 ms
01-18 17:26:08.526: V/Mw(8200): 16 ms
01-18 17:26:08.536: V/Mw(8200): 18 ms
01-18 17:26:08.556: V/Mw(8200): 16 ms
01-18 17:26:08.576: V/Mw(8200): 17 ms
01-18 17:26:08.586: V/Mw(8200): 16 ms
01-18 17:26:08.616: V/Mw(8200): 17 ms
01-18 17:26:08.626: V/Mw(8200): 16 ms
01-18 17:26:08.636: V/Mw(8200): 17 ms
01-18 17:26:08.666: V/Mw(8200): 17 ms
01-18 17:26:08.686: V/Mw(8200): 16 ms
01-18 17:26:08.696: V/Mw(8200): 17 ms
01-18 17:26:08.716: V/Mw(8200): 17 ms
01-18 17:26:08.736: V/Mw(8200): 17 ms
01-18 17:26:08.746: V/Mw(8200): 16 ms
01-18 17:26:08.766: V/Mw(8200): 17 ms
01-18 17:26:08.786: V/Mw(8200): 16 ms
01-18 17:26:08.786: V/Mw(8200): 17 ms
01-18 17:26:08.806: V/Mw(8200): 17 ms
01-18 17:26:08.826: V/Mw(8200): 16 ms
01-18 17:26:08.846: V/Mw(8200): 17 ms
01-18 17:26:08.856: V/Mw(8200): 17 ms
01-18 17:26:08.876: V/Mw(8200): 16 ms
01-18 17:26:08.896: V/Mw(8200): 17 ms
01-18 17:26:08.926: V/Mw(8200): 25 ms
01-18 17:26:08.936: V/Mw(8200): 8 ms
01-18 17:26:08.946: V/Mw(8200): 17 ms
01-18 17:26:08.956: V/Mw(8200): 17 ms
01-18 17:26:08.986: V/Mw(8200): 16 ms
01-18 17:26:09.006: V/Mw(8200): 36 ms
01-18 17:26:09.026: V/Mw(8200): 10 ms
01-18 17:26:09.036: V/Mw(8200): 21 ms
01-18 17:26:09.056: V/Mw(8200): 8 ms
01-18 17:26:09.086: V/Mw(8200): 27 ms
01-18 17:26:09.096: V/Mw(8200): 17 ms
01-18 17:26:09.116: V/Mw(8200): 25 ms
01-18 17:26:09.136: V/Mw(8200): 16 ms
01-18 17:26:09.146: V/Mw(8200): 19 ms
01-18 17:26:09.156: V/Mw(8200): 7 ms
01-18 17:26:09.186: V/Mw(8200): 14 ms
01-18 17:26:09.186: V/Mw(8200): 16 ms
01-18 17:26:09.206: V/Mw(8200): 17 ms
01-18 17:26:09.236: V/Mw(8200): 16 ms
01-18 17:26:09.246: V/Mw(8200): 15 ms
01-18 17:26:09.256: V/Mw(8200): 17 ms
01-18 17:26:09.286: V/Mw(8200): 16 ms
01-18 17:26:09.296: V/Mw(8200): 24 ms
01-18 17:26:09.326: V/Mw(8200): 17 ms
01-18 17:26:09.336: V/Mw(8200): 17 ms
01-18 17:26:09.346: V/Mw(8200): 18 ms
01-18 17:26:09.366: V/Mw(8200): 15 ms
01-18 17:26:09.396: V/Mw(8200): 26 ms
01-18 17:26:09.406: V/Mw(8200): 15 ms
01-18 17:26:09.427: V/Mw(8200): 24 ms
01-18 17:26:09.457: V/Mw(8200): 18 ms
01-18 17:26:09.477: V/Mw(8200): 19 ms
01-18 17:26:09.477: V/Mw(8200): 13 ms
01-18 17:26:09.507: V/Mw(8200): 17 ms
01-18 17:26:09.527: V/Mw(8200): 18 ms
01-18 17:26:09.547: V/Mw(8200): 17 ms
01-18 17:26:09.557: V/Mw(8200): 14 ms
01-18 17:26:09.577: V/Mw(8200): 15 ms
01-18 17:26:09.587: V/Mw(8200): 24 ms
01-18 17:26:09.607: V/Mw(8200): 14 ms
01-18 17:26:09.617: V/Mw(8200): 10 ms
01-18 17:26:09.657: V/Mw(8200): 35 ms
01-18 17:26:09.667: V/Mw(8200): 15 ms
01-18 17:26:09.687: V/Mw(8200): 20 ms
01-18 17:26:09.697: V/Mw(8200): 10 ms
01-18 17:26:09.727: V/Mw(8200): 18 ms
01-18 17:26:09.737: V/Mw(8200): 16 ms
01-18 17:26:09.757: V/Mw(8200): 16 ms
01-18 17:26:09.777: V/Mw(8200): 24 ms
01-18 17:26:09.787: V/Mw(8200): 17 ms
01-18 17:26:09.807: V/Mw(8200): 14 ms
01-18 17:26:09.817: V/Mw(8200): 10 ms
01-18 17:26:09.847: V/Mw(8200): 21 ms
01-18 17:26:09.847: V/Mw(8200): 12 ms
01-18 17:26:09.887: V/Mw(8200): 33 ms
01-18 17:26:09.897: V/Mw(8200): 14 ms
01-18 17:26:09.937: V/Mw(8200): 35 ms
01-18 17:26:09.947: V/Mw(8200): 15 ms
01-18 17:26:09.957: V/Mw(8200): 11 ms
01-18 17:26:09.977: V/Mw(8200): 20 ms
01-18 17:26:09.987: V/Mw(8200): 12 ms
01-18 17:26:10.007: V/Mw(8200): 18 ms
01-18 17:26:10.027: V/Mw(8200): 15 ms
01-18 17:26:10.047: V/Mw(8200): 17 ms
01-18 17:26:10.057: V/Mw(8200): 17 ms
01-18 17:26:10.077: V/Mw(8200): 16 ms
01-18 17:26:10.097: V/Mw(8200): 17 ms
01-18 17:26:10.107: V/Mw(8200): 17 ms
01-18 17:26:10.127: V/Mw(8200): 16 ms
01-18 17:26:10.147: V/Mw(8200): 17 ms
01-18 17:26:10.157: V/Mw(8200): 17 ms
01-18 17:26:10.177: V/Mw(8200): 16 ms
01-18 17:26:10.207: V/Mw(8200): 31 ms
01-18 17:26:10.217: V/Mw(8200): 10 ms
01-18 17:26:10.257: V/Mw(8200): 32 ms
01-18 17:26:10.277: V/Mw(8200): 18 ms
01-18 17:26:10.287: V/Mw(8200): 18 ms
01-18 17:26:10.307: V/Mw(8200): 13 ms
01-18 17:26:10.327: V/Mw(8200): 20 ms
01-18 17:26:10.337: V/Mw(8200): 19 ms
01-18 17:26:10.347: V/Mw(8200): 11 ms
01-18 17:26:10.388: V/Mw(8200): 35 ms
01-18 17:26:10.388: V/Mw(8200): 6 ms
01-18 17:26:10.408: V/Mw(8200): 17 ms
01-18 17:26:10.428: V/Mw(8200): 16 ms
01-18 17:26:10.448: V/Mw(8200): 16 ms
01-18 17:26:10.458: V/Mw(8200): 16 ms
01-18 17:26:10.508: V/Mw(8200): 47 ms
01-18 17:26:10.518: V/Mw(8200): 8 ms
01-18 17:26:10.528: V/Mw(8200): 12 ms
01-18 17:26:10.538: V/Mw(8200): 15 ms
01-18 17:26:10.558: V/Mw(8200): 17 ms
01-18 17:26:10.578: V/Mw(8200): 16 ms
01-18 17:26:10.598: V/Mw(8200): 20 ms
01-18 17:26:10.608: V/Mw(8200): 14 ms
01-18 17:26:10.628: V/Mw(8200): 17 ms
01-18 17:26:10.648: V/Mw(8200): 16 ms
01-18 17:26:10.658: V/Mw(8200): 16 ms
01-18 17:26:10.678: V/Mw(8200): 22 ms
01-18 17:26:10.698: V/Mw(8200): 18 ms
01-18 17:26:10.718: V/Mw(8200): 18 ms
01-18 17:26:10.738: V/Mw(8200): 15 ms
01-18 17:26:10.758: V/Mw(8200): 23 ms
01-18 17:26:10.778: V/Mw(8200): 23 ms
01-18 17:26:10.808: V/Mw(8200): 26 ms
01-18 17:26:10.828: V/Mw(8200): 19 ms
01-18 17:26:10.848: V/Mw(8200): 17 ms
01-18 17:26:10.858: V/Mw(8200): 16 ms
01-18 17:26:10.888: V/Mw(8200): 30 ms
01-18 17:26:10.898: V/Mw(8200): 6 ms
01-18 17:26:10.928: V/Mw(8200): 29 ms
01-18 17:26:10.948: V/Mw(8200): 16 ms
01-18 17:26:10.958: V/Mw(8200): 16 ms
01-18 17:26:10.978: V/Mw(8200): 22 ms
01-18 17:26:10.988: V/Mw(8200): 13 ms
01-18 17:26:11.008: V/Mw(8200): 14 ms
01-18 17:26:11.028: V/Mw(8200): 16 ms