Esempio n. 1
0
static int teapot_gl_init(RASPITEX_STATE *raspitex_state)
{
    const char *model_path = "/opt/vc/src/hello_pi/hello_teapot/teapot.obj.dat";
    TEAPOT_STATE_T *state = NULL;
    int rc = 0;

    // Clear scene state
    state = calloc(1, sizeof(TEAPOT_STATE_T));
    raspitex_state->scene_state = state;
    state->screen_width = raspitex_state->width;
    state->screen_height = raspitex_state->height;

    rc = raspitexutil_gl_init_1_0(raspitex_state);
    if (rc != 0)
        goto end;

    // Start OGLES
    init_ogl(state);

    // Setup the model world
    init_model_proj(state);
    state->model = load_wavefront(model_path, NULL);

    if (! state->model)
    {
        vcos_log_error("Failed to load model from %s\n", model_path);
        rc = -1;
    }

end:
    return rc;
}
Esempio n. 2
0
static int square_init(RASPITEX_STATE *state)
{
   int rc = raspitexutil_gl_init_1_0(state);

   if (rc != 0)
      goto end;

   angle = 0.0f;
   anim_step = 0;

   glClearColor(0, 0, 0, 0);
   glClearDepthf(1);
   glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
   glLoadIdentity();

end:
   return rc;
}