@@ -876,9 +876,7 @@ static void drawBusyIndicator(int positionX, int positionY, int squareSize, stru
876
876
877
877
void drawView (void )
878
878
{
879
- #if HAVE_GLES2
880
879
GLfloat p[16 ], m[16 ];
881
- #endif // !HAVE_GLES2
882
880
int i;
883
881
struct timeval time;
884
882
float left, right, bottom, top;
@@ -920,14 +918,8 @@ void drawView(void)
920
918
//
921
919
// Setup for drawing on top of video frame, in video pixel coordinates.
922
920
//
923
- #if !HAVE_GLES2
924
- glMatrixMode (GL_PROJECTION);
925
- glLoadIdentity ();
926
- if (vv->rotate90 ()) glRotatef (90 .0f , 0 .0f , 0 .0f , -1 .0f );
927
- #else
928
921
mtxLoadIdentityf (p);
929
922
if (vv->rotate90 ()) mtxRotatef (p, 90 .0f , 0 .0f , 0 .0f , -1 .0f );
930
- #endif // !HAVE_GLES2
931
923
if (vv->flipV ()) {
932
924
bottom = (float )vs->getVideoHeight ();
933
925
top = 0 .0f ;
@@ -942,18 +934,19 @@ void drawView(void)
942
934
left = 0 .0f ;
943
935
right = (float )vs->getVideoWidth ();
944
936
}
937
+ mtxOrthof (p, left, right, bottom, top, -1 .0f , 1 .0f );
938
+ mtxLoadIdentityf (m);
945
939
#if !HAVE_GLES2
946
- glOrtho (left, right, bottom, top, -1 .0f , 1 .0f );
940
+ glMatrixMode (GL_PROJECTION);
941
+ glLoadMatrixf (p);
947
942
glMatrixMode (GL_MODELVIEW);
948
- glLoadIdentity ( );
943
+ glLoadMatrixf (m );
949
944
glDisable (GL_DEPTH_TEST);
950
945
glDisable (GL_LIGHTING);
951
946
glDisable (GL_BLEND);
952
947
glActiveTexture (GL_TEXTURE0);
953
948
glDisable (GL_TEXTURE_2D);
954
949
#else
955
- mtxOrthof (p, left, right, bottom, top, -1 .0f , 1 .0f );
956
- mtxLoadIdentityf (m);
957
950
glStateCacheDisableDepthTest ();
958
951
glStateCacheDisableBlend ();
959
952
#endif // !HAVE_GLES2
@@ -983,20 +976,20 @@ void drawView(void)
983
976
unsigned char buf[12 ]; // 10 digits in INT32_MAX, plus sign, plus null.
984
977
sprintf ((char *)buf, " %d\n " , i);
985
978
979
+ GLfloat mvp[16 ];
986
980
#if !HAVE_GLES2
987
981
glPushMatrix ();
988
982
glLoadIdentity ();
989
983
glTranslatef (corners[i].x , vs->getVideoHeight () - corners[i].y , 0 .0f );
990
984
glRotatef ((float )(gDisplayOrientation - 1 ) * -90 .0f , 0 .0f , 0 .0f , 1 .0f ); // Orient the text to the user.
991
985
#else
992
- GLfloat mvp[16 ];
993
986
mtxLoadMatrixf (mvp, p);
994
987
mtxMultMatrixf (mvp, m);
995
988
mtxTranslatef (mvp, corners[i].x , vs->getVideoHeight () - corners[i].y , 0 .0f );
996
989
mtxRotatef (mvp, (float )(gDisplayOrientation - 1 ) * -90 .0f , 0 .0f , 0 .0f , 1 .0f ); // Orient the text to the user.
997
990
998
991
#endif // !HAVE_GLES2
999
- EdenGLFontDrawLine (0 , NULL , buf, 0 .0f , 0 .0f , H_OFFSET_VIEW_LEFT_EDGE_TO_TEXT_LEFT_EDGE, V_OFFSET_VIEW_BOTTOM_TO_TEXT_BASELINE); // These alignment modes don't require setting of EdenGLFontSetViewSize().
992
+ EdenGLFontDrawLine (0 , mvp , buf, 0 .0f , 0 .0f , H_OFFSET_VIEW_LEFT_EDGE_TO_TEXT_LEFT_EDGE, V_OFFSET_VIEW_BOTTOM_TO_TEXT_BASELINE); // These alignment modes don't require setting of EdenGLFontSetViewSize().
1000
993
#if !HAVE_GLES2
1001
994
glPopMatrix ();
1002
995
#endif // !HAVE_GLES2
@@ -1058,16 +1051,15 @@ void drawView(void)
1058
1051
top = (float )contextHeight;
1059
1052
left = 0 .0f ;
1060
1053
right = (float )contextWidth;
1054
+ mtxLoadIdentityf (p);
1055
+ mtxOrthof (p, left, right, bottom, top, -1 .0f , 1 .0f );
1056
+ mtxLoadIdentityf (m);
1061
1057
#if !HAVE_GLES2
1062
1058
glMatrixMode (GL_PROJECTION);
1063
- glLoadIdentity ();
1064
- glOrtho (left, right, bottom, top, -1 .0f , 1 .0f );
1059
+ glLoadMatrixf (p);
1065
1060
glMatrixMode (GL_MODELVIEW);
1066
- glLoadIdentity ( );
1061
+ glLoadMatrixf (m );
1067
1062
#else
1068
- mtxLoadIdentityf (p);
1069
- mtxOrthof (p, left, right, bottom, top, -1 .0f , 1 .0f );
1070
- mtxLoadIdentityf (m);
1071
1063
glUseProgram (program);
1072
1064
glUniformMatrix4fv (uniforms[UNIFORM_MODELVIEW_PROJECTION_MATRIX], 1 , GL_FALSE, p);
1073
1065
#endif // !HAVE_GLES2
@@ -1081,7 +1073,7 @@ void drawView(void)
1081
1073
if (statusBarMessage[0 ]) {
1082
1074
drawBackground (right, statusBarHeight, 0 .0f , 0 .0f , false );
1083
1075
glDisable (GL_BLEND);
1084
- EdenGLFontDrawLine (0 , NULL , statusBarMessage, 0 .0f , 2 .0f , H_OFFSET_VIEW_CENTER_TO_TEXT_CENTER, V_OFFSET_VIEW_BOTTOM_TO_TEXT_BASELINE);
1076
+ EdenGLFontDrawLine (0 , p , statusBarMessage, 0 .0f , 2 .0f , H_OFFSET_VIEW_CENTER_TO_TEXT_CENTER, V_OFFSET_VIEW_BOTTOM_TO_TEXT_BASELINE);
1085
1077
}
1086
1078
1087
1079
// If background tasks are proceeding, draw a status box.
@@ -1098,12 +1090,12 @@ void drawView(void)
1098
1090
y = statusBarHeight + 2 .0f ;
1099
1091
drawBackground (w, h, x, y, true );
1100
1092
if (status == 1 ) drawBusyIndicator ((int )(x + 4 .0f + 1 .5f *squareSize), (int )(y + 4 .0f + 1 .5f *squareSize), squareSize, &time);
1101
- EdenGLFontDrawLine (0 , NULL , (unsigned char *)uploadStatus, x + 4 .0f + 3 *squareSize, y + (h - FONT_SIZE)/2 .0f , H_OFFSET_VIEW_LEFT_EDGE_TO_TEXT_LEFT_EDGE, V_OFFSET_VIEW_BOTTOM_TO_TEXT_BASELINE);
1093
+ EdenGLFontDrawLine (0 , p , (unsigned char *)uploadStatus, x + 4 .0f + 3 *squareSize, y + (h - FONT_SIZE)/2 .0f , H_OFFSET_VIEW_LEFT_EDGE_TO_TEXT_LEFT_EDGE, V_OFFSET_VIEW_BOTTOM_TO_TEXT_BASELINE);
1102
1094
}
1103
1095
}
1104
1096
1105
1097
// If a message should be onscreen, draw it.
1106
- if (gEdenMessageDrawRequired ) EdenMessageDraw (0 , NULL );
1098
+ if (gEdenMessageDrawRequired ) EdenMessageDraw (0 , p );
1107
1099
1108
1100
SDL_GL_SwapWindow (gSDLWindow );
1109
1101
}
0 commit comments