Hi everyone,
I'm working on an online viewer using the Ogre emscripten build.
I'd like to use a custom material for a manual object that represents the pivot around which the orbital camera rotates. However, I am unable to parse the following, very simple, material script:
CameraTarget.material
Code: Select all
vertex_program CameraTargetVertex glsl
{
source CameraTarget.vert
}
fragment_program CameraTargetFragment glsl
{
source CameraTarget.frag
}
material CameraTarget
{
technique
{
pass
{
vertex_program_ref CameraTargetVertex
{
}
fragment_program_ref CameraTargetFragment
{
}
}
}
}
CameraTarget.vert
Code: Select all
#version 300 es
void main() {
vec3 pos = vec3(0.0f);
gl_Position = vec4(pos, 1.0f);
}
CameraTarget.frag
Code: Select all
#version 300 es
precision mediump float;
out vec4 FragColor;
void main() {
FragColor = vec4(1.0f);
}
ManualObject creation
Code: Select all
void PivotCameraController::setupTargetManualObject()
{
using namespace Ogre;
auto material =
MaterialManager::getSingleton().getByName( "CameraTarget" );
mTargetManualObject->begin(
material->getName(), RenderOperation::OT_LINE_LIST );
mTargetManualObject->colour( ColourValue::Red );
mTargetManualObject->position( .5 * Vector3::NEGATIVE_UNIT_X );
mTargetManualObject->position( .5 * Vector3::UNIT_X );
mTargetManualObject->end();
mTargetManualObject->begin(
material->getName(), RenderOperation::OT_LINE_LIST );
mTargetManualObject->colour( ColourValue::Green );
mTargetManualObject->position( .5 * Vector3::NEGATIVE_UNIT_Y );
mTargetManualObject->position( .5 * Vector3::UNIT_Y );
mTargetManualObject->end();
mTargetManualObject->begin(
material->getName(), RenderOperation::OT_LINE_LIST );
mTargetManualObject->colour( ColourValue::Blue );
mTargetManualObject->position( .5 * Vector3::NEGATIVE_UNIT_Z );
mTargetManualObject->position( .5 * Vector3::UNIT_Z );
mTargetManualObject->end();
}
for which I get the following warning:
Warning: material CameraTarget has no supportable Techniques and will be blank. Explanation:
Pass 0: vertex program CameraTargetVertex cannot be used - not supported.
Attached you can find the full log of the execution.
Any idea of what I might be doing wrong?
Thank you in advance.