MATLAB Answers

Off-screen rendering with vr.canvas to capture images

1 view (last 30 days)
Priyanshu Agarwal
Priyanshu Agarwal on 6 Jul 2011
Hi,
I need to generate lots of images of a scene in VRML. I'm using vr.canvas and capture functions to generate images. I'm running my scripts on a remote CPU cluster which doesn't have graphics cards. How can I use the matlab off-screen rendering capabilities to capture VRML scene images using canvas and capture command (I understand that it will be significantly slower)? I tried creating an invisible figure using the following command
fighandle = figure('Position',[100 100 500 500],'Visible','off');
However, the use of the canvas and capture command resulted in the following error. Is there any other way to render off-screen that is compatible with canvas and capture command?
Regards,
Priyanshu
PS: Error Message ------------------------------------------------------------------------ _??? Java exception occurred: javax.media.opengl.GLException: Context not current at com.sun.opengl.impl.x11.X11GLContext.getPlatformExtensionsString(X11GLContext.java:236) at com.sun.opengl.impl.FunctionAvailabilityCache.initAvailableExtensions(FunctionAvailabilityCache.java:116) at com.sun.opengl.impl.FunctionAvailabilityCache.isExtensionAvailable(FunctionAvailabilityCache.java:104) at com.sun.opengl.impl.GLContextImpl.isExtensionAvailable(GLContextImpl.java:351) at com.sun.opengl.impl.x11.X11GLContext.isExtensionAvailable(X11GLContext.java:280) at com.sun.opengl.impl.GLImpl.isExtensionAvailable(GLImpl.java:30493) at com.sun.opengl.impl.GLImpl.initBufferObjectExtensionChecks(GLImpl.java:30638) at com.sun.opengl.impl.GLImpl.checkPackPBODisabled(GLImpl.java:30693) at com.sun.opengl.impl.GLImpl.glReadPixels(GLImpl.java:17458) at com.mathworks.toolbox.sl3d.vrcanvas.VRGLCanvas.capture(VRGLCanvas.java:193) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at com.mathworks.jmi.AWTUtilities$Invoker$3.runWithOutput(AWTUtilities.java:443) at com.mathworks.jmi.AWTUtilities$Invoker$2.watchedRun(AWTUtilities.java:397) at com.mathworks.jmi.AWTUtilities$WatchedRunnable.run(AWTUtilities.java:360) at java.awt.event.InvocationEvent.dispatch(Unknown Source) at java.awt.EventQueue.dispatchEvent(Unknown Source) at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.run(Unknown Source)
Error in ==> canvas.capture at 15 value = typecast(obj.JCanvas.capture(vr.canvas.getNavPanelReservedHeight(obj.NavPanel)), 'uint8');
Error in ==> sample at 18 Ivrml = capture(c);

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!