Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import haxepunk.Scene;
- import haxepunk.graphics.Image;
- import haxepunk.graphics.shader.TextureShader;
- class MainScene extends Scene
- {
- static var vertexShader =
- "#ifdef GL_ES
- precision mediump float;
- #endif
- attribute vec4 aPosition;
- attribute vec2 aTexCoord;
- attribute vec4 aColor;
- attribute float aColorMult;
- varying vec2 vTexCoord;
- varying vec4 vColor;
- uniform mat4 uMatrix;
- void main(void) {
- vColor = vec4(aColor.bgr * aColor.a, aColor.a) * aColorMult;
- vTexCoord = aTexCoord;
- gl_Position = uMatrix * aPosition;
- }";
- override public function begin()
- {
- // Insert your scene code here...
- var img = Image.createRect(100, 100, 0x8888ff);
- img.shader = new TextureShader(vertexShader);
- img.shader.log = true;
- img.shader.setVertexAttribData("aColorMult", [ 1.0, 0.5, 0.5, 0.5, 0.5, 1.0 ], 1);
- addGraphic(img);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement