SFML community forums

Help => Graphics => Topic started by: BlazeCrate on May 19, 2014, 06:24:53 pm

Title: OpenGL Texture Invalid Operation Call Failed?
Post by: BlazeCrate on May 19, 2014, 06:24:53 pm
Hello,

I am trying to add bullets into my space ship game. I got them working and shooting the way that I want. The bullets are working fine (with a need for a bit of fine tuning).

But when I close the game the console window gives me the error attached.
Title: Re: OpenGL Texture Invalid Operation Call Failed?
Post by: Jesper Juhl on May 19, 2014, 06:29:03 pm
Taking a wild guess here: you have some global variables/objects (includes singletons) in your code?
If I'm right, then "don't do that". If I'm wrong then just ignore me ;)
Title: Re: OpenGL Texture Invalid Operation Call Failed?
Post by: Nexus on May 19, 2014, 06:31:18 pm
Another guess: you call draw() after closing the window. Make sure you return immediately as soon as the window is closed, so that you don't render anymore.

Next time, please ask a clear question (http://en.sfml-dev.org/forums/index.php?topic=5559.0).
Title: Re: OpenGL Texture Invalid Operation Call Failed?
Post by: BlazeCrate on May 19, 2014, 06:32:40 pm
Sorry forgot to link my code: https://github.com/Ancell/Tractus
Title: Re: OpenGL Texture Invalid Operation Call Failed?
Post by: Nexus on May 19, 2014, 06:34:10 pm
Sorry forgot to link my code: https://github.com/Ancell/Tractus
No one wants to browse your whole repository, that's why there's a rule concerning minimal complete examples (http://en.sfml-dev.org/forums/index.php?topic=5559.msg36368#msg36368). Please read it carefully for future questions.
Title: Re: OpenGL Texture Invalid Operation Call Failed?
Post by: BlazeCrate on May 19, 2014, 06:47:14 pm
Well I solved the problem of not getting that output. I used your advice about exiting right after I close the window. I just added return EXIT_SUCCESS; right before window.close(); in my main class.

Thanks for the help!

P.s. I will read the rules of posting for future questions.
Title: Re: OpenGL Texture Invalid Operation Call Failed?
Post by: Jesper Juhl on May 19, 2014, 07:07:10 pm
... I just added return EXIT_SUCCESS; right before window.close(); in my main class. ...
I'd say that right after would probably be closer to what you really want ;)
Title: Re: OpenGL Texture Invalid Operation Call Failed?
Post by: Nexus on May 19, 2014, 07:47:34 pm
close() is not really necessary. If the window goes out of scope, the destructor will close it automatically.

So I'd write only a return statement.
Title: Re: OpenGL Texture Invalid Operation Call Failed?
Post by: Jesper Juhl on May 19, 2014, 07:49:58 pm
My point (that I didn't make very well) was that putting the return before close() is pointless since close() just becomes dead code.
Either close() and then return or, as you say, just return.