Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
GraphicsResourceBase.OpenGL.cs
Go to the documentation of this file.
1 // Copyright (c) 2014 Silicon Studio Corp. (http://siliconstudio.co.jp)
2 // This file is distributed under GPL v3. See LICENSE.md for details.
3 #if SILICONSTUDIO_PARADOX_GRAPHICS_API_OPENGL
4 using System;
5 using System.Runtime.InteropServices;
6 
7 namespace SiliconStudio.Paradox.Graphics
8 {
9  /// <summary>
10  /// GraphicsResource class
11  /// </summary>
12  public partial class GraphicsResourceBase
13  {
14  internal int resourceId;
15 
16  private void Initialize()
17  {
18  }
19 
20  internal int ResourceId
21  {
22  get { return resourceId; }
23  }
24 
25  /// <summary>
26  /// Called when graphics device has been detected to be internally destroyed.
27  /// </summary>
28  protected internal virtual void OnDestroyed()
29  {
30  // If GL context is lost, set resource id to 0, as OpenGL destroys everything with it
31  resourceId = 0;
32  }
33 
34  /// <summary>
35  /// Called when graphics device has been recreated.
36  /// </summary>
37  /// <returns>True if item transitionned to a <see cref="GraphicsResourceLifetimeState.Active"/> state.</returns>
38  protected internal virtual bool OnRecreate()
39  {
40  return false;
41  }
42 
43  protected virtual void DestroyImpl()
44  {
45  }
46  }
47 }
48 
49 #endif