@@ -119,13 +119,13 @@ class DemoApp : public system::BaseApp
119
119
inline int Run () override
120
120
{
121
121
const uint32_t width = 1280 , height = 720 ;
122
- std::shared_ptr<system ::WindowingGLFW> windowing = std::make_shared<system ::WindowingGLFW>(width, height, false );
122
+ std::shared_ptr<system ::WindowingGLFW> windowing = std::make_shared<system ::WindowingGLFW>(width, height, true );
123
123
124
- gfx::GraphicsApiVkOptions options = {};
124
+ gfx::GraphicsApiGLOptions options = {};
125
125
options.mainViewport = {width, height};
126
- options.windowingPtr = windowing;
126
+ // options.windowingPtr = windowing;
127
127
128
- // windowing->SetAsCurrentContext();
128
+ windowing->SetAsCurrentContext ();
129
129
130
130
// Create new graphics engine instance
131
131
gfx::GraphicsEngine engine (&options, windowing);
@@ -142,23 +142,22 @@ class DemoApp : public system::BaseApp
142
142
fragShaderSrc = system ::FileSystem::Read (" ../../Content/GLSL/Unlit/RGBVertex_GL.frag" ),
143
143
vertShaderSrc2 = system ::FileSystem::Read (" ../../Content/GLSL/Unlit/SolidColour.vert" ),
144
144
fragShaderSrc2 = system ::FileSystem::Read (" ../../Content/GLSL/Unlit/SolidColour.frag" );
145
- /* gfx::ShaderCompiledResult
145
+ gfx::ShaderCompiledResult
146
146
vertShader = gfx::ShaderCompilerGLSL::Singleton ().CompileShader (vertShaderSrc.c_str (), vertShaderSrc.length (), gfx::VertexShader),
147
147
fragShader = gfx::ShaderCompilerGLSL::Singleton ().CompileShader (fragShaderSrc.c_str (), fragShaderSrc.length (), gfx::FragmentShader),
148
148
vertShader2 = gfx::ShaderCompilerGLSL::Singleton ().CompileShader (vertShaderSrc2.c_str (), vertShaderSrc2.length (), gfx::VertexShader),
149
149
fragShader2 = gfx::ShaderCompilerGLSL::Singleton ().CompileShader (fragShaderSrc2.c_str (), fragShaderSrc2.length (), gfx::FragmentShader);
150
150
151
- */
152
151
// Register shader with the API.
153
- auto & api = engine.GetApi <gfx::GraphicsApiVk >();
152
+ auto & api = engine.GetApi <gfx::GraphicsApiGL >();
154
153
engine.GetSceneGraph ().SetCamera (&m_Camera);
155
154
156
155
lepus::gfx::Material baseMaterial, otherMaterial;
157
- // lepus::gfx::GLShader baseShader(lepus::gfx::ShaderInfo("RGBVertex")), redShader(lepus::gfx::ShaderInfo("SolidColour"));
158
- /* baseShader.SetGLProgram(gfx::ShaderCompilerGLSL::Singleton().BuildProgram(vertShader, fragShader));
156
+ lepus::gfx::GLShader baseShader (lepus::gfx::ShaderInfo (" RGBVertex" )), redShader (lepus::gfx::ShaderInfo (" SolidColour" ));
157
+ baseShader.SetGLProgram (gfx::ShaderCompilerGLSL::Singleton ().BuildProgram (vertShader, fragShader));
159
158
redShader.SetGLProgram (gfx::ShaderCompilerGLSL::Singleton ().BuildProgram (vertShader2, fragShader2));
160
159
baseMaterial.SetShader (&baseShader);
161
- otherMaterial.SetShader(&redShader);*/
160
+ otherMaterial.SetShader (&redShader);
162
161
163
162
types::Vector3 baseColour (1 .f , 1 .f , 1 .f );
164
163
auto baseColourIndex = otherMaterial.Attributes ().Add <const types::Vector3&>(" colour" , baseColour);
@@ -168,7 +167,7 @@ class DemoApp : public system::BaseApp
168
167
m_Camera.Transform ().Origin (m_Camera.Transform ().Forward () * -2 .f );
169
168
170
169
// Instantiate two Renderables in the scene graph, each with its own transform, using the same cube mesh data.
171
- auto cubeMesh = static_cast <lepus::gfx::VkMesh *>(engine.CreateMesh (lepus::utility::Primitives::Cube ()));
170
+ auto cubeMesh = static_cast <lepus::gfx::GLMesh *>(engine.CreateMesh (lepus::utility::Primitives::Cube ()));
172
171
auto cube = lepus::gfx::Renderable (cubeMesh, lepus::math::Transform (), baseMaterial);
173
172
auto cube2 = lepus::gfx::Renderable (cubeMesh, lepus::math::Transform (), otherMaterial);
174
173
auto cube3 = lepus::gfx::Renderable (cubeMesh, lepus::math::Transform (), otherMaterial);
0 commit comments