Compiling GLUT using Emscripten - javascript

I am trying to compile the following code:
http://pastebin.com/024Ew4fK
And I am using the following directives:
-s LEGACY_GL_EMULATION=1 -lglut -lGLU -lGL
I got the following warnings:
warning: unresolved symbol: glPointSize
warning: unresolved symbol: glutSolidSphere
warning: unresolved symbol: glutWireSphere
And these are the errors:
WARNING: using emscripten GL immediate mode emulation. This is very limited in what it supports
missing function: glPointSize
uncaught exception: abort(-1) at jsStackTrace#file:///C:/Users/Tyrion/Documents/Proyectos/GLUT_SolarSystem/out.js:1173:13
stackTrace#file:///C:/Users/Tyrion/Documents/Proyectos/GLUT_SolarSystem/out.js:1190:22
abort#file:///C:/Users/Tyrion/Documents/Proyectos/GLUT_SolarSystem/out.js:15901:44
_glPointSize#file:///C:/Users/Tyrion/Documents/Proyectos/GLUT_SolarSystem/out.js:2135:56
_main#file:///C:/Users/Tyrion/Documents/Proyectos/GLUT_SolarSystem/out.js:11483:2
asm._main#file:///C:/Users/Tyrion/Documents/Proyectos/GLUT_SolarSystem/out.js:15672:8
callMain#file:///C:/Users/Tyrion/Documents/Proyectos/GLUT_SolarSystem/out.js:15766:15
doRun#file:///C:/Users/Tyrion/Documents/Proyectos/GLUT_SolarSystem/out.js:15824:42
run/<#file:///C:/Users/Tyrion/Documents/Proyectos/GLUT_SolarSystem/out.js:15835:7
setTimeout handler*run#file:///C:/Users/Tyrion/Documents/Proyectos/GLUT_SolarSystem/out.js:15831:5
#file:///C:/Users/Tyrion/Documents/Proyectos/GLUT_SolarSystem/out.js:15927:1
Why does it say that glPointSize is missing?

These are the features of Glut supported by Emscripten:
https://github.com/kripken/emscripten/blob/master/src/library_glut.js
In order to draw something, for example a sphere, Kripken suggested somewhere to look for a function written in C that does it by itself and then, to port that function to my program.

Related

Eclipse 2021-09 is not showing outline for javascript files

I have eclipse 2021-09 (4.21.0) installed with Wild Web Developer 0.11.0 and Node.js embedder included. Javascript files are opened with Generic Text Editor, syntax highlighting is shown but outline view is empty. Even for the most simple *.js files. Take a look at the included screenshot:
What might be wrong? How to fix it?
EDIT:
The same problems exist in a fresh, newly created workspace, with the same example javascript file.
Quick Outline (Ctrl+O) produces java.util.concurrent.TimeoutException with the following message: LanguageServer not initialized after 10s
Exception Stack Trace:
java.util.concurrent.TimeoutException
at java.base/java.util.concurrent.CompletableFuture.timedGet(CompletableFuture.java:1950)
at java.base/java.util.concurrent.CompletableFuture.get(CompletableFuture.java:2085)
at org.eclipse.lsp4e.LanguageServerWrapper.getServerCapabilities(LanguageServerWrapper.java:706)
at org.eclipse.lsp4e.LanguageServiceAccessor.lambda$12(LanguageServiceAccessor.java:557)
at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:176)
at java.base/java.util.Iterator.forEachRemaining(Iterator.java:133)
at java.base/java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150)
at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173)
at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:497)
at org.eclipse.lsp4e.LanguageServiceAccessor.getLSPDocumentInfosFor(LanguageServiceAccessor.java:558)
at org.eclipse.lsp4e.operations.symbols.LSPSymbolInFileHandler.execute(LSPSymbolInFileHandler.java:40)
at org.eclipse.ui.internal.handlers.HandlerProxy.execute(HandlerProxy.java:283)
at org.eclipse.ui.internal.handlers.E4HandlerProxy.execute(E4HandlerProxy.java:97)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:58)
at org.eclipse.e4.core.internal.di.InjectorImpl.invokeUsingClass(InjectorImpl.java:317)
at org.eclipse.e4.core.internal.di.InjectorImpl.invoke(InjectorImpl.java:251)
at org.eclipse.e4.core.contexts.ContextInjectionFactory.invoke(ContextInjectionFactory.java:173)
at org.eclipse.e4.core.commands.internal.HandlerServiceHandler.execute(HandlerServiceHandler.java:156)
at org.eclipse.core.commands.Command.executeWithChecks(Command.java:488)
at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:487)
at org.eclipse.e4.core.commands.internal.HandlerServiceImpl.executeHandler(HandlerServiceImpl.java:213)
at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.executeCommand(KeyBindingDispatcher.java:308)
at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.press(KeyBindingDispatcher.java:580)
at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.processKeyEvent(KeyBindingDispatcher.java:647)
at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.filterKeySequenceBindings(KeyBindingDispatcher.java:439)
at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher$KeyDownFilter.handleEvent(KeyBindingDispatcher.java:96)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:89)
at org.eclipse.swt.widgets.Display.filterEvent(Display.java:1270)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1059)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1084)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1069)
at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1111)
at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1107)
at org.eclipse.swt.widgets.Widget.wmChar(Widget.java:1536)
at org.eclipse.swt.widgets.Control.WM_CHAR(Control.java:4875)
at org.eclipse.swt.widgets.Canvas.WM_CHAR(Canvas.java:345)
at org.eclipse.swt.widgets.Control.windowProc(Control.java:4753)
at org.eclipse.swt.widgets.Canvas.windowProc(Canvas.java:340)
at org.eclipse.swt.widgets.Display.windowProc(Display.java:4958)
at org.eclipse.swt.internal.win32.OS.DispatchMessage(Native Method)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3624)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1150)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1041)
at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:155)
at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:644)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:551)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:156)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:152)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:203)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:136)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:401)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:255)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:659)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:596)
at org.eclipse.equinox.launcher.Main.run(Main.java:1467)
Session data:
eclipse.buildId=4.21.0.I20210906-0500
java.version=15.0.1
java.vendor=Oracle Corporation
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=en_US
Framework arguments: -product org.eclipse.epp.package.jee.product
Command-line arguments: -os win32 -ws win32 -arch x86_64 -product org.eclipse.epp.package.jee.product
It seems like a symptom of https://github.com/eclipse/wildwebdeveloper/issues/294 . Monitor the issue for potential workarounds and resolutions.

