Page 1 of 1

cogles2fixedpipelineshaders embed shader file

Posted: Sun Jan 29, 2012 11:59 pm
by kaliber
in file COGLES2FixedpipelineShaders.cpp there is :

Code: Select all

const c8  VertexShaderFile[] =    "/mnt/.../COGLES2FixedPipeline.vsh";
        const c8  FragmentShaderFile[] =  "/mnt/.../COGLES2FixedPipeline.fsh";
i dont want to put the shader file in the sdcard
and since android JNI cant get access to asset folder easily, so i want to put the shaders inside the .cpp file.
is there any tutorial ? or some link ? or your help ?
:D :D :D

Re: cogles2fixedpipelineshaders embed shader file

Posted: Mon Jan 30, 2012 11:44 am
by shadowslair
So, you just copy the shader program and paste it in the .cpp. Then load it as a string (const c8 VertexShader[] = "MyShaderCodeGoesHere, VertexShader, PixelShaderBlaBlaETC."; ), what`s the problem? The shaders usually are in separate files just for user convenience. Then you use the addHighLevelShaderMaterial, not the addHighLevelShaderMaterialFromFiles.

Re: cogles2fixedpipelineshaders embed shader file

Posted: Mon Jan 30, 2012 10:22 pm
by hybrid
The shader path is already changeable, you can use a define to set a new prefix. Changing to in file shaders is only possible by altering the cpp files, though.