GLVert.cpp 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  1. /*
  2. * Copyright (c) 2021, Jesse Buhagiar <jooster669@gmail.com>
  3. * Copyright (c) 2021, Stephan Unverwerth <s.unverwerth@serenityos.org>
  4. *
  5. * SPDX-License-Identifier: BSD-2-Clause
  6. */
  7. #include "GL/gl.h"
  8. #include "GLContext.h"
  9. extern GL::GLContext* g_gl_context;
  10. void glBegin(GLenum mode)
  11. {
  12. g_gl_context->gl_begin(mode);
  13. }
  14. void glEnd()
  15. {
  16. g_gl_context->gl_end();
  17. }
  18. void glVertex2d(GLdouble x, GLdouble y)
  19. {
  20. g_gl_context->gl_vertex(x, y, 0.0, 1.0);
  21. }
  22. void glVertex2dv(const GLdouble* v)
  23. {
  24. g_gl_context->gl_vertex(v[0], v[1], 0.0, 1.0);
  25. }
  26. void glVertex2f(GLfloat x, GLfloat y)
  27. {
  28. g_gl_context->gl_vertex(x, y, 0.0, 1.0);
  29. }
  30. void glVertex2fv(const GLfloat* v)
  31. {
  32. g_gl_context->gl_vertex(v[0], v[1], 0.0, 1.0);
  33. }
  34. void glVertex2i(GLint x, GLint y)
  35. {
  36. g_gl_context->gl_vertex(x, y, 0.0, 1.0);
  37. }
  38. void glVertex2iv(const GLint* v)
  39. {
  40. g_gl_context->gl_vertex(v[0], v[1], 0.0, 1.0);
  41. }
  42. void glVertex2s(GLshort x, GLshort y)
  43. {
  44. g_gl_context->gl_vertex(x, y, 0.0, 1.0);
  45. }
  46. void glVertex2sv(const GLshort* v)
  47. {
  48. g_gl_context->gl_vertex(v[0], v[1], 0.0, 1.0);
  49. }
  50. void glVertex3d(GLdouble x, GLdouble y, GLdouble z)
  51. {
  52. g_gl_context->gl_vertex(x, y, z, 1.0);
  53. }
  54. void glVertex3dv(const GLdouble* v)
  55. {
  56. g_gl_context->gl_vertex(v[0], v[1], v[2], 1.0);
  57. }
  58. void glVertex3f(GLfloat x, GLfloat y, GLfloat z)
  59. {
  60. g_gl_context->gl_vertex(x, y, z, 1.0);
  61. }
  62. void glVertex3fv(const GLfloat* v)
  63. {
  64. g_gl_context->gl_vertex(v[0], v[1], v[2], 1.0);
  65. }
  66. void glVertex3i(GLint x, GLint y, GLint z)
  67. {
  68. g_gl_context->gl_vertex(x, y, z, 1.0);
  69. }
  70. void glVertex3iv(const GLint* v)
  71. {
  72. g_gl_context->gl_vertex(v[0], v[1], v[2], 1.0);
  73. }
  74. void glVertex3s(GLshort x, GLshort y, GLshort z)
  75. {
  76. g_gl_context->gl_vertex(x, y, z, 1.0);
  77. }
  78. void glVertex3sv(const GLshort* v)
  79. {
  80. g_gl_context->gl_vertex(v[0], v[1], v[2], 1.0);
  81. }
  82. void glVertex4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w)
  83. {
  84. g_gl_context->gl_vertex(x, y, z, w);
  85. }
  86. void glVertex4dv(const GLdouble* v)
  87. {
  88. g_gl_context->gl_vertex(v[0], v[1], v[2], v[3]);
  89. }
  90. void glVertex4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
  91. {
  92. g_gl_context->gl_vertex(x, y, z, w);
  93. }
  94. void glVertex4fv(const GLfloat* v)
  95. {
  96. g_gl_context->gl_vertex(v[0], v[1], v[2], v[3]);
  97. }
  98. void glVertex4i(GLint x, GLint y, GLint z, GLint w)
  99. {
  100. g_gl_context->gl_vertex(x, y, z, w);
  101. }
  102. void glVertex4iv(const GLint* v)
  103. {
  104. g_gl_context->gl_vertex(v[0], v[1], v[2], v[3]);
  105. }
  106. void glVertex4s(GLshort x, GLshort y, GLshort z, GLshort w)
  107. {
  108. g_gl_context->gl_vertex(x, y, z, w);
  109. }
  110. void glVertex4sv(const GLshort* v)
  111. {
  112. g_gl_context->gl_vertex(v[0], v[1], v[2], v[3]);
  113. }
  114. void glTexCoord1f(GLfloat s)
  115. {
  116. g_gl_context->gl_tex_coord(s, 0.0f, 0.0f, 1.0f);
  117. }
  118. void glTexCoord1fv(GLfloat const* v)
  119. {
  120. g_gl_context->gl_tex_coord(v[0], 0.0f, 0.0f, 1.0f);
  121. }
  122. void glTexCoord2d(GLdouble s, GLdouble t)
  123. {
  124. g_gl_context->gl_tex_coord(s, t, 0.0f, 1.0f);
  125. }
  126. void glTexCoord2dv(GLdouble const* v)
  127. {
  128. g_gl_context->gl_tex_coord(v[0], v[1], 0.0f, 1.0f);
  129. }
  130. void glTexCoord2f(GLfloat s, GLfloat t)
  131. {
  132. g_gl_context->gl_tex_coord(s, t, 0.0f, 1.0f);
  133. }
  134. void glTexCoord2fv(GLfloat const* v)
  135. {
  136. g_gl_context->gl_tex_coord(v[0], v[1], 0.0f, 1.0f);
  137. }
  138. void glTexCoord2i(GLint s, GLint t)
  139. {
  140. g_gl_context->gl_tex_coord(s, t, 0.0f, 1.0f);
  141. }
  142. void glTexCoord3f(GLfloat s, GLfloat t, GLfloat r)
  143. {
  144. g_gl_context->gl_tex_coord(s, t, r, 1.0f);
  145. }
  146. void glTexCoord3fv(GLfloat const* v)
  147. {
  148. g_gl_context->gl_tex_coord(v[0], v[1], v[2], 1.0f);
  149. }
  150. void glTexCoord4f(GLfloat s, GLfloat t, GLfloat r, GLfloat q)
  151. {
  152. g_gl_context->gl_tex_coord(s, t, r, q);
  153. }
  154. void glTexCoord4fv(const GLfloat* v)
  155. {
  156. g_gl_context->gl_tex_coord(v[0], v[1], v[2], v[3]);
  157. }
  158. void glMultiTexCoord2fARB(GLenum target, GLfloat s, GLfloat t)
  159. {
  160. glMultiTexCoord2f(target, s, t);
  161. }
  162. void glMultiTexCoord2f(GLenum target, GLfloat s, GLfloat t)
  163. {
  164. g_gl_context->gl_multi_tex_coord(target, s, t, 0.0f, 1.0f);
  165. }
  166. void glNormal3f(GLfloat nx, GLfloat ny, GLfloat nz)
  167. {
  168. g_gl_context->gl_normal(nx, ny, nz);
  169. }
  170. void glNormal3fv(GLfloat const* v)
  171. {
  172. g_gl_context->gl_normal(v[0], v[1], v[2]);
  173. }
  174. void glNormalPointer(GLenum type, GLsizei stride, void const* pointer)
  175. {
  176. g_gl_context->gl_normal_pointer(type, stride, pointer);
  177. }
  178. void glRectf(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2)
  179. {
  180. g_gl_context->gl_rect(x1, y1, x2, y2);
  181. }
  182. void glRecti(GLint x1, GLint y1, GLint x2, GLint y2)
  183. {
  184. g_gl_context->gl_rect(x1, y1, x2, y2);
  185. }