GLRenderer.convertTexture Error - [1343799062848] - ERROR : Failed to upload

Started by hika00, August 01, 2012, 07:44:05 AM

Previous topic - Next topic

hika00

I got Logger message

jPCT-AE  [1343799062848 ] - EEROR: Failed to upload textrue!

from

GLRenderer.convertTexture(Texture) line: 982

and here is all stacks.

Logger.log(String, int) line: 189   
GLRenderer.convertTexture(Texture) line: 982   
GLRenderer.setTextures(Object3D, int, int, FrameBuffer, World) line: 2339   
GLRenderer.drawVertexArray(VisList, int, int, FrameBuffer, World) line: 2252   
World.draw(FrameBuffer, boolean, int) line: 1354   
World.draw(FrameBuffer) line: 1135   
bs.renderDraw() line: 157   
bsGLView.run() line: 90   
Thread.run() line: 856   

I made SurfaceView and SurfaceHolder because GLSurfaceView lost all context when onPause.

public class bsGLView extends SurfaceView implements Callback, Runnable{

   private bs _bs;
   
   private SurfaceHolder _holder;
   private EGL10 _egl;
   private EGLConfig _eglConfig;
   private EGLDisplay _eglDisplay;
   private EGLSurface _eglSurface;
   private EGLContext _eglContext;
   private GL10 _gl;
   private Thread _thread;
   private boolean _isRunning = false;
   
   public bsGLView( Activity $act, String $path, String $url ){
      super( $act.getApplication() );
      getHolder().setFormat( PixelFormat.RGBA_8888 );
      getHolder().addCallback( this );
      _bs = new bs( $act, $path, $url );
   }
   @Override
   public void surfaceCreated( SurfaceHolder $holder ){}
   @Override
   public void surfaceChanged( SurfaceHolder $holder, int $format, int $width, int $height){
      Log.i("bs", "changed");
      if( _gl == null ){
         _holder = $holder;
         _egl = (EGL10)EGLContext.getEGL();
         _eglDisplay = _egl.eglGetDisplay( EGL10.EGL_DEFAULT_DISPLAY );
         if( !_egl.eglInitialize( _eglDisplay, new int[2] ) ){
            throw new Error("egl init");
         }
         {
            EGLConfig[] configs = new EGLConfig[1];
            if( !_egl.eglChooseConfig( _eglDisplay, new int[]{ EGL10.EGL_DEPTH_SIZE, 16, EGL10.EGL_RENDERABLE_TYPE, 4, EGL10.EGL_NONE }, configs, 1, new int[]{0x3098, 2} ) ){
               throw new Error("egl config");
            }
            _eglConfig = configs[0];
         }
         _eglContext = _egl.eglCreateContext( _eglDisplay, _eglConfig, EGL10.EGL_NO_CONTEXT, null );
         if( _eglContext == EGL10.EGL_NO_CONTEXT ){
            throw new Error("egl context");
         }
         _eglSurface = _egl.eglCreateWindowSurface( _eglDisplay, _eglConfig, _holder, null );
         if( _eglSurface == EGL10.EGL_NO_SURFACE ){
            throw new Error("egl surface");
         }
         _gl = (GL10) _eglContext.getGL();
         if( !_egl.eglMakeCurrent( _eglDisplay, _eglSurface, _eglSurface, _eglContext ) ){
            throw new Error("egl current");
         }
         _bs.viewInit( this );
      }else{
         _eglSurface = _egl.eglCreateWindowSurface(_eglDisplay, _eglConfig, _holder, null );
         _egl.eglMakeCurrent( _eglDisplay, _eglSurface, _eglSurface, _eglContext );
      }
      _bs.renderSurfaceChanged( _gl, $width, $height );
      _egl.eglSwapBuffers(_eglDisplay, _eglSurface);
      _bs.renderDraw();
      _isRunning = true;
      _thread = new Thread( this );
      _thread.start();
   }
   @Override
   public void surfaceDestroyed( SurfaceHolder $holder ){
      Log.i("bs", "destroy");
      pause();
      _bs.viewFinish();
   }
   @Override
   public void run(){
      while( _isRunning ){
         _bs.renderDraw();
      }
   }
   public void pause(){
      Log.i("bs", "pause");
      if( _eglSurface != null ){
         _egl.eglMakeCurrent( _eglDisplay, EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_SURFACE, _eglContext );
         _egl.eglDestroySurface( _eglDisplay, _eglSurface );
         _eglSurface = null;
      }
      _isRunning = false;
      while( true ){
         try{
            _thread.join(); break;
         }catch( Exception $e ){}
      }
      _bs.viewPause();
   }
   public void resume(){
      Log.i("bs", "resume");
      _bs.viewResume();
   }
   public void activityResult( int $request, int $result, Intent $data ){
      _bs.activityResult( $request, $result, $data );
   }
}

any good idea?

EgonOlsen

It would be a good idea to post the actual stacktrace and not just some interpretation of yours, because the line that causes this should be 882, not 982 and the typos are not part of the message either. Anyway, this error will be raised if no texture id could be generated by OpenGL ES. Maybe there's a reason why onPause() destroys the context and with your code, you might be fiddling around with an invalid context causing basic gl operations to fail!?
When does this happen? At startup or after a resume? In addition, i can't spot the creation of a FrameBuffer in your code. Where are you doing that and which context are you using for it?