示例#1
0
文件: glext.c 项目: AMDmi3/neverball
void glClipPlane4f_(GLenum p, GLfloat a, GLfloat b, GLfloat c, GLfloat d)
{
#if ENABLE_OPENGLES

    GLfloat v[4];

    v[0] = a;
    v[1] = b;
    v[2] = c;
    v[3] = d;

    glClipPlanef(p, v);

#else

    GLdouble v[4];

    v[0] = a;
    v[1] = b;
    v[2] = c;
    v[3] = d;

    glClipPlane(p, v);

#endif
}
示例#2
0
static void
set_clip_plane (GLint plane_num,
		const float *vertex_a,
		const float *vertex_b)
{
#if defined (HAVE_COGL_GLES2) || defined (HAVE_COGL_GLES)
  GLfloat plane[4];
#else
  GLdouble plane[4];
#endif
  GLfloat angle;
  CoglHandle framebuffer = _cogl_get_framebuffer ();
  CoglMatrixStack *modelview_stack =
    _cogl_framebuffer_get_modelview_stack (framebuffer);
  CoglMatrixStack *projection_stack =
    _cogl_framebuffer_get_projection_stack (framebuffer);
  CoglMatrix inverse_projection;

  _COGL_GET_CONTEXT (ctx, NO_RETVAL);

  _cogl_matrix_stack_get_inverse (projection_stack, &inverse_projection);

  /* Calculate the angle between the axes and the line crossing the
     two points */
  angle = atan2f (vertex_b[1] - vertex_a[1],
                  vertex_b[0] - vertex_a[0]) * (180.0/G_PI);

  _cogl_matrix_stack_push (modelview_stack);

  /* Load the inverse of the projection matrix so we can specify the plane
   * in screen coordinates */
  _cogl_matrix_stack_set (modelview_stack, &inverse_projection);

  /* Rotate about point a */
  _cogl_matrix_stack_translate (modelview_stack,
                                vertex_a[0], vertex_a[1], vertex_a[2]);
  /* Rotate the plane by the calculated angle so that it will connect
     the two points */
  _cogl_matrix_stack_rotate (modelview_stack, angle, 0.0f, 0.0f, 1.0f);
  _cogl_matrix_stack_translate (modelview_stack,
                                -vertex_a[0], -vertex_a[1], -vertex_a[2]);

  _cogl_matrix_stack_flush_to_gl (modelview_stack, COGL_MATRIX_MODELVIEW);

  plane[0] = 0;
  plane[1] = -1.0;
  plane[2] = 0;
  plane[3] = vertex_a[1];
#if defined (HAVE_COGL_GLES2) || defined (HAVE_COGL_GLES)
  GE( glClipPlanef (plane_num, plane) );
#else
  GE( glClipPlane (plane_num, plane) );
#endif

  _cogl_matrix_stack_pop (modelview_stack);
}
示例#3
0
void glClipPlane( GLuint plane, GLdouble * equation )
{
    GLfloat fequ[4];
    fequ[0] = (GLfloat)equation[0];
    fequ[1] = (GLfloat)equation[1];
    fequ[2] = (GLfloat)equation[2];
    fequ[3] = (GLfloat)equation[3];
    glClipPlanef( plane, fequ );
    int glError;
    glError = TEST_FOR_OPENGL_ERRORS
}
void glClipPlanefLogged(GLenum plane, const GLfloat *equation) {
	printf("glClipPlanef(%s, %p)\n", GLEnumName(plane), equation);
	glClipPlanef(plane, equation);
}
示例#5
0
文件: gl.c 项目: GizmoTheGreen/glshim
void glClipPlane(GLenum plane, const GLdouble *equation) {
    constArrayToFloat(equation, 4);
    glClipPlanef(plane, s);
}
示例#6
0
文件: gl.c 项目: GizmoTheGreen/glshim
void glClipPlanefOES(GLenum plane, const GLfloat *equation) {
    glClipPlanef(plane, equation);
}
示例#7
0
static void
set_clip_plane (CoglFramebuffer *framebuffer,
                int plane_num,
		const float *vertex_a,
		const float *vertex_b)
{
  CoglContext *ctx = framebuffer->context;
  float planef[4];
  double planed[4];
  float angle;
  CoglMatrixStack *modelview_stack =
    _cogl_framebuffer_get_modelview_stack (framebuffer);
  CoglMatrixStack *projection_stack =
    _cogl_framebuffer_get_projection_stack (framebuffer);
  CoglMatrix inverse_projection;

  cogl_matrix_stack_get_inverse (projection_stack, &inverse_projection);

  /* Calculate the angle between the axes and the line crossing the
     two points */
  angle = atan2f (vertex_b[1] - vertex_a[1],
                  vertex_b[0] - vertex_a[0]) * (180.0/G_PI);

  cogl_matrix_stack_push (modelview_stack);

  /* Load the inverse of the projection matrix so we can specify the plane
   * in screen coordinates */
  cogl_matrix_stack_set (modelview_stack, &inverse_projection);

  /* Rotate about point a */
  cogl_matrix_stack_translate (modelview_stack,
                               vertex_a[0], vertex_a[1], vertex_a[2]);
  /* Rotate the plane by the calculated angle so that it will connect
     the two points */
  cogl_matrix_stack_rotate (modelview_stack, angle, 0.0f, 0.0f, 1.0f);
  cogl_matrix_stack_translate (modelview_stack,
                               -vertex_a[0], -vertex_a[1], -vertex_a[2]);

  /* Clip planes can only be used when a fixed function backend is in
     use so we know we can directly push this matrix to the builtin
     state */
  _cogl_matrix_entry_flush_to_gl_builtins (ctx,
                                           modelview_stack->last_entry,
                                           COGL_MATRIX_MODELVIEW,
                                           framebuffer,
                                           FALSE /* don't disable flip */);

  planef[0] = 0;
  planef[1] = -1.0;
  planef[2] = 0;
  planef[3] = vertex_a[1];

  switch (ctx->driver)
    {
    default:
      g_assert_not_reached ();
      break;

    case COGL_DRIVER_GLES1:
      GE( ctx, glClipPlanef (plane_num, planef) );
      break;

    case COGL_DRIVER_GL:
    case COGL_DRIVER_GL3:
      planed[0] = planef[0];
      planed[1] = planef[1];
      planed[2] = planef[2];
      planed[3] = planef[3];
      GE( ctx, glClipPlane (plane_num, planed) );
      break;
    }

  cogl_matrix_stack_pop (modelview_stack);
}
示例#8
0
void _glClipPlanef( int plane,Array<Float> equation,int offset ) {
    glClipPlanef( plane,&equation[offset] );
}
示例#9
0
文件: hdOpenGLES.cpp 项目: cdave1/hdk
void hdglClipPlanef(GLenum plane, const float *equation)
{
    glClipPlanef(plane, equation);
}
示例#10
0
文件: hdOpenGLES.cpp 项目: cdave1/hdk
void hdglClipPlane(GLenum plane, const double *equation)
{
    glClipPlanef(plane, (float *)equation);
}