TestEgr 15b1 : migliorie varie per aggiornamento visualizzazione.

This commit is contained in:
Dario Sassi
2014-02-02 15:25:08 +00:00
parent acd53d6303
commit d14d83bb5f
12 changed files with 140 additions and 77 deletions
+2 -8
View File
@@ -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)
+2 -11
View File
@@ -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 ;
+69 -18
View File
@@ -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 <fstream>
//----------------------------------------------------------------------------
#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) ;
}
+20 -16
View File
@@ -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 <string>
// 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;
//----------------------------------------------------------------------------
std::string GetExeNameVer( void) ;
BIN
View File
Binary file not shown.
+2 -3
View File
@@ -132,7 +132,7 @@
</Midl>
<ResourceCompile>
<Culture>0x0409</Culture>
<PreprocessorDefinitions>_DEBUG;_DEB32;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>_DEBUG;_DEB64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile>
<PostBuildEvent>
@@ -189,7 +189,7 @@
</Midl>
<ResourceCompile>
<Culture>0x0409</Culture>
<PreprocessorDefinitions>NDEBUG;NDEB32;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>NDEBUG;NDEB64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile>
<PostBuildEvent>
@@ -204,7 +204,6 @@
<ClInclude Include="OpenGLRenderer.h" />
<ClInclude Include="Resource.h" />
<ClInclude Include="stdafx.h" />
<ClInclude Include="targetver.h" />
<ClInclude Include="TestEGr.h" />
<ClInclude Include="TestEGrDlg.h" />
</ItemGroup>
-3
View File
@@ -32,9 +32,6 @@
<ClInclude Include="stdafx.h">
<Filter>File di intestazione</Filter>
</ClInclude>
<ClInclude Include="targetver.h">
<Filter>File di intestazione</Filter>
</ClInclude>
<ClInclude Include="Resource.h">
<Filter>File di intestazione</Filter>
</ClInclude>
+34 -8
View File
@@ -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) ;
+1 -1
View File
@@ -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) ;
BIN
View File
Binary file not shown.
+10 -1
View File
@@ -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 <afxcontrolbars.h> // 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")
-8
View File
@@ -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 <SDKDDKVer.h>