deanm / plask Goto Github PK
View Code? Open in Web Editor NEWPlask is a multimedia programming environment.
Home Page: www.plask.org
License: Other
Plask is a multimedia programming environment.
Home Page: www.plask.org
License: Other
Can we consider replacing setInterval(function() {
obj.redraw();
}, 1000 / fps);
with something similar to requestAnimFrame where setTimeout would be called at the end of obj.redraw? Right now if I render something heavy that takes more that 1000 / fps milliseconds the app becomes so unresponsive that is even hard to close it.
Any text that is drawn after calling writePDF()
will not appear in PDFs generated by subsequent calls to writePDF()
.
Try this demo sketch to reproduce:
var plask = require("plask");
var pdf = plask.SkCanvas.createForPDF(500, 500);
var paint = new plask.SkPaint();
paint.setStrokeWidth(10);
paint.setFontFamily("Myriad Pro");
paint.setTextSize(36);
for(var t, i = 0; i < 10; ++i){
t = i / 9;
paint.setColor(t * 255, 0, 0, 255);
pdf.save();
pdf.translate(plask.lerp(100, pdf.width - 100, t), 100);
pdf.drawLine(paint, 0, 0, 0, pdf.height - 200);
pdf.drawText(paint, i, 0, t * (pdf.height - 200));
pdf.restore();
pdf.writePDF(__dirname + "/output_" + i + ".pdf");
}
process.exit();
The desired outcome should be 10 lines with numbers from 0 to 9 in the final .pdf, but only the first number is drawn.
It's very possible this could be a Skia bug as well, but I'm posting here first just in case. Any idea what could be the cause?
If 3d2d is passed into simpleWindow, the resulting canvas seems flipped. The x, y coordinates are off, and more importantly text is rendered incorrectly.
Mouse events are scaled according to the highdpi setting. However if highdpi is set but the screen didn't support highdpi, the window is created without highdpi but the mouse events are still scaled. This part of the code will have to have some way of knowing that highdpi failed.
In webgl_constants there are
WEBGL_CONSTANTS_EACH(SRGB, 0x8C40)
WEBGL_CONSTANTS_EACH(SRGB8, 0x8C41)
WEBGL_CONSTANTS_EACH(SRGB8_ALPHA8, 0x8C43)
but this one is missing
SRGB_ALPHA = SRGB_ALPHA_EXT = 0x8C42
Any particular reason why?
The correct number of parameters for writePDF
is 0
as you specify the filename in
createForPDF(filename, page_width, page_height, content_width, content_height)
It would be nice to be able to use certain parts of Plask without loading all of plask.js. In the past I've pulled the Vec3 / Mat4 stuff out into another file to use in Node.js projects.
Maybe something like:
I'm willing to do this if we think it's a good idea. It would certainly make using pieces of plask.js easier, and might help development for other platforms.
please see pex-gl/pex#17 (comment)
Whenever i get exception in my draw function it is caught and displayed in the console. But because there is no more drawing code executed they are printed @ 30fps which is annoying and unreadable. Because it's already cought by Plask I can't catch using process.on('uncaughtException', ...). Can we have something like this in redraw() ?
var prevException = null;
...
if (prevException != '' + ex) {
prevException = '' + ex;
sys.error('Exception caught in simpleWindow draw:\n' + ex + '\n' + ex.stack);
}
Using this.canvas.writeImage('png', 'test.png');
produces image upside down. The following code will draw red square in the top left corner but it's in the bottom left in the resulting png.
Using build 5d26b85
var plask = require('plask');
plask.simpleWindow({
type: '2d',
init: function() {
this.paint.setFill();
this.paint.setColor(255, 0, 0, 255);
this.canvas.drawRect(this.paint, 0, 0, 50, 50);
this.canvas.writeImage('png', 'test.png');
}
})
E.g.
This doesn't exist anymore http://www.plask.org/docs/v2.0/api/all.html#skCanvas_eraseColor
SkCanvas#eraseColor(r, g, b, a)
But this does and it's not on the website http://www.plask.org/docs/v2.0/api/all.htm
SkCanvas#clear(r, g, b, a)
Consider the following code
var image = getImageData();
var textureData1 = new Uint8Array(image.buf, image.offset, image.length);
var textureData2 = new Uint8Array(image.buf.slice(image.offset, image.offset + image.length));
GetTypedArrayBytes(args[6], &textureData1, &size1)
//size1 = 11184952 -> length of the whole image buffer
GetTypedArrayBytes(args[6], &textureData2, &size2)
//size2 = 8388608 -> image.length
Getting this error when trying to compile newest code
ld: library not found for -lskia_skgpu
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Stencil buffer doesn't work - no drawing calls are clipped/blocked/rejected no matter what I have written to the stencil buffer before. I guess it's not enabled by default and there is no option in simpleWindow to enable/disable it. Therefore I would be nice to have:
plask.simpleWindow({
settings: {
width: 800,
height: 600,
type: '3d',
vsync: true,
multisample: true,
stencil: true //NEW
},
...
)
Similar to WebGL Canvas context:
var gl = canvas.getContext('experimental-webgl', {stencil: true});
The code below fails
var viewport = this.gl.getParameter(this.gl.VIEWPORT);
console.log(viewport);
with that message
Error: Unimplemented.
How difficult woud it be to make it work?
I have found set fullscreen in the docs but not in code http://www.plask.org/refv3.html#NSWindow_setFullscreen
Is this something still waiting for a push?
This has low priority because all you can query is filtering and wrap modes. Stuff to query texture size doesn't exists in OpenGL ES and WebGL
glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_WIDTH, &width); //NOPE
I'm trying to intercept plask application exit event. As there is not exit() callback similar to init() or draw() I tried listening to 'exit' event on process object but nothing happens when I press Cmd+Q
process.on('exit', function() {
console.log("exited");
});
Available options are here
http://msdn.microsoft.com/en-us/library/ie/dn302413(v=vs.85).aspx
With gl.COLOR_ATTACHMENT1, gl.COLOR_ATTACHMENT2, ... available if WEBGL_draw_buffers is enabled?
This is more of a todo list for me. Will do pull requests.
gl.getSupportedExtensions() -> []
gl.getExtension(name) -> null
gl.drawingBufferWidth -> this.width
gl.drawingBufferHeight -> this.height
Why SkCanvas
is BGRA
but SkCanvas.pixels
are RGBA
? texImage2DSkCanvas
is using GL_BGRA
so I get different results. I was supposed to update my code to always use pixels
but if I do that for texture upload i get inverted R & B channels.
What would be a good way to know that playback of video or audio has finished? The currentTime value jumps to 0 after file is finished so it's hard to know that we've reached the end.. Can we emit some JS event on AVPlayerItemDidPlayToEndTimeNotification
?
I'm getting following error when using player.seekToTime(1.1)
2016-03-04 09:25:43.907 Plask[26985:5357889] CMTimeMakeWithSeconds(1.100 seconds, timescale 1): warning: error of -0.100 introduced due to very low timescale
I can see that you have marked plask_bindings.mm#L7491 as FIXME
, why?
CMTime time = (curtime.flags & kCMTimeFlags_Valid) ?
CMTimeMakeWithSeconds(args[0]->NumberValue(), curtime.timescale) :
CMTimeMakeWithSeconds(args[0]->NumberValue(), 50000); // FIXME
I'm trying to replace currently playing video with another one
This works but when the second video finished it starts first one (as expected)
this.player.appendFile(firstFile);
this.player.play();
....
this.player.appendFile(secondFile);
this.player.playNext()
var tex = this.player.currentFrameTexture();
If I clean the queue with removeAll()
I can't get the texture from the second video. It stays null even though currentDuration()
updates properly (which mean video started loading)
this.player.appendFile(firstFile);
this.player.play();
....
this.player.removeAll(); //X_X
this.player.appendFile(secondFile);
this.player.playNext()
var tex = this.player.currentFrameTexture();
//tex is forever null
/Applications/Xcode.app/Contents/Developer/Toolchains/
XcodeDefault.xctoolchain/usr/include/c++/v1/utility:277:5:
The parameter for this explicitly-defaulted copy constructor is const,
but a member or base requires it to be non-const
/Users/vorg/Dev/plask/plask_bindings.mm:35:10:
...
/Applications/Xcode.app/Contents/Developer/Toolchains/
XcodeDefault.xctoolchain/usr/include/c++/v1/string:439:10: In file included from...
/Users/vorg/Dev/plask/plask_bindings.mm:455:9: note: in instantiation of template class
'std::__1::pair<std::__1::__map_iterator
<std::__1::__tree_iterator<std::__1::__value_type<unsigned int,
v8::UniquePersistent<v8::Value> >,
std::__1::__tree_node<std::__1::__value_type<unsigned int,
v8::UniquePersistent<v8::Value> >, void *> *, long> >, bool>'
requested here
map.emplace(std::piecewise_construct,
var protocol = require('https');
protocol.get('https://google.com', function(res) {
var body = '';
res.on('data', function(chunk) {
body += chunk;
});
res.on('end', function() {
console.log(body);
});
});
throws
Plask(4104,0x7fff7d7e7310) malloc: *** error for object 0x30100000000:
pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
[Finished in 0.5s with exit code -6]
Hi, i just came across Plask while looking for a method to output graphics from node.js.
It looks great and seems to work great as well.
cheers,
Oliver
If you take the 500_triangle example with multisampling disabled
settings: {
...
multisample: false
},
and disable clearing color buffer by changing
gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
to
gl.clear(gl.DEPTH_BUFFER_BIT);
everything starts to flickr. Why? It's common technique for generative painting so I would expect it to work.
I've been following this guide on how to make a flame chart from node v8.log profile and they mention
With a version of node that has a --log-timer-events as part of v8-options, run the app in profiling mode and load the resulting v8.log into Chrome at chrome://tracing.
Is --log-timer-events
a compilation option? My graphs are empty so not sure if these log timer evens are properly logged. I'm running:
Plask.app/Contents/MacOS/Plask --prof --track_gc_object_stats --trace_gc_verbose --log_timer_events main.js
Any other ways to profile a Plask app?
https://github.com/vorg/plask/blob/pull-nssound/plask.js#L32
//Tried to do pull request but git added all my commits ever to this branch..
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.