VG_API_CALL VGboolean vgCreateContextSH(VGint width, VGint height)
{
    /* return if already created */
    if (g_context) return VG_TRUE;

    /* create new context */
    SH_NEWOBJ(VGContext, g_context);
    if (!g_context) return VG_FALSE;

    /* init surface info */
    g_context->surfaceWidth = width;
    g_context->surfaceHeight = height;

    /* setup GL projection */
    glViewport(0,0,width,height);

    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    gluOrtho2D(0,width,0,height);

    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();

    return VG_TRUE;
}
Exemplo n.º 2
0
VG_API_CALL VGPaint vgCreatePaint(void)
{
  SHPaint *p = NULL;
  VG_GETCONTEXT(VG_INVALID_HANDLE);
  
  /* Create new paint object */
  SH_NEWOBJ(SHPaint, p);
  VG_RETURN_ERR_IF(!p, VG_OUT_OF_MEMORY_ERROR,
                   VG_INVALID_HANDLE);
  
  /* Add to resource list */
  shPaintArrayPushBack(&context->paints, p);
  
  VG_RETURN((VGPaint)p);
}