comparison src/video/SDL_renderer_gl.c @ 3454:77366fae0094

Adjust the vertices to be over the texel center.
author Sam Lantinga <slouken@libsdl.org>
date Thu, 19 Nov 2009 04:33:35 +0000
parents 294b770c1989
children 5a7b5760c875
comparison
equal deleted inserted replaced
3453:bb35055cb101 3454:77366fae0094
1103 (GLfloat) renderer->g * inv255f, 1103 (GLfloat) renderer->g * inv255f,
1104 (GLfloat) renderer->b * inv255f, 1104 (GLfloat) renderer->b * inv255f,
1105 (GLfloat) renderer->a * inv255f); 1105 (GLfloat) renderer->a * inv255f);
1106 1106
1107 data->glBegin(GL_POINTS); 1107 data->glBegin(GL_POINTS);
1108 data->glVertex2i(x, y); 1108 data->glVertex2f(0.5f + x, 0.5f + y);
1109 data->glEnd(); 1109 data->glEnd();
1110 1110
1111 return 0; 1111 return 0;
1112 } 1112 }
1113 1113
1122 (GLfloat) renderer->g * inv255f, 1122 (GLfloat) renderer->g * inv255f,
1123 (GLfloat) renderer->b * inv255f, 1123 (GLfloat) renderer->b * inv255f,
1124 (GLfloat) renderer->a * inv255f); 1124 (GLfloat) renderer->a * inv255f);
1125 1125
1126 data->glBegin(GL_LINES); 1126 data->glBegin(GL_LINES);
1127 data->glVertex2i(x1, y1); 1127 data->glVertex2f(0.5f + x1, 0.5f + y1);
1128 data->glVertex2i(x2, y2); 1128 data->glVertex2f(0.5f + x2, 0.5f + y2);
1129 data->glEnd(); 1129 data->glEnd();
1130 1130
1131 return 0; 1131 return 0;
1132 } 1132 }
1133 1133
1232 data->glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, texturedata->shader); 1232 data->glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, texturedata->shader);
1233 } 1233 }
1234 1234
1235 data->glBegin(GL_TRIANGLE_STRIP); 1235 data->glBegin(GL_TRIANGLE_STRIP);
1236 data->glTexCoord2f(minu, minv); 1236 data->glTexCoord2f(minu, minv);
1237 data->glVertex2i(minx, miny); 1237 data->glVertex2f(0.5f + minx, 0.5f + miny);
1238 data->glTexCoord2f(maxu, minv); 1238 data->glTexCoord2f(maxu, minv);
1239 data->glVertex2i(maxx, miny); 1239 data->glVertex2f(0.5f + maxx, 0.5f + miny);
1240 data->glTexCoord2f(minu, maxv); 1240 data->glTexCoord2f(minu, maxv);
1241 data->glVertex2i(minx, maxy); 1241 data->glVertex2f(0.5f + minx, 0.5f + maxy);
1242 data->glTexCoord2f(maxu, maxv); 1242 data->glTexCoord2f(maxu, maxv);
1243 data->glVertex2i(maxx, maxy); 1243 data->glVertex2f(0.5f + maxx, 0.5f + maxy);
1244 data->glEnd(); 1244 data->glEnd();
1245 1245
1246 if (texturedata->shader != 0) { 1246 if (texturedata->shader != 0) {
1247 data->glDisable(GL_FRAGMENT_PROGRAM_ARB); 1247 data->glDisable(GL_FRAGMENT_PROGRAM_ARB);
1248 } 1248 }