Exemplo n.º 1
0
/**
 * Check if the viewport/scissor size has not yet been initialized.
 * Initialize the size if the given width and height are non-zero.
 */
void
_mesa_check_init_viewport(GLcontext *ctx, GLuint width, GLuint height)
{
   if (!ctx->ViewportInitialized && width > 0 && height > 0) {
      /* Note: set flag here, before calling _mesa_set_viewport(), to prevent
       * potential infinite recursion.
       */
      ctx->ViewportInitialized = GL_TRUE;
      _mesa_set_viewport(ctx, 0, 0, width, height);
      _mesa_set_scissor(ctx, 0, 0, width, height);
   }
}
Exemplo n.º 2
0
Arquivo: scissor.c Projeto: RAOF/mesa
/**
 * Called via glScissor
 */
void GLAPIENTRY
_mesa_Scissor( GLint x, GLint y, GLsizei width, GLsizei height )
{
   GET_CURRENT_CONTEXT(ctx);

   if (MESA_VERBOSE & VERBOSE_API)
      _mesa_debug(ctx, "glScissor %d %d %d %d\n", x, y, width, height);

   if (width < 0 || height < 0) {
      _mesa_error( ctx, GL_INVALID_VALUE, "glScissor" );
      return;
   }

   _mesa_set_scissor(ctx, x, y, width, height);
}
Exemplo n.º 3
0
void st_make_current(struct st_context *st,
                     struct st_framebuffer *draw,
                     struct st_framebuffer *read)
{
   if (st) {
      GLboolean firstTime = st->ctx->FirstTimeCurrent;
      _mesa_make_current(st->ctx, &draw->Base, &read->Base);
      /* Need to initialize viewport here since draw->Base->Width/Height
       * will still be zero at this point.
       * This could be improved, but would require rather extensive work
       * elsewhere (allocate rb surface storage sooner)
       */
      if (firstTime) {
         GLuint w = draw->InitWidth, h = draw->InitHeight;
         _mesa_set_viewport(st->ctx, 0, 0, w, h);
         _mesa_set_scissor(st->ctx, 0, 0, w, h);

      }
   }
   else {
      _mesa_make_current(NULL, NULL, NULL);
   }
}