Ioseph Martinez Pelayo

OpenVG: querying and choosing different surface color formats

Discussion created by Ioseph Martinez Pelayo Employee on Jun 12, 2013

When using OpenVG you can select different surface formats where to draw: 16bit, 32bit, 24bit, etc. Each one of those can have a different color ordering: ARGB, RGBA, so, you start having different options to choose.

 

If you want to select different color format vs the one that comes as default from the examples, you need to get all the available configurations, and choose the one you need (don't create it by your own, you may miss a value)

 

...

EGLConfig eglcfgs[256];

...

cfgAttribs[ix++] = EGL_RENDERABLE_TYPE; cfgAttribs[ix++] = EGL_OPENVG_BIT;

cfgAttribs[ix]   = EGL_NONE;

...

eglChooseConfig(gEGLdsp, cfgAttribs, eglcfgs, 256, &gEGLnumCfg);        // get all available configs

 

 

for(i = 0; i<gEGLnumCfg; i++){

  eglGetConfigAttrib(gEGLdsp, eglcfgs[i], EGL_ALPHA_SIZE, &alpha[i]);

  eglGetConfigAttrib(gEGLdsp, eglcfgs[i], EGL_GREEN_SIZE, &green[i]);

 

 

  //now for each one of the supported configurations,

  //you have the size of the alpha channel and the green channel,

  //that can easily point you to //the 32bit one, 24bit one and 16bit one

  //once you know which one you need, just pick that eglcfgs[i] for eglCreateContext,

  //to create the egl surface... (pbuffer, pixmap, window, etc)

 

 

}

Outcomes