1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
| void Viewer::initGLES(){
glClearColor(0.f ,1.0f, 1.0f, 1.f);
glDisable(GL_DEPTH_TEST);
float diam = 1500;
float zNear = 1.3f;
float zFar = zNear + diam;
int cx = 0, cy = 0, cz = 0;
float left = cx - diam;
float right = cx + diam;
float bottom = cy - diam;
float top = cy + diam;
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
float aspect = iScreenWidth / iScreenHeight; // 240 x 320
if ( aspect < 1.0 ) { // window taller than wide
bottom /= aspect;
top /= aspect;
} else {
left *= aspect;
right *= aspect;
}
//glOrtho(left, right, bottom, top, zNear, zFar);
glOrthof(left, right, bottom, top, zNear, zFar);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
//gluLookAt(0., 0., 2.*diam, cx, cy, cz, 0.0, 1.0, 0.0);
}
//------------------------------------
void Viewer::drawFP(){
glClear(GL_COLOR_BUFFER_BIT);
glLoadIdentity();
glEnableClientState(GL_VERTEX_ARRAY);
//glTranslatef (0,0,-5.f);
glColor4f(0,1,0,1);
static const GLfloat vertices[3 * 3] =
{
-1000, 1000, 0,
1000, -1000, 0,
1000, 1000, 0
};
glVertexPointer( 3, GL_FLOAT, 0, vertices );
glDrawArrays( GL_LINES, 0, 3);
} |
Partager