igl.h 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261
  1. /*
  2. ===========================================================================
  3. Copyright (C) 1999-2005 Id Software, Inc.
  4. This file is part of Quake III Arena source code.
  5. Quake III Arena source code is free software; you can redistribute it
  6. and/or modify it under the terms of the GNU General Public License as
  7. published by the Free Software Foundation; either version 2 of the License,
  8. or (at your option) any later version.
  9. Quake III Arena source code is distributed in the hope that it will be
  10. useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with Foobar; if not, write to the Free Software
  15. Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  16. ===========================================================================
  17. */
  18. //-----------------------------------------------------------------------------
  19. //
  20. // $LogFile$
  21. // $Revision: 1.7.2.3 $
  22. // $Author: ttimo $
  23. // $Date: 2000/02/16 15:43:14 $
  24. // $Log: igl.h,v $
  25. // Revision 1.7.2.3 2000/02/16 15:43:14 ttimo
  26. // Curry bug #101996: added glTexParameterf and glNormal3f
  27. //
  28. // Revision 1.7.2.2 2000/02/13 17:48:07 ttimo
  29. // Curry bug #101874 - added glTexGenf to GL interface
  30. //
  31. // Revision 1.7.2.1 2000/02/04 22:59:34 ttimo
  32. // messaging API preview
  33. //
  34. // Revision 1.7 2000/01/18 00:43:59 ttimo
  35. // RC
  36. //
  37. // Revision 1.6 2000/01/13 00:46:41 ttimo
  38. // Merged in patches in / out
  39. // Revision 1.1.1.4 2000/01/18 00:17:12 ttimo
  40. // merging in for RC
  41. //
  42. // Revision 1.5 2000/01/11 22:14:48 ttimo
  43. // cleaning up after merging and thinks badly fucked up
  44. //
  45. // Revision 1.2 2000/01/09 04:39:14 ttimo
  46. // added some bindings to the GL table
  47. //
  48. // Revision 1.1.1.3 2000/01/11 16:43:15 ttimo
  49. // merged version from old reposit and Robert update
  50. //
  51. // Revision 1.1.1.1 2000/01/07 17:17:30 ttimo
  52. // initial import of Q3Radiant module
  53. //
  54. // Revision 1.1.1.1 2000/01/07 17:17:30 ttimo
  55. // initial import of Q3Radiant module
  56. //
  57. // Revision 1.3 2000/01/17 23:53:44 TBesset
  58. // ready for merge in sourceforge (RC candidate)
  59. //
  60. // Revision 1.2 2000/01/07 16:40:13 TBesset
  61. // merged from BSP frontend
  62. //
  63. // Revision 1.1.1.3 1999/12/29 18:31:27 TBesset
  64. // Q3Radiant public version
  65. //
  66. // Revision 1.1.1.1.2.1 1999/12/29 21:39:45 TBesset
  67. // updated to update3 from Robert
  68. //
  69. // Revision 1.1.1.3 1999/12/29 18:31:27 TBesset
  70. // Q3Radiant public version
  71. // Revision 1.1.1.3 1999/12/29 18:31:27 TBesset
  72. // Q3Radiant public version
  73. //
  74. // Revision 1.2 1999/11/22 17:46:48 Timo & Christine
  75. // merged EARadiant into the main tree
  76. // bug fixes for Q3Plugin / EAPlugin
  77. // export for Robert
  78. //
  79. // Revision 1.1.2.2 1999/11/03 20:38:04 Timo & Christine
  80. // MEAN plugin for Q3Radiant, alpha version
  81. //
  82. // Revision 1.1.2.1.2.1 1999/10/27 08:34:29 Timo & Christine
  83. // preview version of the texture tools plugin is ready
  84. // ( TexTool.dll plugin is in Q3Plugin module )
  85. // plugins can draw in their own window using Radiant's qgl bindings
  86. //
  87. // Revision 1.1.2.1 1999/10/08 16:28:14 Timo & Christine
  88. // started plugin extensions for EA features support in Q3Radiant
  89. // MEAN files plugin, and Surface Properties plugin
  90. //
  91. //
  92. // DESCRIPTION:
  93. // all purpose OpenGL interface for Q3Radiant plugins
  94. //
  95. #ifndef __IGL_H__
  96. #define __IGL_H__
  97. // we use this class to let plugins draw inside the Radiant windows
  98. class IGLWindow
  99. {
  100. public:
  101. // Increment the number of references to this object
  102. virtual void IncRef () = 0;
  103. // Decrement the reference count
  104. virtual void DecRef () = 0;
  105. virtual void Draw( VIEWTYPE vt ) = 0;
  106. };
  107. // define a GUID for this interface so plugins can access and reference it
  108. // {0F237620-854B-11d3-8EF3-A2DFBD53251B}
  109. static const GUID QERQglTable_GUID =
  110. { 0xf237620, 0x854b, 0x11d3, { 0x8e, 0xf3, 0xa2, 0xdf, 0xbd, 0x53, 0x25, 0x1b } };
  111. #include <gl/gl.h>
  112. #include <gl/glu.h>
  113. typedef void (APIENTRY* PFN_QGLALPHAFUNC) (GLenum func, GLclampf ref);
  114. typedef void (APIENTRY* PFN_QGLBEGIN) (GLenum);
  115. typedef void (APIENTRY* PFN_QGLBINDTEXTURE) (GLenum target, GLuint texture);
  116. typedef void (APIENTRY* PFN_QGLBLENDFUNC) (GLenum sfactor, GLenum dfactor);
  117. typedef void (APIENTRY* PFN_QGLCALLLIST) (GLuint list);
  118. typedef void (APIENTRY* PFN_QGLCALLLISTS) (GLsizei n, GLenum type, const GLvoid *lists);
  119. typedef void (APIENTRY* PFN_QGLCLEAR) (GLbitfield mask);
  120. typedef void (APIENTRY* PFN_QGLCLEARCOLOR) (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
  121. typedef void (APIENTRY* PFN_QGLCLEARDEPTH) (GLclampd depth);
  122. typedef void (APIENTRY* PFN_QGLCOLOR3F) (GLfloat red, GLfloat green, GLfloat blue);
  123. typedef void (APIENTRY* PFN_QGLCOLOR4F) (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
  124. typedef void (APIENTRY* PFN_QGLCULLFACE) (GLenum mode);
  125. typedef void (APIENTRY* PFN_QGLDELETELISTS) (GLuint list, GLsizei range);
  126. typedef void (APIENTRY* PFN_QGLDISABLE) (GLenum cap);
  127. typedef void (APIENTRY* PFN_QGLENABLE) (GLenum cap);
  128. typedef void (APIENTRY* PFN_QGLEND) ();
  129. typedef void (APIENTRY* PFN_QGLENDLIST) (void);
  130. typedef GLuint (APIENTRY* PFN_QGLGENLISTS) (GLsizei range);
  131. typedef void (APIENTRY* PFN_QGLLISTBASE) (GLuint base);
  132. typedef void (APIENTRY* PFN_QGLLOADIDENTITY) ();
  133. typedef void (APIENTRY* PFN_QGLMATRIXMODE) (GLenum mode);
  134. typedef void (APIENTRY* PFN_QGLNEWLIST) (GLuint list, GLenum mode);
  135. typedef void (APIENTRY* PFN_QGLNORMAL3F) (GLfloat nx, GLfloat ny, GLfloat nz);
  136. typedef void (APIENTRY* PFN_QGLORTHO) (GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);
  137. typedef void (APIENTRY* PFN_QGLPOINTSIZE) (GLfloat size);
  138. typedef void (APIENTRY* PFN_QGLPOLYGONMODE) (GLenum face, GLenum mode);
  139. typedef void (APIENTRY* PFN_QGLPOPMATRIX) ();
  140. typedef void (APIENTRY* PFN_QGLPUSHMATRIX) ();
  141. typedef void (APIENTRY* PFN_QGLROTATED) (GLdouble angle, GLdouble x, GLdouble y, GLdouble z);
  142. typedef void (APIENTRY* PFN_QGLROTATEF) (GLfloat angle, GLfloat x, GLfloat y, GLfloat z);
  143. typedef void (APIENTRY* PFN_QGLSCALEF) (GLfloat x, GLfloat y, GLfloat z);
  144. typedef void (APIENTRY* PFN_QGLTEXCOORD2F) (GLfloat s, GLfloat t);
  145. typedef void (APIENTRY* PFN_QGLTEXENVF) (GLenum target, GLenum pname, GLfloat param);
  146. typedef void (APIENTRY* PFN_QGLTEXGENF) (GLenum coord, GLenum pname, GLfloat param);
  147. typedef void (APIENTRY* PFN_QGLTEXPARAMETERF) (GLenum target, GLenum pname, GLfloat param);
  148. typedef void (APIENTRY* PFN_QGLTRANSLATED) (GLdouble x, GLdouble y, GLdouble z);
  149. typedef void (APIENTRY* PFN_QGLTRANSLATEF) (GLfloat x, GLfloat y, GLfloat z);
  150. typedef void (APIENTRY* PFN_QGLVERTEX2F) (GLfloat x, GLfloat y);
  151. typedef void (APIENTRY* PFN_QGLVERTEX3F) (GLfloat x, GLfloat y, GLfloat z);
  152. typedef void (APIENTRY* PFN_QGLVIEWPORT) (GLint x, GLint y, GLsizei width, GLsizei height);
  153. typedef void (WINAPI* PFN_QE_CHECKOPENGLFORERRORS) ();
  154. typedef int (WINAPI* PFN_QEW_SETUPPIXELFORMAT) (HDC hDC, qboolean zbuffer );
  155. typedef HGLRC (WINAPI* PFN_QWGL_CREATECONTEXT) (HDC);
  156. typedef BOOL (WINAPI* PFN_QWGL_DELETECONTEXT) (HGLRC);
  157. typedef BOOL (WINAPI* PFN_QWGL_MAKECURRENT) (HDC, HGLRC);
  158. typedef BOOL (WINAPI* PFN_QWGL_SHARELISTS) (HGLRC, HGLRC);
  159. typedef BOOL (WINAPI* PFN_QWGL_SWAPBUFFERS) (HDC);
  160. typedef BOOL (WINAPI* PFN_QWGL_USEFONTBITMAPS) (HDC, DWORD, DWORD, DWORD);
  161. // glu stuff
  162. typedef void (APIENTRY * PFN_QGLUPERSPECTIVE) (GLdouble fovy, GLdouble aspect, GLdouble zNear, GLdouble zFar);
  163. typedef void (APIENTRY * PFN_QGLULOOKAT)(
  164. GLdouble eyex,
  165. GLdouble eyey,
  166. GLdouble eyez,
  167. GLdouble centerx,
  168. GLdouble centery,
  169. GLdouble centerz,
  170. GLdouble upx,
  171. GLdouble upy,
  172. GLdouble upz);
  173. // specially provided by the editor for plugins
  174. typedef HGLRC (WINAPI* PFN_QERAPP_GETQEGLOBALSHGLRC) ();
  175. // plugins drawing inside the GL windows
  176. //++timo TODO: add hooking into other windows
  177. //+timo NOTE: this could be moved to the messaging system instead of having a dedicated interface
  178. typedef void (WINAPI* PFN_QERAPP_HOOKXYGLWINDOW) (IGLWindow *);
  179. typedef void (WINAPI* PFN_QERAPP_UNHOOKGLWINDOW) (IGLWindow *);
  180. struct _QERQglTable
  181. {
  182. //++timo do we really wanna play with versions ?
  183. // float m_fVersion;
  184. int m_nSize;
  185. PFN_QGLALPHAFUNC m_pfn_qglAlphaFunc;
  186. PFN_QGLBEGIN m_pfn_qglBegin;
  187. PFN_QGLBINDTEXTURE m_pfn_qglBindTexture;
  188. PFN_QGLBLENDFUNC m_pfn_qglBlendFunc;
  189. PFN_QGLCALLLIST m_pfn_qglCallList;
  190. PFN_QGLCLEAR m_pfn_qglClear;
  191. PFN_QGLCLEARCOLOR m_pfn_qglClearColor;
  192. PFN_QGLCALLLISTS m_pfn_qglCallLists;
  193. PFN_QGLCLEARDEPTH m_pfn_qglClearDepth;
  194. PFN_QGLCOLOR3F m_pfn_qglColor3f;
  195. PFN_QGLCOLOR4F m_pfn_qglColor4f;
  196. PFN_QGLCULLFACE m_pfn_qglCullFace;
  197. PFN_QGLDELETELISTS m_pfn_qglDeleteLists;
  198. PFN_QGLDISABLE m_pfn_qglDisable;
  199. PFN_QGLENABLE m_pfn_qglEnable;
  200. PFN_QGLEND m_pfn_qglEnd;
  201. PFN_QGLENDLIST m_pfn_qglEndList;
  202. PFN_QGLGENLISTS m_pfn_qglGenLists;
  203. PFN_QGLLISTBASE m_pfn_qglListBase;
  204. PFN_QGLLOADIDENTITY m_pfn_qglLoadIdentity;
  205. PFN_QGLMATRIXMODE m_pfn_qglMatrixMode;
  206. PFN_QGLNEWLIST m_pfn_qglNewList;
  207. PFN_QGLNORMAL3F m_pfn_qglNormal3f;
  208. PFN_QGLORTHO m_pfn_qglOrtho;
  209. PFN_QGLPOINTSIZE m_pfn_qglPointSize;
  210. PFN_QGLPOLYGONMODE m_pfn_qglPolygonMode;
  211. PFN_QGLPOPMATRIX m_pfn_qglPopMatrix;
  212. PFN_QGLPUSHMATRIX m_pfn_qglPushMatrix;
  213. PFN_QGLROTATED m_pfn_qglRotated;
  214. PFN_QGLROTATEF m_pfn_qglRotatef;
  215. PFN_QGLSCALEF m_pfn_qglScalef;
  216. PFN_QGLTEXCOORD2F m_pfn_qglTexCoord2f;
  217. PFN_QGLTEXENVF m_pfn_qglTexEnvf;
  218. PFN_QGLTEXGENF m_pfn_qglTexGenf;
  219. PFN_QGLTEXPARAMETERF m_pfn_qglTexParameterf;
  220. PFN_QGLTRANSLATED m_pfn_qglTranslated;
  221. PFN_QGLTRANSLATEF m_pfn_qglTranslatef;
  222. PFN_QGLVERTEX2F m_pfn_qglVertex2f;
  223. PFN_QGLVERTEX3F m_pfn_qglVertex3f;
  224. PFN_QGLVIEWPORT m_pfn_qglViewport;
  225. PFN_QE_CHECKOPENGLFORERRORS m_pfn_QE_CheckOpenGLForErrors;
  226. PFN_QEW_SETUPPIXELFORMAT m_pfn_QEW_SetupPixelFormat;
  227. PFN_QWGL_CREATECONTEXT m_pfn_qwglCreateContext;
  228. PFN_QWGL_DELETECONTEXT m_pfn_qwglDeleteContext;
  229. PFN_QWGL_MAKECURRENT m_pfn_qwglMakeCurrent;
  230. PFN_QWGL_SHARELISTS m_pfn_qwglShareLists;
  231. PFN_QWGL_SWAPBUFFERS m_pfn_qwglSwapBuffers;
  232. PFN_QWGL_USEFONTBITMAPS m_pfn_qwglUseFontBitmaps;
  233. PFN_QERAPP_GETQEGLOBALSHGLRC m_pfnGetQeglobalsHGLRC;
  234. // glu stuff
  235. PFN_QGLUPERSPECTIVE m_pfn_qgluPerspective;
  236. PFN_QGLULOOKAT m_pfn_qgluLookAt;
  237. // plugin entities drawing inside Radiant windows
  238. PFN_QERAPP_HOOKXYGLWINDOW m_pfnHookXYGLWindow;
  239. PFN_QERAPP_UNHOOKGLWINDOW m_pfnUnHookGLWindow;
  240. };
  241. #endif