Uncaught InvalidData: data did not match any variant of untagged enum ArgsEnum

I'm enthusiastic about Deno so I'm giving it a try. Found a tutorial on building a REST API here.
So, when I'm trying to run it, I get this InvalidData error:
error: Uncaught InvalidData: data did not match any variant of untagged enum ArgsEnum
at unwrapResponse ($deno$/ops/dispatch_json.ts:43:11)
at Object.sendAsync ($deno$/ops/dispatch_json.ts:98:10)
at async Object.connect ($deno$/net.ts:216:11)
at async Connection.startup (https://deno.land/x/postgres/connection.ts:138:17)
at async Client.connect (https://deno.land/x/postgres/client.ts:14:5)
at async Database.connect (file:///Users/svenhaaf/git/deno/logrocket_deno_api/db/database.js:17:5)
Now, it looks to me that something is wrong when trying to connect to the database, but I can't really figure out what.
What does this InvalidData error mean? How should I fix this?
FYI my deno --version prints:
deno 0.42.0
v8 8.2.308
typescript 3.8.3
Code:
I cloned the repo from https://github.com/diogosouza/logrocket_deno_api, and in config.js, I edited line 1 from const env = Deno.env() to const env = Deno.env, since it looks like Deno.env became an object instead of a method.
The tutorial is not using versioned URLs, and deno-postgres version that is being used is not compatible with v0.42.0, since https://deno.land/x/postgres/mod.ts is pulling from master
Change db/database.js to import from https://deno.land/x/postgres#v0.3.11/mod.ts, since v0.3.11 is the correct version for Deno v0.42.0
import { Client } from "https://deno.land/x/postgres#v0.3.11/mod.ts";
Remember to always use the version in the URL if you don't want the code to stop working when a new Deno or package version is released.

VueJS Grpc-Web module not found

I've created a fresh VueJS application with TypeScript functionality.
When I generate using:
protoc -I=. service.proto --js_out=import_style=typescript:. --grpc web_out=import_style=typescript,mode=grpcwebtext:.
I get the following files:
When I move them to src/_protos in my VueJS project and try to import { PlatformClient } from '#/_protos/ServiceServiceClientPb'; it gives me the following error:
Failed to compile.
./src/_protos/ServiceServiceClientPb.ts
Module not found: Error: Can't resolve './service_pb' in '/Users/theobouwman/dev/woodyshousing/woody_web/src/_protos'
Why is this?
I believe this is resolved in https://github.com/grpc/grpc-web/issues/431.
In short, --js_out=import_style=typescript:. is not supposed to work. You need to do --js_out=import_style=commonjs:. --grpc-web_out=import_style=commonjs+dts,mode=grpcwebtext:.

"ReferenceError: StackTrace is not defined" in Vue app with "stackdriver-errors-js"

I am trying to integrate the stackdriver-error-js library into my Vue project as a module.
The code and the setup:
in package.json
"stackdriver-errors-js": "^0.2.0"
in bootstrap.js
import errorHandler from './error/error-reporting';
in error-reporting.js
import { StackdriverErrorReporter } from 'stackdriver-errors-js';
let errorHandler;
errorHandler = new StackdriverErrorReporter();
errorHandler.start({
key: "{{.Config.StackDriverApiKey}}",
projectId: "{{.Config.StackDriverProject}}",
service: "{{.Config.GoogleCloudProjectID}}",
version: "{{.Copacknfig.GaeEnv}}",
disabled: false
});
export default errorHandler;
The actual error
The error I got now is (console output and test)
[vue-devtools] Ready. Detected Vue v2.4.2
(function testErrorReporting() {window.onerror(null, null, null, null, new Error('Test: Something broke!'));})();
stackdriver-errors.js:109 Uncaught ReferenceError: StackTrace is not defined
at StackdriverErrorReporter.webpackJsonp.556.StackdriverErrorReporter.report (stackdriver-errors.js:109)
at window.onerror (stackdriver-errors.js:67)
at testErrorReporting (<anonymous>:1:40)
at <anonymous>:1:111
and line (stackdriver-errors.js:109)
...
StackTrace.fromError(err).then(function(stack){
...
If you do not load the stackdriver-errors-concat.min.js file, you also manually need to also the stacktrace-js module.
stackdriver-errors expects a StackTrace object to be present.
Since the library you want to use is experimental, and therefore cannot be used in a production environment, it would be better to use a different library which has been tested and validated for production use.
I suggest using this other library instead, which includes features related to Stackdriver error reporting for Node.js and JavaScript.
First of all, install the dependency by running this command:
npm install --save #google-cloud/error-reporting
This will add the dependency automatically to package.json.
In error-reporting.js, you can add the dependencyby adding this to your code (All the parameters are optional):
var errors = require('#google-cloud/error-reporting')({
projectId: 'my-project-id',
keyFilename: '/path/to/keyfile.json',
credentials: require('./path/to/keyfile.json'),
// if true library will attempt to report errors to the service regardless
// of the value of NODE_ENV
// defaults to false
ignoreEnvironmentCheck: false,
// determines the logging level internal to the library; levels range 0-5
// where 0 indicates no logs should be reported and 5 indicates all logs
// should be reported
// defaults to 2 (warnings)
logLevel: 2,
// determines whether or not unhandled rejections are reported to the
// error-reporting console
reportUnhandledRejections: true,
serviceContext: {
service: 'my-service',
version: 'my-service-version'
}
});
After that, use this code to test if the error is properly reported by Stackdriver:
errors.report(new Error('Something broke!'));
Please be aware that this library is currently on a beta stage, so there might be some changes to it in the future.

Wasm compilation exceeds internal limits in this context for the provided arguments

So I am trying to create a WebAssembly Module from an ArrayBuffer.
C code:
#include <stdio.h>
int main() {
printf("hello, world!\n");
return 0;
}
I compile it like so:
$ emcc -O2 hello.c -s WASM=1 -o hello.html
I start a local http server.
And I try to load it in my browser like so:
fetch('hello.wasm')
.then(res => res.arrayBuffer())
.then(buff => WebAssembly.Module(buff));
And I get the following error:
Uncaught (in promise) RangeError: WebAssembly.Module(): Wasm compilation exceeds internal limits in this context for the provided arguments
at fetch.then.then.buff (:1:77)
at
I don't what to make of this error and I can't find anything via web searches.
Any help is kindly appreciated
Thanks!
WebAssembly.Module is synchronous and some browsers don't allow large modules on the main thread to avoid having compilation block the main thread.
Try this instead:
fetch('hello.wasm').then(response =>
response.arrayBuffer()
).then(buffer =>
WebAssembly.instantiate(buffer, importObj)
).then(({module, instance}) =>
instance.exports.f()
);
It's better to use WebAssembly.instantiate because it does compilation and instantiation together and allows the engine to keep at the importObject to make sure things look OK (especially, the WebAssembly.Memory).
Here I assume you want more than main, and instead want to invoke your module's exported function f.

Categories