Thursday, February 6, 2014

Under android with a triangle unsuccessful write native-activity drawing, expert guidance


 
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);
}


Reply:
MyData is a sample program inside the struct engine
Reply:
No answer, I'll pick points

No comments:

Post a Comment