AggrorJorn Posted April 26, 2013 Share Posted April 26, 2013 I am trying to create a new class that encapsulates the default creation of a window, context and world. However as soon as I try to add a camera, the program no longer works. So the app.cpp looks like this: bool App::Start() { game = new Game(); return true; } bool App::Loop() { game->Update(); return true; } The game.cpp looks like this (some code is removed to keep it clean): Game::Game() { //Create a window window = Leadwerks::Window::Create("Test 3"); //Create a context context = Leadwerks::Context::Create(window); //Create a world world = Leadwerks::World::Create(); //Create a camera //cam = Leadwerks::Camera::Create(); } void Game::Update() { Leadwerks::Time::Update(); world->Update(); world->Render(); context->Sync(false); } The program works, but as soon as I add a camera (removing the comments), the program crashes. Quote Link to comment Share on other sites More sharing options...
Admin Posted April 26, 2013 Share Posted April 26, 2013 Set a breakpoint and make sure the context and world isn't NULL. Quote Link to comment Share on other sites More sharing options...
AggrorJorn Posted April 26, 2013 Author Share Posted April 26, 2013 I checked and both context and world aren't NULL. The game stops at context->Sync(false); If I look at the stack it says the following: > Test.debug.exe!Leadwerks::OpenGL2Camera::DrawOcclusionQueries() Line 333 C++ Quote Link to comment Share on other sites More sharing options...
Rick Posted April 26, 2013 Share Posted April 26, 2013 Can you show game.h so we can see how you defined those? Quote Link to comment Share on other sites More sharing options...
AggrorJorn Posted April 26, 2013 Author Share Posted April 26, 2013 #include "Leadwerks.h" class Game { public: Game(); ~Game(); void Update(); Leadwerks::Window* window; Leadwerks::Context* context; Leadwerks::World* world; Leadwerks::Camera* cam; }; Quote Link to comment Share on other sites More sharing options...
Admin Posted April 26, 2013 Share Posted April 26, 2013 Perhaps you are missing some required shaders, because your app isn't launching in the correct directory. I don't recommend using Visual Studio 2012 as it is unsupported. Quote Link to comment Share on other sites More sharing options...
AggrorJorn Posted April 26, 2013 Author Share Posted April 26, 2013 (edited) I am just using the interfaceof 2012. The compiler is still 2010. *edit With 2010,I have the same problem Edited April 26, 2013 by Aggror Quote Link to comment Share on other sites More sharing options...
Admin Posted April 27, 2013 Share Posted April 27, 2013 But the default example runs fine? Quote Link to comment Share on other sites More sharing options...
AggrorJorn Posted April 27, 2013 Author Share Posted April 27, 2013 Ok I got it. I placed the app.h and app.cpp in a filter inside visual studio. I placed them back in the root filter and now it works again. Note that it was just a filter, not an actual folder. Quote Link to comment Share on other sites More sharing options...
Rick Posted April 27, 2013 Share Posted April 27, 2013 Really? I didn't think that mattered in VS with C++. Quote Link to comment Share on other sites More sharing options...
AggrorJorn Posted April 27, 2013 Author Share Posted April 27, 2013 Yeah I found that weird as well. I thought that filters were just a way to organize your project. The location of the app.c and app.h remained in the same folder. Quote Link to comment Share on other sites More sharing options...
Rick Posted April 28, 2013 Share Posted April 28, 2013 I get this same error when I run the default VS project. I can build and run the exe created from it just fine, but running from VS gives me the error on the same line as you Aggror. I didn't make any new filters or anything. App source files are in their source/header filters like they are by default. I even tried moving them to the root project filter and it didn't work either. Yeah, this is very annoying. I can't debug a project The only thing different is that my project isn't in the LE projects folder and instead of another drive in another folder. Maybe I'll have to change some paths in the project. Quote Link to comment Share on other sites More sharing options...
AggrorJorn Posted April 28, 2013 Author Share Posted April 28, 2013 I do have my located on another hard drive and that works okay for me. The only thing that seems to mess it up for me is either: creating filters and store the app.h and app.cpp in these filters Placing the app.cpp and app.h in a different or sub folder from its original location $project/Source/ Quote Link to comment Share on other sites More sharing options...
Rick Posted April 28, 2013 Share Posted April 28, 2013 By default your app.h and app.cpp are in the header/source filters though right? Quote Link to comment Share on other sites More sharing options...
AggrorJorn Posted April 28, 2013 Author Share Posted April 28, 2013 Yes they are, but the location is just the source folder. Quote Link to comment Share on other sites More sharing options...
Rick Posted April 28, 2013 Share Posted April 28, 2013 hmm, yeah it works if I do C or E drive. I guess the only other difference is this project is linked to BitBucket for source control. The folder structures look the same though as a normal project. Quote Link to comment Share on other sites More sharing options...
AggrorJorn Posted April 28, 2013 Author Share Posted April 28, 2013 For private projects I use bitbucket as well. I haven't changed anything from the original folder structure. Quote Link to comment Share on other sites More sharing options...
Rick Posted April 28, 2013 Share Posted April 28, 2013 You're killing me Aggror . I have no idea why this is giving me this error then What I find interesting is if I place the following line in the App::Start() right after the context gets created it doesn't error. context->SetBlendMode(Blend::Alpha); Also if I have this line before: Time::Update(); world->Update(); world->Render(); it doesn't error. After and it errors. Strange. Quote Link to comment Share on other sites More sharing options...
AggrorJorn Posted April 28, 2013 Author Share Posted April 28, 2013 What I eventually did was create a new project on E:/. I didn't delete, change or moved any file, folder or setting, I just recreated the classes that I needed via Add->Class and then it finally worked. However as soon as I move the app.h or cpp in to another filter, things start to go down hill. Even if you place it back in the original state, it wont work again. Quote Link to comment Share on other sites More sharing options...
AggrorJorn Posted May 3, 2013 Author Share Posted May 3, 2013 It just happened again with a test project. I found the problem though. The project worked perfectly but after removing the suo file (of which git suggests that you put in the ignore file) , it no longer works. Problem now is that I have really deleted it from computer (it is not in the trash bin.) Rebuilding simply wont work anymore. Quote 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.