Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: [Solved]Failed to share OpenGL context.  (Read 3068 times)

0 Members and 1 Guest are viewing this topic.

MaskedPixel

  • Newbie
  • *
  • Posts: 3
    • View Profile
[Solved]Failed to share OpenGL context.
« on: September 07, 2011, 12:04:18 am »
1. Should I be compiling my application(VS2010) as a console app?

2. When I close my app it hangs on the RenderWindow.Close() function then prints "Failed to share OpenGL context" to the console(It is really to fast to read so I think this is what it is saying).  Let me try to post the relevant code...

in the Engine class.
Code: [Select]
       public virtual void init()
        {
            // global game objects.
            MP._engine = this;
            MP.renderTarget = new RenderWindow(new VideoMode(MP.width, MP.height, MP.bpp), MP.windowName);
            MP.renderTarget.Closed += new EventHandler(onClosed);
            MP._world = new World();
        }

        private void onClosed(object sender, EventArgs e)
        {
            MP._exit = true;
        }

        public int gameLoop()
        {
            while (!MP._exit)
            {
                MP.renderTarget.DispatchEvents();
                MP.renderTarget.Clear();
                // Switch worlds if needed.
                if (MP._goto != null)
                {
                    MP._world.end();
                    MP._world = MP._goto;
                    MP._goto = null;
                    MP._world.start();
                }
                MP._world.preUpdate();
                MP._world.Update();
                MP._world.postUpdate();

                MP._world.render();
            }

            MP.renderTarget.Close();
            return 0;
        }


I am screwing something up with releasing the OpenGL context but I can't figure it out...

EDIT: I have no idea what I did to fix this.  I just noticed that it stopped when I added MP.renderTarget.Display() after MP._world.render().

 

anything