Giter VIP home page Giter VIP logo

plask's People

Contributors

deanm avatar ertdfgcvb avatar notlion avatar vorg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

plask's Issues

Replace setInterval with setTimeout for animation loop

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.

Cannot draw text after calling SkCanvas.writePDF()

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?

3d2d results in flipped canvas

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 coordinates off when highdpi fails

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.

Add SRGB_ALPHA

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?

Split plask.js into multiple packages and publish to NPM.

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:

  • plask
    • plask-mac / ubuntu / windows (window / mouse / key bindings)
    • plask-math (Vecs, Mats)
    • plask-simplewindow (easy windowing)
    • plask-webgl (MagicProgram, etc)

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.

Prevent 'rolling' exception errors in the console

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);
}

Saved PNGs are upside down

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');
  }
})

GetTypedArrayBytes is wrongly guessing size base on underlying ArrayBuffer

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

Skia GPU version is missing in deps

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 support

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});

WebGL's getParameter is not implemented

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?

Implement getTexParameter

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

No exit callback in simpleWindow

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");
});

Implement missing WebGL functionality

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

SkCanvas.pixels RGBA vs BGRA

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.

Add AVPlayer onended callback

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?

AVPlayer timescale warnings

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

AVPlayer removeAll breaks texture?

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

Plask doesn't compile on OSX10.10 and XCode 6.1 (map.emplace)

/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,

https crashes with breakpoint in malloc_error_break

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]

still maintained?

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.

  • is it still maintained?
  • how to i make a full screen window with setFullscreen and getScreenSize().with?
  • are there more examples then the basic ones, like more related to Plask ?

cheers,
Oliver

3d window is flickering if multisampling is disabled

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.

Plask profling

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?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.