0

I'm trying to create alternative place to GLSurfaceView where to draw openGL stuff because I want to get that color transparency.

However when I run this function

int[] numConfigs = new int[1];
android.opengl.EGLConfig[] configs = new android.opengl.EGLConfig[1];
int[] attribList = {
                EGL14.EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
                EGL14.EGL_RED_SIZE, 8,
                EGL14.EGL_GREEN_SIZE, 8,
                EGL14.EGL_BLUE_SIZE, 8,
                EGL14.EGL_ALPHA_SIZE, 8,
                EGL14.EGL_DEPTH_SIZE, 16,

                //if this part about transparency is removed between comments
                EGL14.EGL_TRANSPARENT_TYPE,EGL14.EGL_TRANSPARENT_RGB,
                EGL14.EGL_TRANSPARENT_RED_VALUE,8,
                EGL14.EGL_TRANSPARENT_GREEN_VALUE,8,
                EGL14.EGL_TRANSPARENT_BLUE_VALUE,8,
                //everything works fine

                EGL14.EGL_NONE
};

EGL14.eglChooseConfig(mEglDisplay, attribList, 0, configs, 0, 1, numConfigs, 0)

numConfigs[0] is always 0 so there are no matching frame buffer configurations that I can use and I can't continue to do anything except remove transparency stuff from attribList[]. Here is all the options avaialable for attribute list.

Any help how to fix this or work around this would be appreciated.

BDL
  • 21,052
  • 22
  • 49
  • 55
etrusks
  • 363
  • 3
  • 12
  • Are you sure that EGL14.EGL_TRANSPARENT_* is necessary for whatever it is you're trying to achieve? You don't need it for transparency within your scene, and I'm pretty sure you don't need it to have a transparent SurfaceView. This is probably an XY problem. – Columbo Jan 06 '18 at 23:00
  • I need to create a 3d cube that I can rotate using openGL and I have to have transparent background for that cube. Also I have to put other stuff on top of this openGL so `GLSurfaceView.setZOrderOnTop` goes out of the window. So here I tryed to draw my openGL cube on `TextureView` and `SurfaceTexture` but I still cant set transparency for that background. Do you have any suggestions how I could archieve that? What did you mean by XY problem? – etrusks Jan 06 '18 at 23:16
  • @etrusks `What did you mean by XY problem?` https://meta.stackexchange.com/a/66378 – Reaper Jan 06 '18 at 23:51
  • Sounds like a dupe of https://stackoverflow.com/questions/16762633/android-glsurfaceview-transparent-background-without-setzorderontop/16872999 then. Unfortunately it contains no good answer. – Columbo Jan 07 '18 at 10:22

0 Answers0