-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdemo_01.cpp
90 lines (65 loc) · 1.64 KB
/
demo_01.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
///////////////////////////////////////////////////////////////
// Camera debugging application (05/17/02:2156)
///////////////////////////////////////////////////////////////
#include "camera.h"
#include "util_common_h.h"
#include "win32.h"
#include "opengl.h"
#include <windows.h>
#include <gl/gl.h>
#include <math.h>
int WINAPI WinMain( HINSTANCE hInstance , HINSTANCE hPrevInstance , LPSTR string , int WinArg )
{
int i=0,pos=0,dir=0;
Camera_t cam01;
WndStruct w; w.xDimension = 500,w.yDimension=500;w.hInstance = hInstance;
MSG m;
OpenGL_Struct ogl;
k_boolean complete=k_false;
ogl.contextDepth = 16;
ogl.contextPitch = 640;
ogl.fullScreen = k_false;
ogl.yResolution = 480;
SYS_OGL_CreateContext(&ogl,&w);
cam01.angDiff = 1.0f;
MTV_Init( cam01.Direction , 0 , 45 , 0 );
MTV_Init( cam01.Position , 0 , 0 , 10 );
while( complete==k_false )
{
if( PeekMessage( &m , w.hWnd , 0 , 0 , PM_REMOVE) )
{
if( m.message == WM_QUIT )
{
PostQuitMessage( 0 );
complete = k_true;
}
else
{
TranslateMessage( &m );
DispatchMessage( &m );
}
}
else
{
SYS_OGL_PrepFrame();
glLoadIdentity();
ENT_C_LookAt( &cam01 );
//cam01.Position.yComponent += sin(pos/10);
pos++;
glRotatef( i++ , 0 , -1 , 0 );
glBegin( GL_QUADS );
glColor3d( 0 , 1 , 0 );
glVertex3d( -1 , 1 , 0 );
glColor3d( 1 , 1 , 1 );
glVertex3d( 1 , 1 , 0 );
glColor3d( 0 , 0 , 1 );
glVertex3d( 1 , -1 , 0 );
glColor3d( 1 , 0 , 0 );
glVertex3d( -1 , -1 , 0 );
glEnd();
SwapBuffers( ogl.hDeviceContext );
}
}
SYS_OGL_KillContext( &ogl , &w );
return m.wParam;
}