static void engine_draw_frame(struct MyData* myData) {
if (myData->display == NULL) {
// No display.
return;
}
LOGI("engine_draw_frame");
//=============================== scheme1
// glClearColor(0.0f, 0.0f, 0.8f, 1.0f);
//=============================== scheme3
unsigned short coords[] = { //
0, 0, 0, //p2: (x1,y1,z1)
1000, 0, 0, //p1: (x1,y1,z1)
0, 500, 0 //p3: (x1,y1,z1)
};
glColor4f(0.0f, 0.3f, 0.8f, 1.0f);
glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_SHORT, coords);
// LOGW("%d", glGetError());
static float triangleCoords[] = { //
5, 500, 0, //p2: (x1,y1,z1)
5, 1000, 0, //p1: (x1,y1,z1)
500, 0, 0 //p3: (x1,y1,z1)
};
// Draw the triangle
glColor4f(0.6f, 0.76f, 0.22f, 1.0f);
glVertexPointer(3, GL_FLOAT, 0, triangleCoords);
glDrawArrays(GL_TRIANGLES, 0, 3);
//=============================== scheme2
// // Just fill the screen with a color.
// glClearColor(((float) myData->state.x) / myData->width, myData->state.angle, ((float) myData->state.y) / myData->height, 1);
glClear(GL_COLOR_BUFFER_BIT);
eglSwapBuffers(myData->display, myData->surface);
}
android C++ native opengl?es
------解决方案--------------------
无人回答,我来接分