Polycode Rendering

  1. 8 months ago

    Why is the rendering done in this new way.

    bool res = core->Update();
    
    	label->Roll(core->getElapsed() * 40.0);
    
    	RenderFrame *frame = new RenderFrame(core->getViewport());
    	scene->Render(frame, NULL, NULL, NULL, false);
    	core->getRenderer()->submitRenderFrame(frame);
    
    	return res;

    What are the advantages of doing it this way? It was far simpler to just call the method updateandrender from the core.

  2. Ivan

    7 Aug 2016 Administrator

    This gives you a lot more flexibility in how you structure your program flow. Just a heads up, I am generally moving more and more towards more explicit programming. Creating a cleaner and more modular API by sacrificing certain implicit simplicity in some places.

  3. Edited 8 months ago by carlos21

    I don't mind that some simplicity gets taken out for more flexibility. In the code above what concerns me is the allocation of memory every single frame and not being release. That's obvious a fast way to run out of memory and having a crash. Does the renderframe class delete it's self when out of scope?

  4. fodinabor

    8 Aug 2016 Administrator

    Jup - that does the Remderer for you (obviously very explicit :D)
    The problem why you shouldn't delete it yourself is, that the frame get's processed on another thread, so you would not know when to savely delete the frame.

  5. Ivan

    8 Aug 2016 Administrator

    Yeah, I should probably change this to a shared pointer just to make it clearer that it does in fact get cleaned up.

  6. I forgot to say when i roll the entity it seems to leave a trail. Like it's not clearing up it's pass position. Is there something i'm forgetting to do in the code above?

  7. Ivan

    15 Aug 2016 Administrator
    Edited 8 months ago by Ivan

    You have to explicitly set a scene to clear the screen (most of the time, you don't want to do that for scenes that are overlayed on top). Actually, Scenes are going away as well, so you'll have to set that in the draw buffer.

  8. Hmm interesting what will the scene be replaced?

  9. Ivan

    18 Aug 2016 Administrator

    Right now the Scene is nothing more than a holder for the root entity and some utility functions here and there, so it's making more and more sense for me to just get rid of it in favor of just you manually rendering an entity recursively with a camera. This way you dont even need to think of your draw passes as scenes, just setup the projection you want in the camera and render your own root entity with it into a draw buffer.

 

or Sign Up to reply!