ReactOS 0.4.16-dev-87-g3dfbe52
ssstars.c
Go to the documentation of this file.
1/*
2 * Star field screensaver
3 *
4 * Copyright 2011 Carlo Bramini
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21#define WIN32_LEAN_AND_MEAN
22#include <windows.h>
23#include <tchar.h>
24#include <scrnsave.h>
25
26#include <stdlib.h>
27#include <time.h>
28#include <math.h>
29
30#include <GL/gl.h>
31#include <GL/glu.h>
32
33#include "resource.h"
34#include "settings.h"
35
36#define FAR_PLANE -80.0f
37#define NEAR_PLANE 3.0f
38#define GAP 0.0f
39#define FIELD_WIDTH 50.f
40#define FIELD_HEIGHT 45.f
41#define FIELD_DEPTH (NEAR_PLANE - FAR_PLANE + GAP)
42
43#define STAR_RED 0.f
44#define STAR_GREEN 0.f
45#define STAR_BLUE 0.10f
46#define STAR_TAIL 0.9f
47
48typedef struct {
49 float x1;
50 float y1;
51 float x2;
52 float y2;
53 float z;
54} VERTEX;
55
57static HGLRC hRC; // Permanent Rendering Context
58static HDC hDC; // Private GDI Device Context
59static float fAngle;
61
62// Light position
64 0.0f, 0.0f, 3.0f, 1.0f
65};
66
67static PIXELFORMATDESCRIPTOR pfd= // Pixel Format Descriptor
68{
69 sizeof(PIXELFORMATDESCRIPTOR), // Size Of This Pixel Format Descriptor
70 1, // Version Number (?)
71 PFD_DRAW_TO_WINDOW | // Format Must Support Window
72 PFD_SUPPORT_OPENGL | // Format Must Support OpenGL
73 PFD_DOUBLEBUFFER, // Must Support Double Buffering
74 PFD_TYPE_RGBA, // Request An RGBA Format
75 16, // Select A 16Bit Color Depth
76 0, 0, 0, 0, 0, 0, // Color Bits Ignored (?)
77 0, // No Alpha Buffer
78 0, // Shift Bit Ignored (?)
79 0, // No Accumulation Buffer
80 0, 0, 0, 0, // Accumulation Bits Ignored (?)
81 16, // 16Bit Z-Buffer (Depth Buffer)
82 0, // No Stencil Buffer
83 0, // No Auxiliary Buffer (?)
84 PFD_MAIN_PLANE, // Main Drawing Layer
85 0, // Reserved (?)
86 0, 0, 0 // Layer Masks Ignored (?)
87};
88
90{
91 BITMAPINFO bi;
92 LPBYTE lpBits;
93 LPBYTE *lppBits;
94 HBITMAP hTextBmp, hFileBmp;
95 HDC hTextDC, hFileDC;
96 HGDIOBJ hOldText, hOldFile;
97 UINT i;
98 DWORD *Ptr32;
99 BITMAP bm;
101
102 // Get instance for loading the texture
104
105 // Load the texture
106 hFileBmp = (HBITMAP)
107 LoadImage(
108 hInstance,
111 0, 0,
113 );
114
115 // Get texture specs
116 GetObject(hFileBmp, sizeof(BITMAP), &bm);
117
118 // Allocate new 32 bit texture
119 ZeroMemory(&bi, sizeof(bi));
120
121 bi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
122 bi.bmiHeader.biWidth = bm.bmWidth;
123 bi.bmiHeader.biHeight = -bm.bmHeight;
124 bi.bmiHeader.biPlanes = 1;
125 bi.bmiHeader.biBitCount = 32;
127
128 // Makes GCC happy ;-|
129 lppBits = &lpBits;
130
131 hTextBmp = CreateDIBSection(hDC,
132 (BITMAPINFO*)&bi,
134 (void**)lppBits,
135 NULL,
136 0);
137
138 // Save new texture specs
139// GetObject(hTextBmp, sizeof(BITMAP), &bmStarTex);
140// bmStarTex.bmBits = lpBits;
141
142 // Copy 24 bit texture in 32 texture
143 hTextDC = CreateCompatibleDC(hDC);
144 hFileDC = CreateCompatibleDC(hDC);
145
146 hOldText = SelectObject(hTextDC, hTextBmp);
147 hOldFile = SelectObject(hFileDC, hFileBmp);
148
149 BitBlt(hTextDC, 0, 0, bm.bmWidth, bm.bmHeight, hFileDC, 0, 0, SRCCOPY);
150
151 SelectObject(hTextDC, hOldText);
152 SelectObject(hFileDC, hOldFile);
153
154 DeleteDC(hTextDC);
155 DeleteDC(hFileDC);
156
157 // Delete 24 bit texture
158 DeleteObject(hFileBmp);
159
160 GetObject(hTextBmp, sizeof(BITMAP), &bm);
161
162 // Apply ALPHA channel to new texture
163 for (Ptr32=(DWORD *)lpBits, i=0; i < (UINT)(bm.bmWidth * bm.bmHeight); i++)
164 {
165 DWORD Color = Ptr32[i] & 0x00FFFFFF;
166 DWORD Alpha = Color & 0xFF;
167
168 Color |= Alpha << 24;
169
170 Ptr32[i] = Color;
171 }
172
173 return hTextBmp;
174}
175
176static void InitGL(HBITMAP hStarTex)
177{
178 BITMAP bm;
179 unsigned int i;
180 float xp, yp, zp;
181
182 // set the GL clear color - use when the color buffer is cleared
184
185 if (Settings.bSmoothShading)
186 // set the shading model to 'smooth'
188 else
189 // set the shading model to 'flat'
191
192 // set GL to render front of polygons
194 // enable depth test
196
197 // enable lighting
199 // enable lighting for front
201 // material have diffuse and ambient lighting
203 // enable color
205 // enable light 0
207
208 // set light attenuation
209 glLightf( GL_LIGHT0, GL_CONSTANT_ATTENUATION, 0.01f); //0.01f );
210 glLightf( GL_LIGHT0, GL_LINEAR_ATTENUATION, 0.01f); //0.2f );
211 glLightf( GL_LIGHT0, GL_QUADRATIC_ATTENUATION, 0.005f); //0.001f );
212
213 // clear the color buffer once
215
216 // randomly generate
217 srand( time( NULL ) );
218
219 // Initialize *ALL* stars vertexes (not just programmed ones).
220 for (i = 0; i < MAX_STARS; i++)
221 {
222 xp = ( (float) rand() / RAND_MAX - .5f ) * FIELD_WIDTH;
223 yp = ( (float) rand() / RAND_MAX - .5f ) * FIELD_HEIGHT;
224 zp = ( (float) rand() / RAND_MAX ) * FIELD_DEPTH + FAR_PLANE;
225
226 Vertex[i].x1 = -1.f + xp;
227 Vertex[i].y1 = -1.f + yp;
228 Vertex[i].x2 = 1.f + xp;
229 Vertex[i].y2 = 1.f + yp;
230 Vertex[i].z = zp;
231 }
232
233 glGenTextures(1, &glStarTex); // Create One Texture
234
235 // Create Linear Filtered Texture
237
238 if (Settings.bEnableFiltering)
239 {
242 } else {
245 }
246
247 // Get Texture properties
248 GetObject(hStarTex, sizeof(BITMAP), &bm);
249
250 // Create texture as a mipmap
251#if 0
252 glTexImage2D(GL_TEXTURE_2D, 0, 4, bm.bmWidth, bm.bmHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, bm.bmBits);
253#else
254 gluBuild2DMipmaps(GL_TEXTURE_2D, 4, bm.bmWidth, bm.bmHeight, GL_RGBA, GL_UNSIGNED_BYTE, bm.bmBits);
255#endif
256
257 // Disable Texture Mapping (background smoothing)
259
260 if (Settings.bFinePerspective)
261 // Really Fast Perspective Calculations
263 else
264 // Really Nice Perspective Calculations
266
267 // enable blending
269}
270
271static void
273{
274 unsigned int i;
275 float fSpin;
276 float fSpeed;
277 float xp, yp;
278
279 // Initialize current speed
280 fSpeed = (float)Settings.uiSpeed / 100.f;
281
282 glEnable(GL_TEXTURE_2D); // Enable Texture Mapping
283
284 glBlendFunc(GL_SRC_ALPHA,GL_ONE); // Set The Blending Function For Translucency
285
286 switch (Settings.uiRotation) {
287 case ROTATION_LINEAR:
288 fAngle += fSpeed;
289 glRotatef( fAngle, 0.0f, 0.0f, 1.0f );
290 break;
291
293 fAngle += fSpeed / 75.f;
294 fSpin = (float)(50. * cos(fAngle));
295 glRotatef( fSpin, 0.0f, 0.0f, 1.0f );
296 break;
297 }
298
299 glColor3ub(255, 255, 255);
300
301 glBegin(GL_QUADS); // Begin Drawing The Textured Quad
302
303 // Draw the stars
304 for (i = 0; i < Settings.uiNumStars; i++)
305 {
306 glTexCoord2f(0.0f, 0.0f); glVertex3f(Vertex[i].x1, Vertex[i].y1, Vertex[i].z);
307 glTexCoord2f(1.0f, 0.0f); glVertex3f(Vertex[i].x2, Vertex[i].y1, Vertex[i].z);
308 glTexCoord2f(1.0f, 1.0f); glVertex3f(Vertex[i].x2, Vertex[i].y2, Vertex[i].z);
309 glTexCoord2f(0.0f, 1.0f); glVertex3f(Vertex[i].x1, Vertex[i].y2, Vertex[i].z);
310
311 // increment z
312 Vertex[i].z += fSpeed;
313
314 // check to see if passed view
315 if( Vertex[i].z > NEAR_PLANE + GAP ||
316 Vertex[i].z < FAR_PLANE )
317 {
318 xp = ( (float) rand() / RAND_MAX - .5f ) * FIELD_WIDTH;
319 yp = ( (float) rand() / RAND_MAX - .5f ) * FIELD_HEIGHT;
320
321 Vertex[i].x1 = -1.f + xp;
322 Vertex[i].y1 = -1.f + yp;
323 Vertex[i].x2 = 1.f + xp;
324 Vertex[i].y2 = 1.f + yp;
325 Vertex[i].z = FAR_PLANE;
326 }
327 }
328
329 glEnd(); // Done Drawing The Textured Quad
330
331 glDisable(GL_TEXTURE_2D); // Enable Texture Mapping
332}
333
334static LRESULT CALLBACK
336{
338 HBITMAP hStarTex;
339
340 LoadSettings();
341
342 // Gets A Device Context For The Window
343 hDC = GetDC(hWnd);
344
345 // Finds The Closest Match To The Pixel Format We Set Above
347
348 // No Matching Pixel Format?
349 if (!PixelFormat)
350 {
351 MessageBox(0, _T("Can't Find A Suitable PixelFormat."), _T("Error"),MB_OK | MB_ICONERROR);
352
353 // This Sends A 'Message' Telling The Program To Quit
355 return 0;
356 }
357
358 // Can We Set The Pixel Mode?
360 {
361 MessageBox(0, _TEXT("Can't Set The PixelFormat."), _T("Error"), MB_OK | MB_ICONERROR);
362
363 // This Sends A 'Message' Telling The Program To Quit
365 return 0;
366 }
367
368 // Grab A Rendering Context
370
371 // Did We Get One?
372 if (!hRC)
373 {
374 MessageBox(0, _T("Can't Create A GL Rendering Context."), _T("Error"), MB_OK | MB_ICONERROR);
375
376 // This Sends A 'Message' Telling The Program To Quit
378 return 0;
379 }
380
381 // Can We Make The RC Active?
382 if (!wglMakeCurrent(hDC, hRC))
383 {
384 MessageBox(0, _T("Can't Activate GLRC."), _TEXT("Error"), MB_OK | MB_ICONERROR);
385
386 // This Sends A 'Message' Telling The Program To Quit
388 return 0;
389 }
390
391 // Load star texture
392 hStarTex = CreateStarBitmap(hWnd, hDC);
393
394 // Initialize The GL Screen Using Screen Info
395 InitGL(hStarTex);
396
397 // Delete GDI object for texture
398 DeleteObject(hStarTex);
399
400 // Update screen every 10ms
401 SetTimer(hWnd, 1, 10, NULL);
402
403 // Initialize spinning angle
404 fAngle = 0.f;
405
406 return 0L;
407}
408
409static LRESULT CALLBACK
411{
412 // Delete update timer
413 KillTimer(hWnd, 1);
414
415 // Disable Fullscreen Mode
416 ChangeDisplaySettings(NULL, 0);
417
418 // Make The DC Current
420
421 // Kill The RC
423
424 // Free The DC
426
427#ifdef _DEBUG_SSTARS
429#endif
430
431 return 0L;
432}
433
434static LRESULT CALLBACK
436{
437 if (Settings.bDoBlending)
438 {
440
441 // disable lighting
443
444 // blend in a polygon
446
447 // Restore both model view and projection to identity
449 glPushMatrix();
451
453 glPushMatrix();
455
456 // Blur the background
457 glBegin( GL_QUADS );
458 glVertex3f( -1.0f, -1.0f, -1.0f );
459 glVertex3f( -1.0f, 1.0f, -1.0f );
460 glVertex3f( 1.0f, 1.0f, -1.0f );
461 glVertex3f( 1.0f, -1.0f, -1.0f );
462 glEnd();
463
464 // Recover previous matrix
465 glPopMatrix();
467 glPopMatrix();
468
469 // enable lighting
471 } else {
473 }
474
475 // save the current matrix state, so transformation will
476 // not persist across displayFunc calls, since we
477 // will do a glPopMatrix() at the end of this function
478 glPushMatrix();
479
480 // render the scene
481 render();
482
483 // restore the matrix state
484 glPopMatrix();
485
486 // flush the buffer
487 glFlush();
488
489 // swap the double buffer
491
492 // Clear redraw event
494
495 return 0L;
496}
497
498static LRESULT CALLBACK
500{
503
504 // map the view port to the entire client area
505 glViewport(0, 0, w, h);
506
507 // set the matrix mode to projection matrix
509
510 // load the identity matrix
512
513 // set the perspective matrix
514 gluPerspective( 64.0, (GLdouble) w / (GLdouble)h, .1, 300.0 );
515
516 // set the matrix mode to the modelview matrix
518
519 // load the identity matrix into the modelview matrix
521
522 // set the 'camera'
523 gluLookAt( 0.0, 0.0, 3.0, 0.0, 0.0, 0.0, 0.0, 2.0, 3.0 );
524
525 // set the position of the light
527
528 return 0L;
529}
530
533{
534 switch (uMsg) {
535 case WM_CREATE:
536 return OnCreate(hWnd, wParam, lParam);
537
538 case WM_TIMER:
540 return 0L;
541
542 case WM_DESTROY:
543 return OnDestroy(hWnd, wParam, lParam);
544
545 case WM_PAINT:
546 return OnPaint(hWnd, wParam, lParam);
547
548 case WM_SIZE: // Resizing The Screen
549 return OnSize(hWnd, wParam, lParam);
550 }
551
552#ifdef _DEBUG_SSTARS
553 return DefWindowProc(hWnd, uMsg, wParam, lParam);
554#else
555 return DefScreenSaverProc(hWnd, uMsg, wParam, lParam);
556#endif
557}
558
559#ifdef _DEBUG_SSTARS
560
562{
563 WNDCLASS wc;
564
565 ZeroMemory(&wc, sizeof(wc));
566
569 wc.cbClsExtra = 0;
570 wc.cbWndExtra = 0;
571 wc.hInstance = hInstance;
575 wc.lpszMenuName = NULL;
577
578 return RegisterClass(&wc);
579}
580
582{
583 HWND hWnd;
584 TCHAR szClass[] = _T("CLASS");
585 TCHAR szTitle[] = _T("TITLE");
586
587 InitApp(hInstance, szClass);
588
590 szClass,
591 szTitle,
595 192*3, //CW_USEDEFAULT,
596 108*3, //CW_USEDEFAULT,
597 NULL,
598 NULL,
599 hInstance,
600 NULL);
601
602 if (hWnd)
603 {
604 ShowWindow(hWnd, nCmdShow);
606 }
607
608 return hWnd;
609}
610
611int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
612{
613 MSG msg;
614 HWND hWnd;
615 HWND hDlg;
616
618
619 hWnd = InitInstance(hInstance, nShowCmd);
620
622 ShowWindow(hDlg, SW_SHOW);
623 UpdateWindow(hDlg);
624
625 for (;;)
626 {
627 if (GetMessage(&msg, NULL, 0, 0) <= 0)
628 break;
629
632 }
633
634 return 0;
635}
636#endif
BOOL CALLBACK ScreenSaverConfigureDialog(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: 3dtext.c:397
BOOL WINAPI RegisterDialogClasses(HANDLE hInst)
Definition: 3dtext.c:432
_STLP_DECLSPEC complex< float > _STLP_CALL cos(const complex< float > &)
#define msg(x)
Definition: auth_time.c:54
void LoadSettings(void)
Definition: settings.c:53
HWND hWnd
Definition: settings.c:17
int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR cmdline, int cmdshow)
Definition: main.c:8
HINSTANCE hInstance
Definition: charmap.c:19
static HWND InitInstance(HINSTANCE hInst)
Definition: charmap.c:608
static const WCHAR szClassName[]
Definition: clipbrd.c:11
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
static BOOL InitApp(_In_ HINSTANCE hInstance, _In_ LPTSTR lpCmdLine)
Definition: ctfmon.cpp:188
WORD ATOM
Definition: dimm.idl:113
#define NULL
Definition: types.h:112
#define FALSE
Definition: types.h:117
#define CALLBACK
Definition: compat.h:35
static VOID BitBlt(_In_ ULONG Left, _In_ ULONG Top, _In_ ULONG Width, _In_ ULONG Height, _In_reads_bytes_(Delta *Height) PUCHAR Buffer, _In_ ULONG BitsPerPixel, _In_ ULONG Delta)
Definition: common.c:57
#define BI_RGB
Definition: precomp.h:56
unsigned long DWORD
Definition: ntddk_ex.h:95
pKey DeleteObject()
INT PixelFormat
#define GL_TRUE
Definition: gl.h:174
GLAPI void GLAPIENTRY glTexCoord2f(GLfloat s, GLfloat t)
#define GL_FASTEST
Definition: gl.h:584
#define GL_POSITION
Definition: gl.h:329
#define GL_NICEST
Definition: gl.h:585
#define GL_TEXTURE_MIN_FILTER
Definition: gl.h:649
GLAPI void GLAPIENTRY glEnable(GLenum cap)
#define GL_AMBIENT_AND_DIFFUSE
Definition: gl.h:331
float GLfloat
Definition: gl.h:161
#define GL_FRONT_AND_BACK
Definition: gl.h:336
GLAPI void GLAPIENTRY glTexImage2D(GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels)
#define GL_QUADS
Definition: gl.h:197
GLAPI void GLAPIENTRY glColorMaterial(GLenum face, GLenum mode)
GLAPI void GLAPIENTRY glHint(GLenum target, GLenum mode)
#define GL_QUADRATIC_ATTENUATION
Definition: gl.h:323
#define GL_DEPTH_TEST
Definition: gl.h:301
#define GL_LINEAR
Definition: gl.h:421
double GLdouble
Definition: gl.h:163
#define GL_SRC_ALPHA
Definition: gl.h:378
#define GL_SMOOTH
Definition: gl.h:339
GLAPI void GLAPIENTRY glPolygonMode(GLenum face, GLenum mode)
GLAPI void GLAPIENTRY glPushMatrix(void)
GLAPI void GLAPIENTRY glLoadIdentity(void)
unsigned int GLuint
Definition: gl.h:159
#define GL_NEAREST
Definition: gl.h:678
#define GL_UNSIGNED_BYTE
Definition: gl.h:178
#define GL_PROJECTION
Definition: gl.h:246
#define GL_MODELVIEW
Definition: gl.h:245
GLAPI void GLAPIENTRY glBlendFunc(GLenum sfactor, GLenum dfactor)
GLAPI void GLAPIENTRY glViewport(GLint x, GLint y, GLsizei width, GLsizei height)
GLAPI void GLAPIENTRY glBindTexture(GLenum target, GLuint texture)
#define GL_COLOR_BUFFER_BIT
Definition: gl.h:716
#define GL_FILL
Definition: gl.h:267
GLAPI void GLAPIENTRY glBegin(GLenum mode)
GLAPI void GLAPIENTRY glGenTextures(GLsizei n, GLuint *textures)
GLAPI void GLAPIENTRY glVertex3f(GLfloat x, GLfloat y, GLfloat z)
GLAPI void GLAPIENTRY glLightf(GLenum light, GLenum pname, GLfloat param)
#define GL_COLOR_MATERIAL
Definition: gl.h:340
GLAPI void GLAPIENTRY glPopMatrix(void)
#define GL_RGBA
Definition: gl.h:503
#define GL_LINEAR_ATTENUATION
Definition: gl.h:322
#define GL_BLEND
Definition: gl.h:371
#define GL_ONE_MINUS_SRC_ALPHA
Definition: gl.h:379
GLAPI void GLAPIENTRY glLightModeli(GLenum pname, GLint param)
#define GL_ONE
Definition: gl.h:375
GLAPI void GLAPIENTRY glRotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z)
GLAPI void GLAPIENTRY glEnd(void)
GLAPI void GLAPIENTRY glColor3ub(GLubyte red, GLubyte green, GLubyte blue)
int GLsizei
Definition: gl.h:160
GLAPI void GLAPIENTRY glTexParameteri(GLenum target, GLenum pname, GLint param)
GLAPI void GLAPIENTRY glLightfv(GLenum light, GLenum pname, const GLfloat *params)
#define GL_TEXTURE_MAG_FILTER
Definition: gl.h:648
GLAPI void GLAPIENTRY glDisable(GLenum cap)
#define GL_TEXTURE_2D
Definition: gl.h:645
#define GL_FRONT
Definition: gl.h:270
#define GL_FLAT
Definition: gl.h:338
#define GL_CONSTANT_ATTENUATION
Definition: gl.h:321
#define GL_PERSPECTIVE_CORRECTION_HINT
Definition: gl.h:578
GLAPI void GLAPIENTRY glColor4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
GLAPI void GLAPIENTRY glMatrixMode(GLenum mode)
GLAPI void GLAPIENTRY glShadeModel(GLenum mode)
GLAPI void GLAPIENTRY glClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
#define GL_LIGHT0
Definition: gl.h:311
GLAPI void GLAPIENTRY glFlush(void)
#define GL_LIGHTING
Definition: gl.h:310
GLAPI void GLAPIENTRY glClear(GLbitfield mask)
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
GLdouble GLdouble z
Definition: glext.h:5874
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define gluPerspective
Definition: glu_mangle.h:28
#define gluLookAt
Definition: glu_mangle.h:26
#define gluBuild2DMipmaps
Definition: glu_mangle.h:35
void __cdecl srand(_In_ unsigned int _Seed)
#define RAND_MAX
Definition: stdlib.h:87
_Check_return_ int __cdecl rand(void)
Definition: rand.c:10
#define _TEXT(x)
Definition: tchar.h:1535
TCHAR szTitle[MAX_LOADSTRING]
Definition: magnifier.c:35
__u16 time
Definition: mkdosfs.c:8
#define IDB_STAR
Definition: resource.h:12
#define ROTATION_LINEAR
Definition: settings.h:25
#define MAX_STARS
Definition: settings.h:30
#define ROTATION_PERIODIC
Definition: settings.h:26
static HBITMAP
Definition: button.c:44
static HDC
Definition: imagelist.c:88
static float(__cdecl *square_half_float)(float x
unsigned int UINT
Definition: ndis.h:50
#define L(x)
Definition: ntvdm.h:50
static HGLRC(WINAPI *pwglCreateContextAttribsARB)(HDC hDC
#define LOWORD(l)
Definition: pedump.c:82
#define WS_OVERLAPPEDWINDOW
Definition: pedump.c:637
#define DefWindowProc
Definition: ros2win.h:31
LRESULT WINAPI DefScreenSaverProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: scrnsave.c:92
#define DLG_SCRNSAVECONFIGURE
Definition: scrnsave.h:30
static LRESULT CALLBACK OnSize(HWND hWnd, WPARAM wParam, LPARAM lParam)
Definition: ssstars.c:499
#define GAP
Definition: ssstars.c:38
#define NEAR_PLANE
Definition: ssstars.c:37
static LRESULT CALLBACK OnDestroy(HWND hWnd, WPARAM wParam, LPARAM lParam)
Definition: ssstars.c:410
#define FIELD_WIDTH
Definition: ssstars.c:39
static float fAngle
Definition: ssstars.c:59
static HBITMAP CreateStarBitmap(HWND hWnd, HDC hDC)
Definition: ssstars.c:89
#define STAR_GREEN
Definition: ssstars.c:44
static HDC hDC
Definition: ssstars.c:58
#define STAR_BLUE
Definition: ssstars.c:45
#define STAR_RED
Definition: ssstars.c:43
static HGLRC hRC
Definition: ssstars.c:57
LRESULT CALLBACK ScreenSaverProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: ssstars.c:532
#define FIELD_HEIGHT
Definition: ssstars.c:40
#define FIELD_DEPTH
Definition: ssstars.c:41
static LRESULT CALLBACK OnPaint(HWND hWnd, WPARAM wParam, LPARAM lParam)
Definition: ssstars.c:435
static PIXELFORMATDESCRIPTOR pfd
Definition: ssstars.c:67
static VERTEX Vertex[MAX_STARS]
Definition: ssstars.c:56
static void render(void)
Definition: ssstars.c:272
static GLuint glStarTex
Definition: ssstars.c:60
static GLfloat g_light_position[4]
Definition: ssstars.c:63
#define FAR_PLANE
Definition: ssstars.c:36
#define STAR_TAIL
Definition: ssstars.c:46
static LRESULT CALLBACK OnCreate(HWND hWnd, WPARAM wParam, LPARAM lParam)
Definition: ssstars.c:335
static void InitGL(HBITMAP hStarTex)
Definition: ssstars.c:176
Definition: vmr9.c:2546
float y2
Definition: ssstars.c:52
float x1
Definition: ssstars.c:49
float y1
Definition: ssstars.c:50
float x2
Definition: ssstars.c:51
float z
Definition: vmr9.c:2546
Definition: bl.h:1331
HBRUSH hbrBackground
Definition: winuser.h:3173
HICON hIcon
Definition: winuser.h:3171
HINSTANCE hInstance
Definition: winuser.h:3170
HCURSOR hCursor
Definition: winuser.h:3172
int cbWndExtra
Definition: winuser.h:3169
UINT style
Definition: winuser.h:3166
LPCSTR lpszMenuName
Definition: winuser.h:3174
LPCSTR lpszClassName
Definition: winuser.h:3175
WNDPROC lpfnWndProc
Definition: winuser.h:3167
int cbClsExtra
Definition: winuser.h:3168
USHORT biBitCount
Definition: precomp.h:46
ULONG biCompression
Definition: precomp.h:47
BITMAPINFOHEADER bmiHeader
Definition: wingdi.h:1476
#define GetWindowLongPtr
Definition: treelist.c:73
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1829
HANDLE HINSTANCE
Definition: typedefs.h:77
unsigned char * LPBYTE
Definition: typedefs.h:53
#define HIWORD(l)
Definition: typedefs.h:247
#define _T(x)
Definition: vfdio.h:22
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_POWER_POLICY_IDLE_SETTINGS Settings
Definition: wdfdevice.h:2595
BOOL WINAPI wglDeleteContext(HGLRC hglrc)
Definition: wgl.c:514
HGLRC WINAPI wglCreateContext(HDC hdc)
Definition: wgl.c:383
BOOL WINAPI wglMakeCurrent(HDC hdc, HGLRC hglrc)
Definition: wgl.c:650
HBITMAP WINAPI CreateDIBSection(HDC hDC, CONST BITMAPINFO *BitmapInfo, UINT Usage, VOID **Bits, HANDLE hSection, DWORD dwOffset)
Definition: bitmap.c:245
#define ZeroMemory
Definition: winbase.h:1712
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG _In_ LONG x2
Definition: winddi.h:3710
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG y1
Definition: winddi.h:3709
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG x1
Definition: winddi.h:3708
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG _In_ LONG _In_ LONG y2
Definition: winddi.h:3711
LONG_PTR LPARAM
Definition: windef.h:208
LONG_PTR LRESULT
Definition: windef.h:209
UINT_PTR WPARAM
Definition: windef.h:207
#define WINAPI
Definition: msvc.h:6
#define DIB_RGB_COLORS
Definition: wingdi.h:367
int WINAPI ChoosePixelFormat(_In_ HDC hdc, _In_ const PIXELFORMATDESCRIPTOR *ppfd)
HGDIOBJ WINAPI GetStockObject(_In_ int)
BOOL WINAPI SetPixelFormat(_In_ HDC, _In_ int, _In_ const PIXELFORMATDESCRIPTOR *)
#define PFD_SUPPORT_OPENGL
Definition: wingdi.h:306
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1546
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
struct tagPIXELFORMATDESCRIPTOR PIXELFORMATDESCRIPTOR
#define SRCCOPY
Definition: wingdi.h:333
#define WHITE_BRUSH
Definition: wingdi.h:902
BOOL WINAPI SwapBuffers(HDC)
Definition: wingl.c:187
#define PFD_DRAW_TO_WINDOW
Definition: wingdi.h:303
#define PFD_MAIN_PLANE
Definition: wingdi.h:298
#define PFD_TYPE_RGBA
Definition: wingdi.h:296
#define GetObject
Definition: wingdi.h:4468
BOOL WINAPI DeleteDC(_In_ HDC)
#define PFD_DOUBLEBUFFER
Definition: wingdi.h:301
#define WM_PAINT
Definition: winuser.h:1623
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
#define CS_VREDRAW
Definition: winuser.h:658
#define IMAGE_BITMAP
Definition: winuser.h:211
BOOL WINAPI TranslateMessage(_In_ const MSG *)
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
#define WM_CREATE
Definition: winuser.h:1611
__analysis_noreturn void WINAPI PostQuitMessage(_In_ int)
#define WM_SIZE
Definition: winuser.h:1614
#define LR_CREATEDIBSECTION
Definition: winuser.h:1101
BOOL WINAPI ValidateRect(_In_opt_ HWND, _In_opt_ LPCRECT)
#define CS_HREDRAW
Definition: winuser.h:653
#define IDC_ARROW
Definition: winuser.h:687
#define CreateDialog
Definition: winuser.h:5761
#define GWLP_HINSTANCE
Definition: winuser.h:859
UINT_PTR WINAPI SetTimer(_In_opt_ HWND, _In_ UINT_PTR, _In_ UINT, _In_opt_ TIMERPROC)
#define IDI_APPLICATION
Definition: winuser.h:704
#define CreateWindow
Definition: winuser.h:5766
#define MB_ICONERROR
Definition: winuser.h:790
#define GetMessage
Definition: winuser.h:5802
#define WM_TIMER
Definition: winuser.h:1745
#define LoadIcon
Definition: winuser.h:5825
BOOL WINAPI UpdateWindow(_In_ HWND)
#define LoadCursor
Definition: winuser.h:5824
HDC WINAPI GetDC(_In_opt_ HWND)
#define MB_OK
Definition: winuser.h:793
#define CW_USEDEFAULT
Definition: winuser.h:225
#define LoadImage
Definition: winuser.h:5827
#define MessageBox
Definition: winuser.h:5834
#define SW_SHOW
Definition: winuser.h:778
#define RegisterClass
Definition: winuser.h:5848
#define WM_DESTROY
Definition: winuser.h:1612
#define LR_DEFAULTSIZE
Definition: winuser.h:1097
#define DispatchMessage
Definition: winuser.h:5777
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
BOOL WINAPI KillTimer(_In_opt_ HWND, _In_ UINT_PTR)
#define MAKEINTRESOURCE
Definition: winuser.h:591
char TCHAR
Definition: xmlstorage.h:189
char * LPSTR
Definition: xmlstorage.h:182
const CHAR * LPCTSTR
Definition: xmlstorage.h:193