Ejemplo n.º 1
0
static void
viewport(struct gl_context *ctx, GLint x, GLint y, GLsizei width,
         GLsizei height)
{
   struct gl_viewport_inputs input = { x, y, width, height };

   /* Clamp the viewport to the implementation dependent values. */
   clamp_viewport(ctx, &input.X, &input.Y, &input.Width, &input.Height);

   /* The GL_ARB_viewport_array spec says:
    *
    *     "Viewport sets the parameters for all viewports to the same values
    *     and is equivalent (assuming no errors are generated) to:
    *
    *     for (uint i = 0; i < MAX_VIEWPORTS; i++)
    *         ViewportIndexedf(i, 1, (float)x, (float)y, (float)w, (float)h);"
    *
    * Set all of the viewports supported by the implementation, but only
    * signal the driver once at the end.
    */
   for (unsigned i = 0; i < ctx->Const.MaxViewports; i++)
      set_viewport_no_notify(ctx, i, input.X, input.Y, input.Width, input.Height);

   if (ctx->Driver.Viewport)
      ctx->Driver.Viewport(ctx);
}
Ejemplo n.º 2
0
/**
 * Set new viewport parameters and update derived state.
 * Usually called from _mesa_Viewport().
 * 
 * \param ctx GL context.
 * \param idx    Index of the viewport to be updated.
 * \param x, y coordinates of the lower left corner of the viewport rectangle.
 * \param width width of the viewport rectangle.
 * \param height height of the viewport rectangle.
 */
void
_mesa_set_viewport(struct gl_context *ctx, unsigned idx, GLfloat x, GLfloat y,
                    GLfloat width, GLfloat height)
{
   set_viewport_no_notify(ctx, idx, x, y, width, height);

   if (ctx->Driver.Viewport)
      ctx->Driver.Viewport(ctx);
}
Ejemplo n.º 3
0
static void
viewport_array(struct gl_context *ctx, GLuint first, GLsizei count,
               const struct gl_viewport_inputs *inputs)
{
   for (GLsizei i = 0; i < count; i++) {
      set_viewport_no_notify(ctx, i + first, inputs[i].X, inputs[i].Y,
                             inputs[i].Width, inputs[i].Height);
   }

   if (ctx->Driver.Viewport)
      ctx->Driver.Viewport(ctx);
}