From d14d83bb5fb78a5c05009e2ed3191a209bb52a49 Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Sun, 2 Feb 2014 15:25:08 +0000 Subject: [PATCH] TestEgr 15b1 : migliorie varie per aggiornamento visualizzazione. --- OpenGLRenderer.cpp | 10 +---- OpenGLRenderer.h | 13 +----- TestEGr.cpp | 87 +++++++++++++++++++++++++++++++--------- TestEGr.h | 36 +++++++++-------- TestEGr.rc | Bin 13380 -> 17504 bytes TestEGr.vcxproj | 5 +-- TestEGr.vcxproj.filters | 3 -- TestEGrDlg.cpp | 42 +++++++++++++++---- TestEGrDlg.h | 2 +- resource.h | Bin 1360 -> 1544 bytes stdafx.h | 11 ++++- targetver.h | 8 ---- 12 files changed, 140 insertions(+), 77 deletions(-) delete mode 100644 targetver.h diff --git a/OpenGLRenderer.cpp b/OpenGLRenderer.cpp index 73d45dc..c839921 100644 --- a/OpenGLRenderer.cpp +++ b/OpenGLRenderer.cpp @@ -12,6 +12,8 @@ OpenGLRenderer::OpenGLRenderer( void) { m_hdc = nullptr ; m_hrc = nullptr ; + memset( &m_wglewc, 0, sizeof( WGLEWContext)) ; + memset( &m_glewc, 0, sizeof( GLEWContext)) ; } //---------------------------------------------------------------------------- @@ -21,7 +23,6 @@ OpenGLRenderer::~OpenGLRenderer( void) //---------------------------------------------------------------------------- BEGIN_MESSAGE_MAP( OpenGLRenderer, CWnd) -// ON_WM_PAINT() END_MESSAGE_MAP() @@ -161,13 +162,6 @@ OpenGLRenderer::Reshape( int nW, int nH) DrawScene() ; } -//---------------------------------------------------------------------------- -//void -//OpenGLRenderer::OnPaint( void) -//{ -// DrawScene(); -//} - //---------------------------------------------------------------------------- void OpenGLRenderer::DrawScene( void) diff --git a/OpenGLRenderer.h b/OpenGLRenderer.h index 05edae6..4d2986b 100644 --- a/OpenGLRenderer.h +++ b/OpenGLRenderer.h @@ -1,12 +1,5 @@ #pragma once -#pragma comment(lib, "opengl32.lib") -#pragma comment(lib, "glu32.lib") -#if defined( _WIN64) - #pragma comment(lib, "/EgtDev/Extern/GLEW/lib/x64/glew32mx.lib") //make sure project settings have: Linker -> Additional Library Directories -> include path for library. -#else - #pragma comment(lib, "/EgtDev/Extern/GLEW/lib/x32/glew32mx.lib") //make sure project settings have: Linker -> Additional Library Directories -> include path for library. -#endif #define GLEW_MX #include "/EgtDev/Extern/GLEW/Include/glew.h" @@ -40,13 +33,11 @@ class OpenGLRenderer : public CWnd void SetTriangle( void) ; void SetSquare( void) ; bool InitContext( void) ; // Creates OpenGL Rendering Context - afx_msg void OnPaint( void) ; - - HDC m_hdc ; + HDC m_hdc ; // Device Context HGLRC m_hrc ; // OpenGL Rendering Context - GLEWContext m_glewc ; // GLEW Context WGLEWContext m_wglewc ; // WGLEW Context + GLEWContext m_glewc ; // GLEW Context CRect m_rectWin ; diff --git a/TestEGr.cpp b/TestEGr.cpp index dedc0f7..1f2d7bd 100644 --- a/TestEGr.cpp +++ b/TestEGr.cpp @@ -15,12 +15,35 @@ #include "stdafx.h" #include "TestEGr.h" #include "TestEGrDlg.h" +#include "/EgtDev/Include/EGnDllMain.h" +#include "/EgtDev/Include/EgnGetModuleVer.h" +#include "/EgtDev/Include/EGnStringConverter.h" +#include "/EgtDev/Include/EgtIniFile.h" +#include "/EgtDev/Include/EgtLogger.h" +#include //---------------------------------------------------------------------------- #ifdef _DEBUG #define new DEBUG_NEW #endif +//--------------------------- Define ----------------------------------------- +#if defined( _WIN64) + #if defined( NDEBUG) + #define STR_EXE "TestEGrR64.exe" + #else + #define STR_EXE "TestEGrD64.exe" + #endif +#elif defined( _WIN32) + #if defined( NDEBUG) + #define STR_EXE "TestEGrR32.exe" + #else + #define STR_EXE "TestEGrD32.exe" + #endif +#endif + +using namespace std ; +using namespace egtlogger ; //---------------------------------------------------------------------------- // The one and only CTestEGrApp object @@ -34,21 +57,15 @@ END_MESSAGE_MAP() //---------------------------------------------------------------------------- CTestEGrApp::CTestEGrApp( void) { - // TODO: add construction code here, - // Place all significant initialization in InitInstance } //---------------------------------------------------------------------------- BOOL CTestEGrApp::InitInstance( void) { - // InitCommonControlsEx() is required on Windows XP if an application - // manifest specifies use of ComCtl32.dll version 6 or later to enable - // visual styles. Otherwise, any window creation will fail. + // CommonControls initialize INITCOMMONCONTROLSEX InitCtrls ; InitCtrls.dwSize = sizeof( InitCtrls) ; - // Set this to include all the common control classes you want to use - // in your application. InitCtrls.dwICC = ICC_WIN95_CLASSES ; InitCommonControlsEx( &InitCtrls) ; @@ -56,20 +73,54 @@ CTestEGrApp::InitInstance( void) AfxEnableControlContainer() ; + // recupero il direttorio del programma e lo imposto come corrente + string sDir ; + GetModuleDirectory( NULL, sDir) ; + SetCurrentDirectory( sDir) ; + // costruisco path file INI + string sFileIni= sDir + "\\TestEGr.ini" ; + wchar_t* p = _wcsdup( stringtoW( sFileIni)) ; + free( (void*) m_pszProfileName) ; + m_pszProfileName = p ; + + // livello di debug + int nDebug = GetPrivateProfileInt( "General", "Debug", 0, m_pszProfileName) ; + + // inizializzazioni del logger + Logger logger( ( nDebug > 0 ? LL_DEBUG : LL_INFO), "TestEGr") ; + logger.AddOutputStream( new ofstream( "TestEgr.log"), true) ; + + // inizio programma + LOG_DATETIME( &logger, " Start") + + // versione del programma + LOG_INFO( &logger, GetExeNameVer().c_str()) + + // versione delle librerie + LOG_INFO( &logger, GetEGnVersion()) + //LOG_INFO( &logger, GetENkVersion()) + //LOG_INFO( &logger, GetEGkVersion()) + + // Dialog interface CTestEGrDlg dlg ; m_pMainWnd = &dlg ; - INT_PTR nResponse = dlg.DoModal() ; - if ( nResponse == IDOK) { - // TODO: Place code here to handle when the dialog is - // dismissed with OK - } - else if ( nResponse == IDCANCEL) { - // TODO: Place code here to handle when the dialog is - // dismissed with Cancel - } + dlg.DoModal() ; - // Since the dialog has been closed, return FALSE so that we exit the - // application, rather than start the application's message pump. + // fine programma + LOG_DATETIME( &logger, " End") + + // Exit application with FALSE return FALSE ; } +//---------------------------------------------------------------------------- +string +GetExeNameVer( void) +{ + string sVer ; + + + GetModuleVersion( NULL, sVer) ; + return string( STR_EXE " ver." + sVer) ; +} + diff --git a/TestEGr.h b/TestEGr.h index 28c41e7..2fef339 100644 --- a/TestEGr.h +++ b/TestEGr.h @@ -1,6 +1,15 @@ - -// TestEGr.h : main header file for the PROJECT_NAME application +//---------------------------------------------------------------------------- +// EgalTech 2013-2014 +//---------------------------------------------------------------------------- +// File : TestEGr.h Data : 02.02.14 Versione : 1.5b1 +// Contenuto : Dichiarazione della classe applicazione test grafica. // +// +// +// Modifiche : 02.02.14 DS Creazione modulo. +// +// +//---------------------------------------------------------------------------- #pragma once @@ -8,25 +17,20 @@ #error "include 'stdafx.h' before including this file for PCH" #endif -#include "resource.h" // main symbols +#include -// CTestEGrApp: -// See TestEGr.cpp for the implementation of this class -// - +//---------------------------------------------------------------------------- class CTestEGrApp : public CWinApp { -public: - CTestEGrApp(); + public : + CTestEGrApp( void) ; -// Overrides -public: - virtual BOOL InitInstance(); - -// Implementation + public : + virtual BOOL InitInstance( void) ; DECLARE_MESSAGE_MAP() -}; +} ; -extern CTestEGrApp theApp; \ No newline at end of file +//---------------------------------------------------------------------------- +std::string GetExeNameVer( void) ; diff --git a/TestEGr.rc b/TestEGr.rc index ab0cd193d1717566508aad9110f206b9c5a96161..e75a7909922685897595be2f80b3e87f472853ce 100644 GIT binary patch delta 331 zcmX?-@t}iogB_ExK7%VmIztJA3qvYH8G}B9Cqo`XGD8kSDMJcS1ST88kjPL3RF?`= z8MfJ*Ns*0NfkAh2E{7(!D?g?#y}K$<~waxA~% zWHbIUY{sy+=D H>Nj`*c0f+) delta 113 zcmaFR!FVKNgB=rZ2}2@75kopdDnkiF+2%qfMK(sA$x}HrC(Cg0Z9c>CjhWe>!F%(0 z9)4y!&HwWN0I2vP A-~a#s diff --git a/TestEGr.vcxproj b/TestEGr.vcxproj index 72a35b8..03dac0c 100644 --- a/TestEGr.vcxproj +++ b/TestEGr.vcxproj @@ -132,7 +132,7 @@ 0x0409 - _DEBUG;_DEB32;%(PreprocessorDefinitions) + _DEBUG;_DEB64;%(PreprocessorDefinitions) $(IntDir);%(AdditionalIncludeDirectories) @@ -189,7 +189,7 @@ 0x0409 - NDEBUG;NDEB32;%(PreprocessorDefinitions) + NDEBUG;NDEB64;%(PreprocessorDefinitions) $(IntDir);%(AdditionalIncludeDirectories) @@ -204,7 +204,6 @@ - diff --git a/TestEGr.vcxproj.filters b/TestEGr.vcxproj.filters index 5bdc0ca..b5ec1f6 100644 --- a/TestEGr.vcxproj.filters +++ b/TestEGr.vcxproj.filters @@ -32,9 +32,6 @@ File di intestazione - - File di intestazione - File di intestazione diff --git a/TestEGrDlg.cpp b/TestEGrDlg.cpp index a78adf6..9ad1cf4 100644 --- a/TestEGrDlg.cpp +++ b/TestEGrDlg.cpp @@ -15,6 +15,8 @@ #include "stdafx.h" #include "TestEGr.h" #include "TestEGrDlg.h" +#include "resource.h" +#include "/EgtDev/Include/EgtIniFile.h" #include "afxdialogex.h" //---------------------------------------------------------------------------- @@ -30,6 +32,9 @@ class CAboutDlg : public CDialogEx public : CAboutDlg( void) ; + protected : + BOOL OnInitDialog( void) ; + DECLARE_MESSAGE_MAP() } ; @@ -38,6 +43,17 @@ CAboutDlg::CAboutDlg( void) : CDialogEx( IDD_ABOUTBOX) { } +//---------------------------------------------------------------------------- +BOOL +CAboutDlg::OnInitDialog( void) +{ + CDialogEx::OnInitDialog() ; + + GetDlgItem( IDC_EXEVER)->SetWindowText( stringtoW( GetExeNameVer())) ; + + return TRUE ; +} + BEGIN_MESSAGE_MAP( CAboutDlg, CDialogEx) END_MESSAGE_MAP() @@ -65,6 +81,8 @@ BEGIN_MESSAGE_MAP( CTestEGrDlg, CDialogEx) ON_WM_PAINT() ON_WM_QUERYDRAGICON() ON_WM_SIZE() + ON_WM_CLOSE() + ON_COMMAND( IDC_CLOSE, OnClose) END_MESSAGE_MAP() //---------------------------------------------------------------------------- @@ -103,11 +121,11 @@ CTestEGrDlg::OnInitDialog( void) //---------------------------------------------------------------------------- void -CTestEGrDlg::OnOK( void) +CTestEGrDlg::OnClose( void) { m_OGL_Window.DestroyScene() ; - CDialogEx::OnOK() ; + EndDialog( IDCLOSE) ; } //---------------------------------------------------------------------------- @@ -172,13 +190,13 @@ CTestEGrDlg::OnSize( UINT nType, int cx, int cy) // se cambiata dimensione if ( nType == SIZE_RESTORED || nType == SIZE_MAXIMIZED) { - // spostamento comandi - CWnd* pOK = GetDlgItem( IDOK) ; - if ( pOK != nullptr) { + // spostamento bottoni + CWnd* pBtn = GetDlgItem( IDC_CLOSE) ; + if ( pBtn != nullptr) { CRect rect ; - pOK->GetWindowRect( rect) ; - pOK->MoveWindow( cx - rect.Width() / 2 - SIDEBAR_W / 2, cy - rect.Height(), - rect.Width(), rect.Height(), TRUE) ; + pBtn->GetWindowRect( rect) ; + pBtn->MoveWindow( cx - rect.Width() / 2 - SIDEBAR_W / 2, cy - rect.Height(), + rect.Width(), rect.Height(), TRUE) ; } // adattamento finestra if ( m_bOpenGLWindowsExists) { @@ -195,6 +213,14 @@ CTestEGrDlg::StartOpenGL( void) CRect rectWin ; + // recupero i parametri + int nDouBuff = GetPrivateProfileInt( "OpenGL", "DoubleBuffer", 1, AfxGetApp()->m_pszProfileName) ; + int nColorBits = GetPrivateProfileInt( "OpenGL", "ColorBits", 16, AfxGetApp()->m_pszProfileName) ; + int nDepthBits = GetPrivateProfileInt( "OpenGL", "DepthBits", 16, AfxGetApp()->m_pszProfileName) ; + bool bGenDriver = ( GetPrivateProfileInt( "OpenGL", "GenDriver", 0, AfxGetApp()->m_pszProfileName) == 1) ; + + + GetDlgItem( IDC_SCENE)->GetWindowRect( rectWin) ; ScreenToClient( rectWin) ; diff --git a/TestEGrDlg.h b/TestEGrDlg.h index 94abe77..4195296 100644 --- a/TestEGrDlg.h +++ b/TestEGrDlg.h @@ -27,7 +27,7 @@ class CTestEGrDlg : public CDialogEx protected : virtual BOOL OnInitDialog( void) ; - virtual void OnOK( void) ; + afx_msg void OnClose( void) ; afx_msg void OnSysCommand( UINT nID, LPARAM lParam) ; afx_msg void OnPaint( void) ; afx_msg HCURSOR OnQueryDragIcon( void) ; diff --git a/resource.h b/resource.h index f9b64cfbf78dbc1bac22559e7b70af334997cc5b..52f9b3dc672585b26c8e464e82930005808117bd 100644 GIT binary patch delta 68 zcmcb>)xopj4bx-|MiFjjhIj^N1|J50hTzHTnan3&U=f?VfQf_Kl_7$`l_3m>gC=ie Y(w+Q(iH*@{^K+(`jEu&UFS67F0E!0_i~s-t delta 20 ccmeC+xxlsI4b$c&%ug66J28t*p2wO609h*s+5i9m diff --git a/stdafx.h b/stdafx.h index 4cb6425..9b8d868 100644 --- a/stdafx.h +++ b/stdafx.h @@ -13,7 +13,7 @@ #define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers #endif -#include "targetver.h" +#include "/EgtDev/Include/EgtTargetVer.h" #define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit @@ -37,7 +37,16 @@ #include // MFC support for ribbons and control bars +#include "/EgtDev/Include/EgtLibVer.h" +#pragma comment(lib, "opengl32.lib") +#pragma comment(lib, "glu32.lib") +#if defined( _WIN64) +#pragma comment(lib, EGTEXTDIR "GLEW/lib/x64/glew32mx.lib") +#elif defined( _WIN32) +#pragma comment(lib, EGTEXTDIR "GLEW/lib/x32/glew32mx.lib") +#endif +#pragma comment(lib, EGTLIBDIR "EgtGeneral" EGTLIBVER ".lib") diff --git a/targetver.h b/targetver.h deleted file mode 100644 index 90e767b..0000000 --- a/targetver.h +++ /dev/null @@ -1,8 +0,0 @@ -#pragma once - -// Including SDKDDKVer.h defines the highest available Windows platform. - -// If you wish to build your application for a previous Windows platform, include WinSDKVer.h and -// set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. - -#include