Beispiel #1
0
static void
validate_result (TestState *state)
{
  int ypos = 0;

  if (g_test_verbose ())
    g_print ("Testing onscreen clone...\n");
  g_assert (validate_part (state, SOURCE_SIZE, ypos * SOURCE_SIZE, 0));
  ypos++;

#if 0 /* this doesn't work */
  if (g_test_verbose ())
    g_print ("Testing offscreen clone...\n");
  g_assert (validate_part (state, SOURCE_SIZE, ypos * SOURCE_SIZE, 0));
#endif
  ypos++;

  if (g_test_verbose ())
    g_print ("Testing onscreen clone with rectangular clip...\n");
  g_assert (validate_part (state, SOURCE_SIZE, ypos * SOURCE_SIZE, ~1));
  ypos++;

  if (g_test_verbose ())
    g_print ("Testing onscreen clone with path clip...\n");
  g_assert (validate_part (state, SOURCE_SIZE, ypos * SOURCE_SIZE, 1));
  ypos++;

  /* Comment this out if you want visual feedback of what this test
   * paints.
   */
  clutter_main_quit ();
}
Beispiel #2
0
static void
validate_result (int y_offset)
{
  int draw_num;

  for (draw_num = 0; draw_num < 16; draw_num++)
    {
      gboolean cull_front, cull_back;
      CoglPipelineCullFaceMode cull_mode;

      if (USE_LEGACY_STATE (draw_num))
        cull_mode = COGL_PIPELINE_CULL_FACE_MODE_BACK;
      else
        cull_mode = CULL_FACE_MODE (draw_num);

      switch (cull_mode)
        {
        case COGL_PIPELINE_CULL_FACE_MODE_NONE:
          cull_front = FALSE;
          cull_back = FALSE;
          break;

        case COGL_PIPELINE_CULL_FACE_MODE_FRONT:
          cull_front = TRUE;
          cull_back = FALSE;
          break;

        case COGL_PIPELINE_CULL_FACE_MODE_BACK:
          cull_front = FALSE;
          cull_back = TRUE;
          break;

        case COGL_PIPELINE_CULL_FACE_MODE_BOTH:
          cull_front = TRUE;
          cull_back = TRUE;
          break;
        }

      if (FRONT_WINDING (draw_num) == COGL_WINDING_CLOCKWISE)
        {
          gboolean tmp = cull_front;
          cull_front = cull_back;
          cull_back = tmp;
        }

      /* Front-facing texture */
      validate_part (0, y_offset + draw_num, !cull_front);
      /* Front-facing texture with flipped tex coords */
      validate_part (1, y_offset + draw_num, !cull_front);
      /* Back-facing texture */
      validate_part (2, y_offset + draw_num, !cull_back);
      /* Front-facing texture polygon */
      validate_part (3, y_offset + draw_num, !cull_front);
      /* Back-facing texture polygon */
      validate_part (4, y_offset + draw_num, !cull_back);
    }
}
Beispiel #3
0
static void
validate_result (void)
{
  /* Validate that all four corners of the texture are drawn in the
     right color */
  validate_part (0, 0, corner_colors[0]);
  validate_part (1, 0, corner_colors[1]);
  validate_part (0, 1, corner_colors[2]);
  validate_part (1, 1, corner_colors[3]);
}
static void
validate_result (CoglFramebuffer *framebuffer, int y_offset)
{
  int draw_num;

  for (draw_num = 0; draw_num < 8; draw_num++)
    {
      CoglBool cull_front, cull_back;
      CoglPipelineCullFaceMode cull_mode;

      cull_mode = CULL_FACE_MODE (draw_num);

      switch (cull_mode)
        {
        case COGL_PIPELINE_CULL_FACE_MODE_NONE:
          cull_front = FALSE;
          cull_back = FALSE;
          break;

        case COGL_PIPELINE_CULL_FACE_MODE_FRONT:
          cull_front = TRUE;
          cull_back = FALSE;
          break;

        case COGL_PIPELINE_CULL_FACE_MODE_BACK:
          cull_front = FALSE;
          cull_back = TRUE;
          break;

        case COGL_PIPELINE_CULL_FACE_MODE_BOTH:
          cull_front = TRUE;
          cull_back = TRUE;
          break;
        }

      if (FRONT_WINDING (draw_num) == COGL_WINDING_CLOCKWISE)
        {
          CoglBool tmp = cull_front;
          cull_front = cull_back;
          cull_back = tmp;
        }

      /* Front-facing texture */
      validate_part (framebuffer,
                     0, y_offset + draw_num, !cull_front);
      /* Front-facing texture with flipped tex coords */
      validate_part (framebuffer,
                     1, y_offset + draw_num, !cull_front);
      /* Back-facing texture */
      validate_part (framebuffer,
                     2, y_offset + draw_num, !cull_back);
    }
}