Skip to main content

texture

_ @4;

tex0 0;

if (r0) {
create.texture {
tex0:=node.ex.texture.create(u0, w,h);
node.value.s(u0, nid,0, tex0);
};
create.texture;
};

_ @sys.obj.key;
_ @sys.shader.ex;

shader.set.uniform.v2(nid, iResolution, w,h);

draw(r0, 900785);

Draw formula

### 900785 basic.ui.shader.node3.draw

_ @4;
_ @900776;
_ @1100;
_ @util.gl.std;

_ @sys.obj.key;
_ @sys.shader.ex;

tex0 r1;

vsh0 r2;
fsh0 r3;

node.ex.gl.fbo(u0, tex0);
node.ex.gl.clear(u0, 0,0,0,0);

gl.shader.use(vsh0,fsh0);

shader.load.uniforms(u0, nid);

gl.rect0(5, 0,0, w,h);
node.ex.gl.fbo(u0, -1);

gl.rect0.texture(5, 0,0, w,h, tex0);

texture loader

Load textures from storage

_ @sys.storage;

texture.loader {
load.texture {
# tex, pool,id,i
tex _0;
tex:=storage.image.load.texture(_1,_2,_3);
};
init {
# r0, tex, pool,id,i
if (_0) {
load.texture(_1, _2,_3,_4);
};
};
update {
# b0, tex, pool,id
l0 _0;
tex _1;
pool _2;
id _3;
l0:=storage.get.event(0);
if (l0==storage.e.new.file) {
load.texture(tex, o1,o2,o3);
};
};
};

load.texture {
# tex, pool,id,i
tex0 _0;
tex0:=storage.image.load.texture(_1,_2,_3);
};

tex0 0;

if (r0) {
load.texture(tex0, pool0,id0,i0);
};

draw texture

Draw

### 93323 nodes.image.draw 

_ @1010;
_ @sys.node;
_ @sys.display;
_ @1100;
_ @util.gl.std;

tex0 r5;

gl.draw.texture.rect0 {
# tex, x,y, w,h
gl.shader.use(70014,150015);
gl.shader.uniform.texture(0, tex0, 0);
gl.rect0(5, 0,h, w,-h);
};

gl.draw.texture.rect0(tex0, 0,0,w,h);

render children to fbo

node

### texture.node
tex0 r1;
req.update r2;

if (r0) {
tex0:=node.ex.texture.create(u0, w,h);

node.ex.child.draw.s(u0, 0);

req.update:=1;
};

draw

### texture.node.draw
_ @4;
_ @900776;
_ @1100;
_ @util.gl.std;

_ @sys.obj.key;
_ @sys.shader.ex;

tex0 r1;
req.update r2;

if (req.update>0) {
draw.to.fbo;
};

draw.to.fbo {
node.ex.gl.fbo(u0, tex0);
node.ex.gl.clear(u0, 0,0,req.update,0);

#gl.shader.use(vsh0,fsh0);
#shader.load.uniforms(u0, nid);
#gl.rect0(5, 0,0, w,h);

node.ex.gl.child.draw(u0);

node.ex.gl.fbo(u0, -1);
};

gl.rect0.texture(5, 0,0, w,h, tex0);