vendredi 8 mai 2015

Old Open GL ES 1 draw does not render on iPhone 6 device, but works on other devices and simulators

I'm trying to upgrade an old app that has a small Open GL feature (rolling dice). It works fine on an older iPad, a newer iPad, and all simulators. However, on an actual iPhone 6 device it is blank.

I've stripped down the code such that it only draws a simple horizontal line, and it still renders everywhere but on the iPhone device.

I barely understand Open GL as it is, but the fact that it renders everywhere but on an actual iPhone 6 is really confusing.

Here's the stripped down rendering code.

glLoadIdentity();
glTranslatef(0.0f,0.0f,-12.0f);

glClearColor(1, 1, 1, 1.0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

glColor4f(1.0f, 0.0f, 0.0f, 1.0f); // opaque red
const GLfloat line[] = {
    -0.5f, -0.5f, //point A
    0.5f, -0.5f, //point B
};

glVertexPointer(2, GL_FLOAT, 0, line);
glEnableClientState(GL_VERTEX_ARRAY);
glDrawArrays(GL_LINES, 0, 2);

Note that if I change the value of glClearColor, it does change the background color so the basic rendering process seems to be working. However, any draws are not visible.

Any suggestions or ideas about what could be the issue?

Aucun commentaire:

Enregistrer un commentaire