Monday, May 24, 2010

Problem with code which works in compiled mode and fails in hosted mode

Hi

I'm using the gwtgl library. There's one method invocation in it which
throws an exception in hosted mode but seems to work OK in compiled
mode. I suspect that the answer is obvious... Any suggestions would be
greatly appreciated...

The actual lines of code are:
float [] perspectiveMatrix = createPerspectiveMatrix(45, 1,
0.1f, 1000);
WebGLUniformLocation uniformLocation =
glContext.getUniformLocation(shaderProgram, "perspectiveMatrix");
checkError();

glContext.uniformMatrix4fv(uniformLocation, false,
perspectiveMatrix);

and as I said, it works fine compiled and fails in hosted mode. If I
stop the debugger at glContext.uniformMatrix4fv(.... it gets there OK,
but as soon as I step into it the debugger it fails at:

protected JsValue doInvoke(String name, Object jthis, Class<?>[] types,
Object[] args) throws Throwable {
TreeLogger branch = host.getLogger().branch(TreeLogger.SPAM,
"Invoke native method " + name, null);
CompilingClassLoader isolatedClassLoader = getIsolatedClassLoader();
JsValueOOPHM jsthis = new JsValueOOPHM();
Class<?> jthisType = (jthis == null) ? Object.class : jthis.getClass();
JsValueGlue.set(jsthis, isolatedClassLoader, jthisType, jthis);
branch.log(TreeLogger.SPAM, " this=" + jsthis);

int argc = args.length;
JsValueOOPHM argv[] = new JsValueOOPHM[argc];
for (int i = 0; i < argc; ++i) {
argv[i] = new JsValueOOPHM();
JsValueGlue.set(argv[i], isolatedClassLoader, types[i], args[i]);
branch.log(TreeLogger.SPAM, " arg[" + i + "]=" + argv[i]);
}
JsValueOOPHM returnVal = new JsValueOOPHM();
try {
channel.invokeJavascript(isolatedClassLoader, jsthis, name, argv,
returnVal); <--- EXCEPTION THROWN HERE
branch.log(TreeLogger.SPAM, " returned " + returnVal);
} catch (Throwable t) {
branch.log(TreeLogger.SPAM, "exception thrown", t); <---
Exception is "invoke of
@com.googlecode.gwtgl.binding.impl.WebGLMethodsBinding::uniformMatrix4fv(Lcom/googlecode/gwtgl/binding/WebGLUniformLocation;Z[F)"
failed
throw t;
}

Thanks

Alan

(exception trace is below)


> 17:11:06.785 [ERROR] [webgltest] Failed to create an instance of
> 'com.google.gwt.core.client.impl.SchedulerImpl' via deferred binding
> com.google.gwt.core.client.JavaScriptException: (String): invoke of
> @com.google.gwt.core.client.JavaScriptObject::createArray() failed
> at
> com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:195)
> at
> com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:120)
> at
> com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:507)
> at
> com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:264)
> at
> com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91)
> at
> com.google.gwt.core.client.JavaScriptObject$.createArray(JavaScriptObject.java)
> at
> com.google.gwt.core.client.impl.SchedulerImpl.<init>(SchedulerImpl.java:251)
> at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
> Method)
> at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown
> Source)
> at
> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
> at java.lang.reflect.Constructor.newInstance(Unknown Source)
> at
> com.google.gwt.dev.shell.ModuleSpace.rebindAndCreate(ModuleSpace.java:422)
> at
> com.google.gwt.dev.shell.GWTBridgeImpl.create(GWTBridgeImpl.java:39)
> at com.google.gwt.core.client.GWT.create(GWT.java:98)
> at
> com.google.gwt.core.client.impl.SchedulerImpl.<clinit>(SchedulerImpl.java:76)
> at com.google.gwt.core.client.impl.Impl.exit(Impl.java:207)
> 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.google.gwt.dev.shell.ModuleSpace.onLoad(ModuleSpace.java:374)
> at
> com.google.gwt.dev.shell.OophmSessionHandler.loadModule(OophmSessionHandler.java:185)
> at
> com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:380)
> at
> com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:222)
> at java.lang.Thread.run(Unknown Source)

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment