Now, my code that run well is :
void Viewer::initGLES(){
glViewport( 0, 0, iScreenWidth, iScreenHeight );
glClearColor(0.f,0.f,0.1f,1.f);
glDisable(GL_DEPTH_TEST);
glMatrixMode(GL_PROJECTION);
//glFrustumf (-100.f,1000.f,-1000.f,500.f,3.f,300.f);
glFrustumf(-1500.f, 1500.f, -1500.f, 1500.f, 3.f, 1500.f);
//glFrustumf(Loader->minX, Loader->maxX, Loader->minY, Loader->maxY, 3.f, 2500.f);
//glFrustumf(657, 1155, -781, -442, 1.2f, 1500.f);
glMatrixMode(GL_MODELVIEW);
glShadeModel(GL_SMOOTH);
}
//--------------------------------------------
void Viewer::draw(){
glClear(GL_COLOR_BUFFER_BIT);
glLoadIdentity();
float centerX = (Loader->minX + Loader->maxX)/2;
float centerY = (Loader->minY + Loader->maxY)/2;
float centerZ = 0;
//glScalef(m_scale, m_scale, m_scale);
//glTranslatef(centerX, centerY, centerZ);
glTranslatef(-1400.f, 1000.f, -3.f);
//glTranslatef(906.0f, -611.5f, -7.f);
//glScalef(2.0, 2.0, 2.0);
//glScalef(5.0, 5.0, 5.0);
glColor4f(0, 1, 0, 1);
drawScene();
}
But as you can see, the parameters of the function glFrustumf(-1500.f, 1500.f, -1500.f, 1500.f, 3.f, 1500.f); are fixed. It is not good, because I don’t know the real data, it must be read from the data file.
And in the function glTranslatef(-1400.f, 1000.f, -3.f);, the parameters are also fixed. I would like to center my scene.
//glFrustumf(657, 1155, -781, -442, 1.2f, 1500.f); --> The real value in the data file.
How should I change thes parameters?
Thanks,