I'm sorry for the vagueness of my description. please give me a chance again.
'Ogre Version' I get it from OgrePrerequisites.h, OGRE_VERSION_MAJOR OGRE_VERSION_MINOR and OGRE_VERSION_PATCH are defined separately as: 4 0 0, It belongs to the ogre-next.
Back to my doubts, I know how to create a simple material with fragment program and vertex program, It looks like
Code: Select all
String customCasterMatVp =
"void customCasterVp(float4 position : POSITION,\n"
"out float4 oPosition : POSITION,\n"
"uniform float4x4 worldViewProj)\n"
"{\n"
" oPosition = mul(worldViewProj, position);\n"
"}\n";
String customCasterMatFp =
"void customCasterFp(\n"
"out float4 oColor : COLOR)\n"
"{\n"
" oColor = float4(1,1,0,1); // just a test\n"
"}\n";
HighLevelGpuProgramPtr vp = HighLevelGpuProgramManager::getSingleton()
.createProgram("CustomShadowCasterVp",
ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
"cg", GPT_VERTEX_PROGRAM);
vp->setSource(customCasterMatVp);
vp->setParameter("profiles", "vs_1_1 arbvp1");
vp->setParameter("entry_point", "customCasterVp");
vp->load();
HighLevelGpuProgramPtr fp = HighLevelGpuProgramManager::getSingleton()
.createProgram("CustomShadowCasterFp",
ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
"cg", GPT_FRAGMENT_PROGRAM);
fp->setSource(customCasterMatFp);
fp->setParameter("profiles", "ps_1_1 arbfp1");
fp->setParameter("entry_point", "customCasterFp");
fp->load();
MaterialPtr mat = MaterialManager::getSingleton().create("CustomShadowCaster",
ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
Pass* p = mat->getTechnique(0)->getPass(0);
p->setVertexProgram("CustomShadowCasterVp");
p->getVertexProgramParameters()->setNamedAutoConstant(
"worldViewProj", GpuProgramParameters::ACT_WORLDVIEWPROJ_MATRIX);
p->setFragmentProgram("CustomShadowCasterFp");
(copy from ogre-next's Tests)
But, I want to implement an editor, it can provide real-time feedback on the results of the program, if the program is wrong, the rendered item can also use the default material. But now...

If I connect Simple Material's Output to Render Item's Material name (just call method OgreItem::setDatablockOrMaterialName, anything about material settings are done in the previous session), logs are as follows
Code: Select all
GLSL compile log: 2b3ed9b7-103b-4e14-87ba-c0f784667c35_vp
0(1) : error C0104: Unknown pre-processor directive #vers
OGRE EXCEPTION(3:RenderingAPIException): Vertex Program 2b3ed9b7-103b-4e14-87ba-c0f784667c35_vp failed to compile. See compile log above for details. in GLSLShader::compile at D:\code\Ogr...
I know that the program is incomplete, But I can't guarantee that everyone can hold back to perss 'ctrl + s' before entering a full line... like the error above, it will be discovered until call OgreRoot::renderOneFrame(specifically GLSLShader::compile). So, I'd like to ask if I can find out about this before that...
My Englist is poor, please forgive me if there is a grammatical problem QAQ