Aaron Symons Posted January 9, 2016 Share Posted January 9, 2016 Hi all, I've just started getting back into C++ and Leadwerks and I'm having an issue with a simple task: displaying a model created in code at runtime. The model doesn't display, and all I see is a black screen. If anyone could offer any advice on how to look for the problem I would be very grateful! App.h #pragma once #include "Leadwerks.h" #undef GetFileType using namespace Leadwerks; class App { public: Leadwerks::Window* window; Context* context; World* world; Camera* camera; Light* light; Model* box; App(); virtual ~App(); bool Start(); bool Loop(); }; App.cpp #include "App.h" using namespace Leadwerks; App::App() : window(NULL), context(NULL), world(NULL), camera(NULL) {} App::~App() { delete world; delete window; } bool App::Start() { // Create main window window = Window::Create("Hello there!", 100, 100, 1024, 768, Window::Titlebar); // Create context context = Context::Create(window); // Create the world world = World::Create(); // Create camera camera = Camera::Create(); camera->Move(Vec3(0, 2, -5)); // Create a light light = DirectionalLight::Create(); light->SetRotation(45, 45, 0); // Create a box box = Model::Box(); box->SetPosition(-4, 0, 0); return true; } bool App::Loop() { // Close window on 'exit button' or ESC key is pressed if (window->Closed() || window->KeyHit(Key::Escape)) { return false; } Time::Update(); world->Update(); world->Render(); return true; } Many thanks! Quote Win7 64-bit | Intel i7-3770 3.40GHz | NVIDIA GeForce GTX 660 Link to comment Share on other sites More sharing options...
Ma-Shell Posted January 9, 2016 Share Posted January 9, 2016 You are missing context->Sync(false) right between the render call and the return of the loop. This call is important, as everything is only rendered to the backbuffer and the buffer is never switched to become front-buffer 1 Quote Link to comment Share on other sites More sharing options...
Aaron Symons Posted January 9, 2016 Author Share Posted January 9, 2016 You are missing context->Sync(false) right between the render call and the return of the loop. This call is important, as everything is only rendered to the backbuffer and the buffer is never switched to become front-buffer Thanks! Can't believe I forgot about that one! 1 Quote Win7 64-bit | Intel i7-3770 3.40GHz | NVIDIA GeForce GTX 660 Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.