/platform/win/scaffold/opengl.d

http://github.com/wilkie/djehuty · D · 72 lines · 48 code · 10 blank · 14 comment · 0 complexity · 0268a80ad95ecf0aca65394a3934425f MD5 · raw file

  1. /*
  2. * opengl.d
  3. *
  4. * This file implements the Scaffold for platform specific OpenGL
  5. * operations in Windows.
  6. *
  7. * Author: Dave Wilkinson
  8. *
  9. */
  10. module scaffold.opengl;
  11. import binding.opengl.gl;
  12. import opengl.window;
  13. import binding.win32.wingdi;
  14. import binding.win32.windef;
  15. // some extra GDI imports
  16. /* pixel types */
  17. const auto PFD_TYPE_RGBA = 0;
  18. const auto PFD_TYPE_COLORINDEX = 1;
  19. /* layer types */
  20. const auto PFD_MAIN_PLANE = 0;
  21. const auto PFD_OVERLAY_PLANE = 1;
  22. const auto PFD_UNDERLAY_PLANE = (-1);
  23. /* PIXELFORMATDESCRIPTOR flags */
  24. const auto PFD_DOUBLEBUFFER = 0x00000001;
  25. const auto PFD_STEREO = 0x00000002;
  26. const auto PFD_DRAW_TO_WINDOW = 0x00000004;
  27. const auto PFD_DRAW_TO_BITMAP = 0x00000008;
  28. const auto PFD_SUPPORT_GDI = 0x00000010;
  29. const auto PFD_SUPPORT_OPENGL = 0x00000020;
  30. const auto PFD_GENERIC_FORMAT = 0x00000040;
  31. const auto PFD_NEED_PALETTE = 0x00000080;
  32. const auto PFD_NEED_SYSTEM_PALETTE = 0x00000100;
  33. const auto PFD_SWAP_EXCHANGE = 0x00000200;
  34. const auto PFD_SWAP_COPY = 0x00000400;
  35. const auto PFD_SWAP_LAYER_BUFFERS = 0x00000800;
  36. const auto PFD_GENERIC_ACCELERATED = 0x00001000;
  37. const auto PFD_SUPPORT_DIRECTDRAW = 0x00002000;
  38. /* PIXELFORMATDESCRIPTOR flags for use in ChoosePixelFormat only */
  39. const auto PFD_DEPTH_DONTCARE = 0x20000000;
  40. const auto PFD_DOUBLEBUFFER_DONTCARE = 0x40000000;
  41. const auto PFD_STEREO_DONTCARE = 0x80000000;
  42. PIXELFORMATDESCRIPTOR pfd = // pfd Tells Windows How We Want Things To Be
  43. {
  44. PIXELFORMATDESCRIPTOR.sizeof, // Size Of This Pixel Format Descriptor
  45. 1, // Version Number
  46. PFD_DRAW_TO_WINDOW | // Format Must Support Window
  47. PFD_SUPPORT_OPENGL | // Format Must Support OpenGL
  48. PFD_DOUBLEBUFFER, // Must Support Double Buffering
  49. PFD_TYPE_RGBA, // Request An RGBA Format
  50. 32, // Select Our Color Depth
  51. 0, 0, 0, 0, 0, 0, // Color Bits Ignored
  52. 0, // No Alpha Buffer
  53. 0, // Shift Bit Ignored
  54. 0, // No Accumulation Buffer
  55. 0, 0, 0, 0, // Accumulation Bits Ignored
  56. 16, // 16Bit Z-Buffer (Depth Buffer)
  57. 0, // No Stencil Buffer
  58. 0, // No Auxiliary Buffer
  59. PFD_MAIN_PLANE, // Main Drawing Layer
  60. 0, // Reserved
  61. 0, 0, 0 // Layer Masks Ignored
  62. };