Pode's Forum Posts

  • lokesen : you can't activate HTML5 fullscreen API and browser zoom at the same time. So it's going to break one basic functionnality of C2.

  • I ported a quick GLSL shader to get bilinear resize (zoom & shrink) on Sprites when you need it outside of the regulard browser resize :

    <img src="https://dl.dropbox.com/u/1412774/WebGLBilinearEffectDemo/demo.png" border="0">

    You can get some "smoothing" effect when you resize your image with it :

    <img src="https://dl.dropbox.com/u/1412774/WebGLBilinearEffectDemo/beforeafter.png" border="0">

    The dev page is there : http://www.scirra.com/forum/topic59992_post368714.html#368714, you can now the effect of the various parameter on it.

    The demo : https://dl.dropbox.com/u/1412774/WebGLBilinearEffectDemo/index.html

  • Today, HTML5-compatible browsers already provide bilinear filtering on <canvas> and in WebGL for images when you resize the graphics.

    However, I encountered a situation in which I need a bilinear resize of a Sprite, on only that one. Javascript is too slow to do it realtime, so I implemented that in a WebGL shader.

    <img src="https://dl.dropbox.com/u/1412774/WebGLBilinearEffectDemo/demo.png" border="0">

    This shader is a quick port to C2 of the GLSL shader from there :

    http://www.gamerendering.com/2008/10/05/bilinear-interpolation/

    The bilinear filter works in both directions (image magnification and shrinking).

    It works with 4 parameters :

    <img src="https://dl.dropbox.com/u/1412774/WebGLBilinearEffectDemo/parameters.png" border="0">

    The Texture Width Size is the new width you want to have, Texture HeightSize is the new height, the X pixel size must be set to 1.0/Texture Width, and the same for Y pixel size (1.0/Texture Height).

    You get that kind of after/before effect (however no hope of regrowing your hairs back with a shader...):

    <img src="https://dl.dropbox.com/u/1412774/WebGLBilinearEffectDemo/beforeafter.png" border="0">

    The demo : https://dl.dropbox.com/u/1412774/WebGLBilinearEffectDemo/index.html

    The effect .zip archive : https://dl.dropbox.com/u/1412774/WebGLBilinearEffectDemo/pode_bilinear_filter.1.0.zip (put it inside the effects folder !

    The .capx : https://dl.dropbox.com/u/1412774/WebGLBilinearEffectDemo/WebGLBilinearEffectDemo.capx

  • kenhes : no. You need to use an .emf or .wmf to .svg converter before using this plugin.

  • : the thing is it's up to each browser engine to decide how it's going to render a "FileReader". I'll try to see if I can force a something else than a DOM element <img src="smileys/smiley2.gif" border="0" align="middle" />.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • inkBot srealist : I'm planning to add the "shadow" part when I have the time, and combine it with multiple light sources.

  • Joe7 : to make screenshot of a webgl canvas, you need to have

    preserveDrawingBuffer: true

    set.

    Since I suppose you need it set from the C2 engine, perhaps you can ask Ashley if he can do something like this :

    var canvas = document.getElementById("canvas");

    var gl = getWebGLContext(canvas,{preserveDrawingBuffer: true});

    to make it works.

  • johnELLIS : for the moment, it's best to use it to display pre-drawn SVG files.

  • The problem with SVG is it's support inside the <canvas> tag.

    On FF, you can draw a svg inside a canvas, and retrieve it as a raster image, via toDataURL().

    Chrome (and WebKit in general) has a browser-wide bug : when you draw a SVG on a canvas, the canvas is set as 'tainted', and you can't retrieve the raster image.

    Since everything in C2 is based on canvas, you need to work with it. That's why my SVG plugin is on hold, I'm waiting for an update on the WebKit side...

  • sqiddster : you can try to have a layer under the current one, with all the Sprite duplicated. On that layer, you need to blur the Sprite, change the color of the blurred result, and enlarge a bit the layer (or the Sprites), to make add that outline.

    If it's to slow, you can "snapshot" the game, load that snapshot in a Sprite, and apply that effect to the Sprite.

  • dsarchy : that plugin lacks all the tools added by Ashley on the regular "Audio" object, since I can't add them to my plugin (lack of time). You need to ask Ashley the ability to load an audio file via base64 URL, like he has done for the "Sprite" object.

  • Ashley : OK, thanks for the answer.

    I was thinking about that because when I people were asking for a Mode7 shader, I realised that without vertex shader, it's going to be difficult to do it properly.

  • bjadams : it's great that you found a use for the plugin !

    When I'll have time, I'm going to check the problem with the addition of new gestures.

  • Ashley : OK. I'm a bit sad, because having the possibilty to retrieve effects applied on Sprites would be great for a few things...

    I have another questions about shaders. The Sprite is seens as a quad with four vertices. So there is no need for a vertex shader.

    However, having the possibility to tesselate to quad can open the possibility to apply vertex shaders on the tesselated Sprite. That would help to create crumpled paper effects on a Sprite, or page flip. Are you planning to add a more refined way to deal wth vertex shaders, or is it out of the scope of C2 ?

  • The question is more specifically for ASHLEY.

    For some examples and plugins I'm planning to create, it would be useful to grab a Sprite on which a shader has been applied. I can now easily grab the <img> of a Sprite, when WebGL isn't used. However, I don't know what and where to grab to get that (because you can't easily convert a WebGLTexture back to a <canvas>).

    Ashley is there an easy way to do that ?