Hello all,
I’m beginner to OpenGL.
I’m writing an application for Symbian S60 (version 9.1). This application will read data from a file and then draw on the screen. The drawer use OpenGL ES.
I don’t know why it does not work. I think that perhaps the value of data is too big.
Here is my code:
void Viewer::drawScene(){
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
float diam = 1;
float zNear = 1.0;
float zFar = zNear + diam;
float cx = 0;
float cy = 0;
float left = cx - diam;
float right = cx + diam;
float bottom = cy - diam;
float top = cy + diam;
float aspect = iScreenWidth / iScreenHeight;
if ( aspect < 1.0 ) { // window taller than wide
bottom /= aspect;
top /= aspect;
} else {
left *= aspect;
right *= aspect;
}
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
//glOrtho(left, right, bottom, top, zNear, zFar);
gluOrthoManual(left, right, bottom, top, zNear, zFar);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glEnableClientState ( GL_VERTEX_ARRAY );
int nbVertices = Loader->data->GetNBOfVertices();
GLfloat *vertices = Loader->data->GetVertices();
glVertexPointer( 3, GL_FLOAT, 0, vertices );
glDrawArrays( GL_LINE_STRIP, 0, nbVertices);
glDisableClientState(GL_VERTEX_ARRAY);
}
Does anyone can tell me why it does not work?
Here is the sample of data:
x=1114.9, y=-781.
x=965., y=-775.
x=721., y=-765.
x=712., y=-764.
x=708., y=-761.
x=656., y=-663.
x=657., y=-606.
x=657., y=-606.
x=658., y=-597.
x=664., y=-537.
x=667., y=-530.
x=708., y=-486.81
x=742., y=-465.75
x=762., y=-458.66
x=778., y=-452.88
x=781., y=-452.5
x=794., y=-451.13
x=811., y=-449.41
x=835., y=-446.97
x=891., y=-441.47
x=1027.5, y=-448.5
x=1123.9, y=-453.78
x=1154.5, y=-530.
x=1148.4, y=-661.
x=1144.8, y=-690.