ambiera logo

Ambiera Forum

Discussions, Help and Support.

folder icon Ambiera Forum > CopperLicht
forum topic indicator shader code in textarea
person icon
mpa
Registered User
Quote
2010-07-12 20:12:06

Can shader code be kept in a textarea like this (angle brackets removed for proper display):


textarea id="vshader" style="display:none;"
uniform mat4 worldviewproj;
attribute vec4 vPosition;
attribute vec4 vNormal;
attribute vec2 vTexCoord1;
attribute vec2 vTexCoord2;
varying vec2 v_texCoord1;
varying vec2 v_texCoord2;

void main()
{
gl_Position = worldviewproj * vPosition;
v_texCoord1 = vTexCoord1.st;
v_texCoord2 = vTexCoord2.st;
}
/textarea

...

var newMaterialType = engine.getRenderer().createMaterialType(
document.getElementById('vshader').value,
document.getElementById('fshader').value
);


A Google O3D tutorial uses this technique. I haven't had luck getting this to work with CopperLicht though. It seems to be using a default shader.

person icon
niko
Moderator
Quote
2010-07-13 16:31:57

Of course this also works with CopperLicht. You only need to acccess the textarea via the DOM, get the text out of it and use it as shader in CopperLicht. This tutorial shows how to create your own shader: http://www.ambiera.com/copperlic...


Create reply:










 

  

Possible Codes


Feature Code
Link [url] www.example.com [/url]
Bold [b]bold text[/b]
Image [img]http://www.example.com/image.jpg[/img]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]

Emoticons


icon_holyicon_cryicon_devilicon_lookicon_grinicon_kissicon_monkeyicon_hmpf
icon_sadicon_happyicon_smileicon_uhicon_blink   






Copyright© Ambiera e.U. all rights reserved.
Contact | Imprint | Products | Privacy Policy | Terms and Conditions |