ReactOS  0.4.13-dev-455-g28ed234
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 
48 typedef struct {
49  float x1;
50  float y1;
51  float x2;
52  float y2;
53  float z;
54 } VERTEX;
55 
57 static HGLRC hRC; // Permanent Rendering Context
58 static HDC hDC; // Private GDI Device Context
59 static float fAngle;
61 
62 // Light position
64  0.0f, 0.0f, 3.0f, 1.0f
65 };
66 
67 static 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,
110  IMAGE_BITMAP,
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 
176 static 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
206  glEnable( GL_LIGHT0 );
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
268  glEnable( GL_BLEND );
269 }
270 
271 static void
272 render(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 
292  case ROTATION_PERIODIC:
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 
334 static 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
354  PostQuitMessage(0);
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
364  PostQuitMessage(0);
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
377  PostQuitMessage(0);
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
387  PostQuitMessage(0);
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 
409 static 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
425  ReleaseDC(hWnd, hDC);
426 
427 #ifdef _DEBUG_SSTARS
428  PostQuitMessage(0);
429 #endif
430 
431  return 0L;
432 }
433 
434 static 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();
450  glLoadIdentity();
451 
453  glPushMatrix();
454  glLoadIdentity();
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
490  SwapBuffers(hDC);
491 
492  // Clear redraw event
494 
495  return 0L;
496 }
497 
498 static LRESULT CALLBACK
500 {
501  GLsizei w = LOWORD(lParam);
502  GLsizei h = HIWORD(lParam);
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
511  glLoadIdentity();
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
520  glLoadIdentity();
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 
567  wc.style = CS_HREDRAW | CS_VREDRAW;
569  wc.cbClsExtra = 0;
570  wc.cbWndExtra = 0;
571  wc.hInstance = hInstance;
575  wc.lpszMenuName = NULL;
577 
578  return RegisterClass(&wc);
579 }
580 
581 HWND InitInstance(HINSTANCE hInstance, int nCmdShow)
582 {
583  HWND hWnd;
584  TCHAR szClass[] = _T("CLASS");
585  TCHAR szTitle[] = _T("TITLE");
586 
587  InitApp(hInstance, szClass);
588 
589  hWnd = CreateWindow(
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 
611 int 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
#define GL_CONSTANT_ATTENUATION
Definition: gl.h:321
HGDIOBJ WINAPI GetStockObject(_In_ int)
double GLdouble
Definition: gl.h:163
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG y1
Definition: winddi.h:3706
#define GL_FASTEST
Definition: gl.h:584
#define GL_COLOR_BUFFER_BIT
Definition: gl.h:716
GLAPI void GLAPIENTRY glClear(GLbitfield mask)
static HGLRC(WINAPI *pwglCreateContextAttribsARB)(HDC hDC
#define MAKEINTRESOURCE
Definition: winuser.h:591
static VERTEX Vertex[MAX_STARS]
Definition: ssstars.c:56
#define gluBuild2DMipmaps
Definition: glu_mangle.h:35
#define DispatchMessage
Definition: winuser.h:5631
#define GL_FLAT
Definition: gl.h:338
BOOL WINAPI TranslateMessage(_In_ const MSG *)
const CHAR * LPCTSTR
Definition: xmlstorage.h:193
#define GL_ONE
Definition: gl.h:375
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
BOOL WINAPI wglDeleteContext(HGLRC hglrc)
Definition: wgl.c:514
#define GL_QUADS
Definition: gl.h:197
BITMAPINFOHEADER bmiHeader
Definition: wingdi.h:1454
#define CreateWindow
Definition: winuser.h:5620
#define GL_BLEND
Definition: gl.h:371
float x2
Definition: ssstars.c:51
GLAPI void GLAPIENTRY glMatrixMode(GLenum mode)
#define PFD_MAIN_PLANE
Definition: wingdi.h:297
HDC WINAPI GetDC(_In_opt_ HWND)
GLAPI void GLAPIENTRY glVertex3f(GLfloat x, GLfloat y, GLfloat z)
WORD ATOM
Definition: dimm.idl:113
GLAPI void GLAPIENTRY glBindTexture(GLenum target, GLuint texture)
GLAPI void GLAPIENTRY glPolygonMode(GLenum face, GLenum mode)
struct tagBITMAPINFOHEADER BITMAPINFOHEADER
static HDC hDC
Definition: ssstars.c:58
#define GL_NEAREST
Definition: gl.h:678
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1827
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG x1
Definition: winddi.h:3706
BOOL CALLBACK ScreenSaverConfigureDialog(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: 3dtext.c:381
#define GL_UNSIGNED_BYTE
Definition: gl.h:178
static HDC
Definition: imagelist.c:92
GLAPI void GLAPIENTRY glColorMaterial(GLenum face, GLenum mode)
#define CALLBACK
Definition: compat.h:27
GLAPI void GLAPIENTRY glRotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z)
BOOL WINAPI UpdateWindow(_In_ HWND)
HWND hWnd
Definition: settings.c:17
void __cdecl srand(_In_ unsigned int _Seed)
static LRESULT CALLBACK OnPaint(HWND hWnd, WPARAM wParam, LPARAM lParam)
Definition: ssstars.c:435
static GLuint glStarTex
Definition: ssstars.c:60
static LRESULT CALLBACK OnSize(HWND hWnd, WPARAM wParam, LPARAM lParam)
Definition: ssstars.c:499
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
int cbClsExtra
Definition: winuser.h:3118
#define ZeroMemory
Definition: winbase.h:1635
#define CS_HREDRAW
Definition: winuser.h:648
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
LPCSTR lpszMenuName
Definition: winuser.h:3124
#define WHITE_BRUSH
Definition: wingdi.h:901
#define NEAR_PLANE
Definition: ssstars.c:37
#define VERTEX(n)
Definition: gradient.c:18
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
#define IDI_APPLICATION
Definition: winuser.h:699
UINT_PTR WPARAM
Definition: windef.h:207
HBRUSH hbrBackground
Definition: winuser.h:3123
#define GL_PERSPECTIVE_CORRECTION_HINT
Definition: gl.h:578
__u16 time
Definition: mkdosfs.c:366
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
GLAPI void GLAPIENTRY glGenTextures(GLsizei n, GLuint *textures)
GLAPI void GLAPIENTRY glColor4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
char * LPSTR
Definition: xmlstorage.h:182
#define GL_SMOOTH
Definition: gl.h:339
static VOID NTAPI BitBlt(IN ULONG Left, IN ULONG Top, IN ULONG Width, IN ULONG Height, IN PUCHAR Buffer, IN ULONG BitsPerPixel, IN ULONG Delta)
Definition: vga.c:416
WPARAM wParam
Definition: combotst.c:138
BOOL WINAPI SetPixelFormat(_In_ HDC, _In_ int, _In_ const PIXELFORMATDESCRIPTOR *)
GLAPI void GLAPIENTRY glClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
struct Color Color
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
static float fAngle
Definition: ssstars.c:59
static HWND InitInstance(HINSTANCE hInst)
Definition: charmap.c:517
GLAPI void GLAPIENTRY glTexParameteri(GLenum target, GLenum pname, GLint param)
#define PFD_DOUBLEBUFFER
Definition: wingdi.h:300
#define GL_FRONT_AND_BACK
Definition: gl.h:336
#define ROTATION_LINEAR
Definition: settings.h:25
int cbWndExtra
Definition: winuser.h:3119
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
HINSTANCE hInstance
Definition: charmap.c:20
#define gluPerspective
Definition: glu_mangle.h:28
void LoadSettings(void)
Definition: settings.c:53
unsigned char * LPBYTE
Definition: typedefs.h:52
#define GL_LIGHT0
Definition: gl.h:311
_Check_return_ int __cdecl rand(void)
Definition: rand.c:10
int GLsizei
Definition: gl.h:160
#define GL_FRONT
Definition: gl.h:270
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
DWORD biCompression
Definition: amvideo.idl:35
HCURSOR hCursor
Definition: winuser.h:3122
#define CW_USEDEFAULT
Definition: winuser.h:225
BOOL WINAPI RegisterDialogClasses(HANDLE hInst)
Definition: 3dtext.c:416
#define IDB_STAR
Definition: resource.h:12
GLdouble GLdouble z
Definition: glext.h:5874
_STLP_DECLSPEC complex< float > _STLP_CALL cos(const complex< float > &)
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
#define STAR_TAIL
Definition: ssstars.c:46
static HGLRC hRC
Definition: ssstars.c:57
GLAPI void GLAPIENTRY glBlendFunc(GLenum sfactor, GLenum dfactor)
#define DLG_SCRNSAVECONFIGURE
Definition: scrnsave.h:30
#define _TEXT(x)
Definition: tchar.h:1543
#define SW_SHOW
Definition: winuser.h:769
GLAPI void GLAPIENTRY glShadeModel(GLenum mode)
UINT_PTR WINAPI SetTimer(_In_opt_ HWND, _In_ UINT_PTR, _In_ UINT, _In_opt_ TIMERPROC)
#define DefWindowProc
Definition: ros2win.h:31
#define WM_DESTROY
Definition: winuser.h:1591
#define GL_TEXTURE_MIN_FILTER
Definition: gl.h:649
BOOL WINAPI SwapBuffers(HDC)
Definition: wingl.c:187
#define CS_VREDRAW
Definition: winuser.h:653
char TCHAR
Definition: xmlstorage.h:189
GLAPI void GLAPIENTRY glDisable(GLenum cap)
GLfloat f
Definition: glext.h:7540
#define _T(x)
Definition: vfdio.h:22
static const WCHAR szClassName[]
Definition: clipbrd.c:11
#define STAR_GREEN
Definition: ssstars.c:44
#define LR_DEFAULTSIZE
Definition: winuser.h:1084
#define WM_SIZE
Definition: winuser.h:1593
GLAPI void GLAPIENTRY glColor3ub(GLubyte red, GLubyte green, GLubyte blue)
#define WM_TIMER
Definition: winuser.h:1718
#define GL_AMBIENT_AND_DIFFUSE
Definition: gl.h:331
static void render(void)
Definition: ssstars.c:272
#define WINAPI
Definition: msvc.h:8
BOOL WINAPI ValidateRect(_In_opt_ HWND, _In_opt_ LPCRECT)
int WINAPI ChoosePixelFormat(_In_ HDC hdc, _In_ const PIXELFORMATDESCRIPTOR *ppfd)
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
GLAPI void GLAPIENTRY glLightf(GLenum light, GLenum pname, GLfloat param)
unsigned long DWORD
Definition: ntddk_ex.h:95
#define GL_COLOR_MATERIAL
Definition: gl.h:340
#define GL_LIGHTING
Definition: gl.h:310
#define GL_LINEAR
Definition: gl.h:421
#define GetObject
Definition: wingdi.h:4446
SETTINGS Settings
Definition: charmap.c:26
TCHAR szTitle[MAX_LOADSTRING]
Definition: magnifier.c:35
#define WM_PAINT
Definition: winuser.h:1602
GLAPI void GLAPIENTRY glHint(GLenum target, GLenum mode)
#define PFD_TYPE_RGBA
Definition: wingdi.h:295
HANDLE HINSTANCE
Definition: typedefs.h:75
static PIXELFORMATDESCRIPTOR pfd
Definition: ssstars.c:67
float z
Definition: vmr9.c:2546
#define STAR_RED
Definition: ssstars.c:43
BOOL WINAPI KillTimer(_In_opt_ HWND, _In_ UINT_PTR)
GLAPI void GLAPIENTRY glBegin(GLenum mode)
INT PixelFormat
static const WCHAR L[]
Definition: oid.c:1250
#define GL_PROJECTION
Definition: gl.h:246
#define MB_ICONERROR
Definition: winuser.h:781
#define GL_NICEST
Definition: gl.h:585
GLAPI void GLAPIENTRY glEnable(GLenum cap)
#define MAX_STARS
Definition: settings.h:30
#define MessageBox
Definition: winuser.h:5688
GLAPI void GLAPIENTRY glLightfv(GLenum light, GLenum pname, const GLfloat *params)
LPCSTR lpszClassName
Definition: winuser.h:3125
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG _In_ LONG _In_ LONG y2
Definition: winddi.h:3706
#define FAR_PLANE
Definition: ssstars.c:36
#define RAND_MAX
Definition: stdlib.h:99
BOOL WINAPI wglMakeCurrent(HDC hdc, HGLRC hglrc)
Definition: wgl.c:650
float y1
Definition: ssstars.c:50
static LRESULT CALLBACK OnCreate(HWND hWnd, WPARAM wParam, LPARAM lParam)
Definition: ssstars.c:335
#define LoadCursor
Definition: winuser.h:5678
float y2
Definition: ssstars.c:52
GLAPI void GLAPIENTRY glLightModeli(GLenum pname, GLint param)
GLAPI void GLAPIENTRY glPushMatrix(void)
UINT style
Definition: winuser.h:3116
#define GL_FILL
Definition: gl.h:267
#define GL_QUADRATIC_ATTENUATION
Definition: gl.h:323
Definition: vmr9.c:2546
unsigned int GLuint
Definition: gl.h:159
#define GL_DEPTH_TEST
Definition: gl.h:301
#define GL_TEXTURE_MAG_FILTER
Definition: gl.h:648
BOOL WINAPI DeleteDC(_In_ HDC)
HINSTANCE hInstance
Definition: winuser.h:3120
#define FIELD_HEIGHT
Definition: ssstars.c:40
GLAPI void GLAPIENTRY glViewport(GLint x, GLint y, GLsizei width, GLsizei height)
HBITMAP WINAPI CreateDIBSection(HDC hDC, CONST BITMAPINFO *BitmapInfo, UINT Usage, VOID **Bits, HANDLE hSection, DWORD dwOffset)
Definition: bitmap.c:197
GLAPI void GLAPIENTRY glFlush(void)
static LRESULT CALLBACK OnDestroy(HWND hWnd, WPARAM wParam, LPARAM lParam)
Definition: ssstars.c:410
Definition: bl.h:1331
GLAPI void GLAPIENTRY glPopMatrix(void)
#define GL_TRUE
Definition: gl.h:174
#define LR_CREATEDIBSECTION
Definition: winuser.h:1088
#define GAP
Definition: ssstars.c:38
GLAPI void GLAPIENTRY glLoadIdentity(void)
LRESULT CALLBACK ScreenSaverProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: ssstars.c:532
#define GL_MODELVIEW
Definition: gl.h:245
unsigned int UINT
Definition: ndis.h:50
GLAPI void GLAPIENTRY glTexCoord2f(GLfloat s, GLfloat t)
#define MB_OK
Definition: winuser.h:784
#define IMAGE_BITMAP
Definition: winuser.h:211
#define GetMessage
Definition: winuser.h:5656
#define GL_TEXTURE_2D
Definition: gl.h:645
#define ROTATION_PERIODIC
Definition: settings.h:26
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG _In_ LONG x2
Definition: winddi.h:3706
WNDPROC lpfnWndProc
Definition: winuser.h:3117
static GLfloat g_light_position[4]
Definition: ssstars.c:63
float GLfloat
Definition: gl.h:161
#define msg(x)
Definition: auth_time.c:54
#define IDC_ARROW
Definition: winuser.h:682
#define GWLP_HINSTANCE
Definition: winuser.h:850
GLAPI void GLAPIENTRY glTexImage2D(GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels)
#define FIELD_DEPTH
Definition: ssstars.c:41
#define WM_CREATE
Definition: winuser.h:1590
#define WS_OVERLAPPEDWINDOW
Definition: pedump.c:637
#define GL_ONE_MINUS_SRC_ALPHA
Definition: gl.h:379
#define STAR_BLUE
Definition: ssstars.c:45
struct tagPIXELFORMATDESCRIPTOR PIXELFORMATDESCRIPTOR
#define HIWORD(l)
Definition: typedefs.h:246
LRESULT WINAPI DefScreenSaverProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: scrnsave.c:95
#define GL_POSITION
Definition: gl.h:329
GLAPI void GLAPIENTRY glEnd(void)
#define GL_LINEAR_ATTENUATION
Definition: gl.h:322
#define GL_SRC_ALPHA
Definition: gl.h:378
int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR cmdline, int cmdshow)
Definition: main.c:8
#define LoadImage
Definition: winuser.h:5681
#define GL_RGBA
Definition: gl.h:503
static HBITMAP
Definition: button.c:44
#define RegisterClass
Definition: winuser.h:5702
#define LoadIcon
Definition: winuser.h:5679
#define PFD_SUPPORT_OPENGL
Definition: wingdi.h:305
#define GetWindowLongPtr
Definition: treelist.c:73
float x1
Definition: ssstars.c:49
LONG_PTR LRESULT
Definition: windef.h:209
#define DIB_RGB_COLORS
Definition: wingdi.h:366
#define PFD_DRAW_TO_WINDOW
Definition: wingdi.h:302
#define gluLookAt
Definition: glu_mangle.h:26
#define BI_RGB
Definition: precomp.h:35
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
__analysis_noreturn void WINAPI PostQuitMessage(_In_ int)
static HBITMAP CreateStarBitmap(HWND hWnd, HDC hDC)
Definition: ssstars.c:89
#define SRCCOPY
Definition: wingdi.h:332
HGLRC WINAPI wglCreateContext(HDC hdc)
Definition: wgl.c:383
#define CreateDialog
Definition: winuser.h:5615
#define FIELD_WIDTH
Definition: ssstars.c:39
static void InitGL(HBITMAP hStarTex)
Definition: ssstars.c:176
HICON hIcon
Definition: winuser.h:3121