#include <windows.h>
#include <gl/gl.h>
#include <gl/glu.h>
#include "func1.h"
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
BOOL DoFileOpen(HWND hwnd,char *Filter);
void reDraw();
HWND view2D;
int STDCALL WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpCmdLine,int iCmdShow)
{
WNDCLASS wc;
HWND hWnd;
MSG msg;
wc.style = CS_HREDRAW | CS_VREDRAW;
wc.lpfnWndProc = WndProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = hInstance;
wc.hIcon = LoadIcon( NULL, IDI_APPLICATION );
wc.hCursor = LoadCursor( NULL, IDC_ARROW );
wc.hbrBackground = (HBRUSH)(COLOR_3DFACE+1);
wc.lpszMenuName = NULL;
wc.lpszClassName = "DEM";
RegisterClass( &wc );
Condition.onbmp=0;
Condition.onfbmp=0;
Condition.onfdem=0;
Condition.onnet=0;
Condition.onopengl=0;
Condition.onshdow=0;
hWnd = CreateWindow(
"DEM",
"DEM",
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT,
CW_USEDEFAULT,
1000,
768,
NULL,
NULL,
hInstance,
NULL);
ShowWindow(hWnd ,SW_SHOWMAXIMIZED);
UpdateWindow(hWnd);
HWND view3D = CreateWindow ( //3D绘图区
"DEM",
"",
WS_CHILD|WS_VISIBLE|WS_DLGFRAME,
0, 0, 950,740,
hWnd,
(HMENU) 1,
hInstance,
NULL
);
view2D = CreateWindow ( //2D绘图区
"DEM",
"",
WS_CHILD|WS_VISIBLE|WS_DLGFRAME,
952, 0, 325,375,
hWnd,
(HMENU) 2,
hInstance,
NULL
);
EnableOpenGL( view3D, &hDC, &hRC );
while(GetMessage(&msg, NULL, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
reDraw();
}
DisableOpenGL( view3D, hDC, hRC );
DestroyWindow( hWnd );
return msg.wParam;
}
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
static HWND hwndButton[7]={0,0,0,0,0,0,0};
HDC hdc;
PAINTSTRUCT ps;
RECT rc;
static TCHAR szBuffer[40];
switch (message)
{
case WM_CREATE:
hwndButton[0]= CreateWindow (
"button",
"打开DEM数据...",
WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
952, 530, 120, 30,
hWnd,
(HMENU) 3,
((LPCREATESTRUCT) lParam)->hInstance,
NULL
);
hwndButton[1]= CreateWindow (
"button",
"打开地形纹理...",
WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
952, 560, 120, 30,
hWnd,
(HMENU) 4,
((LPCREATESTRUCT) lParam)->hInstance,
NULL
);
hwndButton[2]= CreateWindow (
"button",
"退出",
WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
1065, 710, 120, 30,
hWnd,
(HMENU) 5,
((LPCREATESTRUCT) lParam)->hInstance,
NULL
);
hwndButton[3]= CreateWindow (
"button",
"显示网格",
WS_CHILD | WS_VISIBLE |BS_AUTOCHECKBOX,
955, 609, 161, 50,
hWnd,
(HMENU) 6,
((LPCREATESTRUCT) lParam)->hInstance,
NULL
);
hwndButton[4]= CreateWindow (
"button",
"位图纹理",
WS_CHILD | WS_VISIBLE |BS_AUTOCHECKBOX,
955, 659, 161, 42,
hWnd,
(HMENU) 7,
((LPCREATESTRUCT) lParam)->hInstance,
NULL
);
hwndButton[5]= CreateWindow (
"button",
"openGL",
WS_CHILD | WS_VISIBLE |BS_AUTOCHECKBOX,
1116, 609, 157, 50,
hWnd,
(HMENU) 8,
((LPCREATESTRUCT) lParam)->hInstance,
NULL
);
hwndButton[6]= CreateWindow (
"button",
"阴影",
WS_CHILD | WS_VISIBLE |BS_AUTOCHECKBOX,
1116, 659, 157, 42,
hWnd,
(HMENU) 9,
((LPCREATESTRUCT) lParam)->hInstance,
NULL
);
印第安爸爸
- 粉丝: 6
- 资源: 25
- 1
- 2
- 3
- 4
前往页