Apparently this shader code: https://github.com/bmfs/glslTest_openfl from this thread:http://www.openfl.org/archive/community/feature-requests/custom-glsl-shaders-drawtiles/ Is the answer to my problems. graphics.drawTiles() http://www.openfl.org/archive/ community/programming-haxe/blending-modes/ pixel bender: http://www.flashmagazine.com/tutorials/detail/using_pixel_bender_to_calculate_information/ http://www.openfl.org/archive/community/ feature-requests /custom-glsl-shaders-drawtiles/ OpenGLSimpleView or HerokuShader i want to write my version of drawTiles() using openfl-stage3d, so it would be possible to use custom shade heardtheword: In looking at how NME is structured it seems plausible that there could be a GPUProg object stored in GraphicsJob and then passed to HardwareContext. This would give the ability to use shaders on points, lines, and fill objects as well as Tilesheet. I think this would be abstract enough to use for HLSL as well. Here is my concept of how it could work in Haxe. There should probably be some type of caching for duplicate shaders although Haxe will only see the final linked program. // static function, returns a GPUProg object? var program = Graphics.compileShader(vertexShader, pixelShader); // in rendering code graphics.attachShader(program); tilesheet.drawTiles... // is this needed or could it be automatically detached at endFill? graphics.detachShader(); I'm willing to take a shot at this but would love feedback if you feel this isn't heading in the right direction. EDIT: Any reason OGLProg::createShader adds the precision information for OpenGL ES2? You can do that directly in the shader using the #ifdef directive. #ifdef GL_ES precision highp float; #endif EDIT2: Okay, I created a branch in GitHub and edited sample 20-Tile with custom shaders. It works as expected as long as you use the attribute/uniform variables defined in OGLProg. Might be fun to allow custom variables in the future. http://github.com/MattTuttle/NME/tree/glsl... 1 year later: Updates: https://github.com/bmfs/glslTest_openfl
Sunday, June 14, 2015
Hardware Pixel Blending Haxe
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment