Hello, I'm trying to load a simple mesh file on the screen. My code compiles but the executable gives me an error. I have followed the MeshViewer application (together with its shader file), that works perfectly, but in my simplified and simpler code I'm doing something wrong I guess. Below is the part of my code where I guess there could be an error.
IOSetup ioSetup;
ioSetup.FileSystems.Add("file", LocalFileSystem::Creator());
ioSetup.Assigns.Add("data:", "file:///C:/Users/ivand/Documents/UI_WASS/oryol-samples/data/");
IO::Setup(ioSetup);
auto gfxSetup = GfxSetup::WindowMSAA4(800, 512, "Rendering APP");
gfxSetup.HighDPI = true;
gfxSetup.DefaultPassAction = PassAction::Clear(glm::vec4(0.5f, 0.5f, 0.5f, 1.0f));
Gfx::Setup(gfxSetup);
this->mesh = Gfx::LoadResource(MeshLoader::Create(MeshSetup::FromFile(this->meshPaths[0]),
[this](MeshSetup& setup) {
this->curMeshSetup = setup;
Id shd_n = Gfx::CreateResource(NormalsShader::Setup());
auto ps = PipelineSetup::FromLayoutAndShader(this->curMeshSetup.Layout, shd_n);
ps.DepthStencilState.DepthWriteEnabled = true;
ps.DepthStencilState.DepthCmpFunc = CompareFunc::LessEqual;
ps.RasterizerState.CullFaceEnabled = true;
ps.RasterizerState.SampleCount = 4;
this->drawState.Pipeline = Gfx::CreateResource(ps);
} ));
this->drawState.Mesh[0] = this->mesh;
// setup projection and view matrices
const float fbWidth = (const float)Gfx::DisplayAttrs().FramebufferWidth;
const float fbHeight = (const float)Gfx::DisplayAttrs().FramebufferHeight;
this->proj = glm::perspectiveFov(glm::radians(60.0f), fbWidth, fbHeight, 0.01f, 100.0f);
return App::OnInit();
this->frameCount++;
this->updateCamera();
this->updateLight();
Gfx::BeginPass();
NormalsShader::vsParams VsParams;
VsParams.mvp = this->modelViewProj;
Gfx::ApplyDrawState(this->drawState);
Gfx::ApplyUniformBlock(VsParams);
Gfx::Draw();
Gfx::EndPass();
Gfx::CommitFrame();
return Gfx::QuitRequested() ? AppState::Cleanup : AppState::Running;