Is there anything fundamentally wrong with this code?
Johan Engelen via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Fri Feb 3 10:37:15 PST 2017
On Friday, 3 February 2017 at 17:20:43 UTC, WhatMeWorry wrote:
>
> ---------------------file post_processor.d ----------
> module post_processor;
>
> class PostProcessor
> {
> ...
> GLuint FBO;
> ....
> }
>
> ---------------------file game.d -------------------
> module game;
>
> PostProcessor postProc; // just a declaration (no memory
> allocation)
>
> class Game
> {
> ...
> void initGame(){
> ...
> PostProcessor postProc = new PostProcessor(...);
The error is in this line. Instead of assigning to the `postProc`
at module scope, you are defining a new local variable and
assigning to it.
> ...
> }
> ...
> void update(GLfloat deltaTime){
> ...
> writeln("Right Before");
> writeln("postProcesor.FBO = ", postProc.FBO);
> writeln("Right After);
> ...
> }
> ...
> }
More information about the Digitalmars-d-learn
mailing list