Commits

Michael Ludwig  committed 87628bb

Correctly set surface on context manager after creation, and other minor cleanup to get implementations working.

  • Participants
  • Parent commits 6b87b31

Comments (0)

Files changed (3)

File ferox-renderer/ferox-renderer-impl/src/main/java/com/ferox/renderer/impl/AbstractFramework.java

      *            low-level graphics work for resources
      * @throws NullPointerException if surfaceFactory or any driver is null
      */
-    public AbstractFramework(SurfaceFactory surfaceFactory, int numThreads, ResourceDriver... drivers) {
+    public AbstractFramework(SurfaceFactory surfaceFactory, ResourceDriver... drivers) {
         if (surfaceFactory == null)
             throw new NullPointerException("SurfaceFactory cannot be null");
         
                     AbstractOnscreenSurface created = surfaceFactory.createOnscreenSurface(AbstractFramework.this, options, 
                                                                                            contextManager.getSharedContext());
                     surfaces.add(created);
-                    
                     if (created.getOptions().getFullscreenMode() != null)
                         fullscreenSurface = created;
+                    
+                    contextManager.setActiveSurface(created, 0);
                     return created;
                 }
             }
             public TextureSurface call() throws Exception {
                 AbstractTextureSurface created = surfaceFactory.createTextureSurface(AbstractFramework.this, options, 
                                                                                      contextManager.getSharedContext());
-                
+                surfaces.add(created);
+
                 // Mark all textures as non-disposable
                 if (created.getDepthBuffer() != null)
                     resourceManager.setDisposable(created.getDepthBuffer(), false);
                 for (int i = 0; i < created.getNumColorBuffers(); i++)
                     resourceManager.setDisposable(created.getColorBuffer(i), false);
                 
-                surfaces.add(created);
+                contextManager.setActiveSurface(created, 0);
                 return created;
             }
         }, false);

File ferox-renderer/ferox-renderer-impl/src/main/java/com/ferox/renderer/impl/AbstractSurface.java

                     // Must force a release in case this surface was a context provider
                     framework.getContextManager().forceRelease(AbstractSurface.this);
                     destroyImpl();
+                    framework.markSurfaceDestroyed(AbstractSurface.this);
                     return null;
                 }
             }, true);

File ferox-renderer/ferox-renderer-impl/src/main/java/com/ferox/renderer/impl/drivers/AbstractTextureResourceDriver.java

     }
     
     @Override
+    public TextureHandle init(Resource resource) {
+        return new TextureHandle((Texture) resource);
+    }
+    
+    @Override
     public void reset(Object handle) {
         if (handle instanceof TextureHandle) {
             TextureHandle h = (TextureHandle) handle;