Exemplo n.º 1
0
void glBegin(GLenum mode)
{
  GET_CURRENT_CONTEXT(ctx);

  switch (mode) {
  case GL_POINTS:
  case GL_LINES:
  case GL_LINE_LOOP:
  case GL_TRIANGLES:
  case GL_TRIANGLE_STRIP:
  case GL_QUADS:
    break;
  default:
    _sgl_error(ctx, GL_INVALID_ENUM, "glBegin(): Invalid mode\n");
    return;
  }

  ctx->render_state.type = 0;
  ctx->render_state.current_exec_primitive = mode;
  _math_matrix_mul_matrix(&ctx->model_projection_matrix,
                          &ctx->viewport.window_map,
                          ctx->projection_matrix_stack.top);
  _math_matrix_mul_matrix(&ctx->model_projection_matrix,
                          &ctx->model_projection_matrix,
                          ctx->modelview_matrix_stack.top);
}
Exemplo n.º 2
0
void glDrawElements(GLenum mode, GLsizei count,
                    GLenum type, const GLvoid *indices)
{
  GET_CURRENT_CONTEXT(ctx);
  ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);

  if (!(ctx->clientstate_flags & GL_VERTEX_ARRAY))
    return;

  _math_matrix_mul_matrix(&ctx->model_projection_matrix,
                          &ctx->viewport.window_map,
                          ctx->projection_matrix_stack.top);
  _math_matrix_mul_matrix(&ctx->model_projection_matrix,
                          &ctx->model_projection_matrix,
                          ctx->modelview_matrix_stack.top);
  switch (mode) {
  case GL_POINTS:
  case GL_LINES:
  case GL_TRIANGLES:
  case GL_QUADS:
    break;
  default:
    _sgl_error(ctx, GL_INVALID_ENUM, "glDrawElements(): Invalid mode\n");
    return;
  }

  ctx->varray.mode = mode;
  ctx->varray.count = count;
  ctx->varray.type = type;
  ctx->varray.indices_ptr = indices;

  ctx->render_state.type = GL_VERTEX_ARRAY;
  _sgl_pipeline_iteration();
}
Exemplo n.º 3
0
/**
 * Calculate the combined modelview-projection matrix.
 *
 * \param ctx GL context.
 *
 * Multiplies the top matrices of the projection and model view stacks into
 * __struct gl_contextRec::_ModelProjectMatrix via _math_matrix_mul_matrix()
 * and analyzes the resulting matrix via _math_matrix_analyse().
 */
static void
calculate_model_project_matrix( struct gl_context *ctx )
{
    _math_matrix_mul_matrix( &ctx->_ModelProjectMatrix,
                             ctx->ProjectionMatrixStack.Top,
                             ctx->ModelviewMatrixStack.Top );

    _math_matrix_analyse( &ctx->_ModelProjectMatrix );
}
Exemplo n.º 4
0
static void
calculate_model_project_matrix( GLcontext *ctx )
{
      _math_matrix_mul_matrix( &ctx->_ModelProjectMatrix,
			       &ctx->ProjectionMatrix,
			       &ctx->ModelView );

      _math_matrix_analyse( &ctx->_ModelProjectMatrix );
}