0001: //-----------------------------------------------------------------------------
0002: // File: GLApp.h
0003: //
0004: // Desc: Application class for the OpenGL samples framework library.
0005: //-----------------------------------------------------------------------------
0006: #ifndef GLAPP_H
0007: #define GLAPP_H
0008: 
0009: #pragma warning(disable : 4136)     // X86
0010: 
0011: #include <GL/gl.h>
0012: #include <GL/glu.h>
0013: 
0014: 
0015: typedef struct _D3DSURFACE_DESC {
0016: //    D3DFORMAT Format;
0017: //    D3DRESOURCETYPE Type;
0018: //    DWORD Usage;
0019: //    D3DPOOL Pool;
0020: //    D3DMULTISAMPLE_TYPE MultiSampleType;
0021: //    DWORD MultiSampleQuality;
0022:     UINT Width;
0023:     UINT Height;
0024: } MY_SURFACE_DESC;
0025: 
0026: //-------------------------------------------------------------
0027: // Name: class CD3DApplication
0028: // Desc: アプリケーションの基底クラス
0029: //-------------------------------------------------------------
0030: 
0031: class CD3DApplication
0032: {
0033:     bool              m_bDeviceObjectsInited;
0034:     bool              m_bDeviceObjectsRestored;
0035:     HRESULT HandlePossibleSizeChange();// 画面サイズの更新
0036:     HRESULT Reset3DEnvironment();
0037:     HRESULT Initialize3DEnvironment();
0038:     void    Cleanup3DEnvironment();
0039:     HRESULT Render3DEnvironment();
0040: 
0041: protected:
0042:     HWND              m_hWnd;              // The main app window
0043:     BOOL              m_bGL;
0044:     MY_SURFACE_DESC   m_mysdBackBuffer;   // Surface desc of the backbuffer
0045:     DWORD             m_dwWindowStyle;     // Saved window style for mode switches
0046:     RECT              m_rcWindowBounds;    // Saved window bounds for mode switches
0047:     RECT              m_rcWindowClient;    // Saved client area size for mode switches
0048: 
0049:     TCHAR*            m_strWindowTitle;    // Title for the app's window
0050:     FLOAT             m_fTime;             // Current time in seconds
0051:     FLOAT             m_fElapsedTime;      // Time elapsed since last frame
0052:     DWORD             m_dwCreationWidth;   // Width used to create window
0053:     DWORD             m_dwCreationHeight;  // Height used to create window
0054: 
0055:     // Overridable functions for the 3D scene created by the app
0056:     virtual HRESULT ConfirmDevice(void*,DWORD,void*)   { return S_OK; }
0057:     virtual HRESULT OneTimeSceneInit()                         { return S_OK; }
0058:     virtual HRESULT InitDeviceObjects()                        { return S_OK; }
0059:     virtual HRESULT RestoreDeviceObjects()                     { return S_OK; }
0060:     virtual HRESULT FrameMove()                                { return S_OK; }
0061:     virtual HRESULT Render()                                   { return S_OK; }
0062:     virtual HRESULT InvalidateDeviceObjects()                  { return S_OK; }
0063:     virtual HRESULT DeleteDeviceObjects()                      { return S_OK; }
0064:     virtual HRESULT FinalCleanup()                             { return S_OK; }
0065: public:
0066:     HRESULT Create( HINSTANCE hInst, int nCmdShow );
0067:     INT Run();
0068:     virtual LRESULT MsgProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam );
0069: 
0070:     CD3DApplication();
0071: };
0072: 
0073: #endif // !GLAPP_H
0074: 
0075: