reference-libobs-graphics-graphics.rst 43 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589
  1. Core Graphics API
  2. =================
  3. .. code:: cpp
  4. #include <graphics/graphics.h>
  5. Graphics Enumerations
  6. ---------------------
  7. .. enum:: gs_draw_mode
  8. Draw mode. Can be one of the following values:
  9. - GS_POINTS - Draws points
  10. - GS_LINES - Draws individual lines
  11. - GS_LINESTRIP - Draws a line strip
  12. - GS_TRIS - Draws individual triangles
  13. - GS_TRISTRIP - Draws a triangle strip
  14. .. enum:: gs_color_format
  15. Color format. Can be one of the following values:
  16. - GS_UNKNOWN - Unknown format
  17. - GS_A8 - 8 bit alpha channel only
  18. - GS_R8 - 8 bit red channel only
  19. - GS_RGBA - RGBA, 8 bits per channel
  20. - GS_BGRX - BGRX, 8 bits per channel
  21. - GS_BGRA - BGRA, 8 bits per channel
  22. - GS_R10G10B10A2 - RGBA, 10 bits per channel except alpha, which is 2
  23. bits
  24. - GS_RGBA16 - RGBA, 16 bits per channel
  25. - GS_R16 - 16 bit red channel only
  26. - GS_RGBA16F - RGBA, 16 bit floating point per channel
  27. - GS_RGBA32F - RGBA, 32 bit floating point per channel
  28. - GS_RG16F - 16 bit floating point red and green channels only
  29. - GS_RG32F - 32 bit floating point red and green channels only
  30. - GS_R16F - 16 bit floating point red channel only
  31. - GS_R32F - 32 bit floating point red channel only
  32. - GS_DXT1 - Compressed DXT1
  33. - GS_DXT3 - Compressed DXT3
  34. - GS_DXT5 - Compressed DXT5
  35. - GS_RGBA_UNORM - RGBA, 8 bits per channel, no SRGB aliasing
  36. - GS_BGRX_UNORM - BGRX, 8 bits per channel, no SRGB aliasing
  37. - GS_BGRA_UNORM - BGRA, 8 bits per channel, no SRGB aliasing
  38. - GS_RG16 - RG, 16 bits per channel
  39. .. enum:: gs_color_space
  40. Color space. Can be one of the following values:
  41. - GS_CS_SRGB - sRGB
  42. - GS_CS_SRGB_16F - High-precision SDR
  43. - GS_CS_709_EXTENDED - Canvas, Mac EDR (HDR)
  44. - GS_CS_709_SCRGB - 1.0 = 80 nits, Windows/Linux HDR
  45. .. enum:: gs_zstencil_format
  46. Z-Stencil buffer format. Can be one of the following values:
  47. - GS_ZS_NONE - No Z-stencil buffer
  48. - GS_Z16 - 16 bit Z buffer
  49. - GS_Z24_S8 - 24 bit Z buffer, 8 bit stencil
  50. - GS_Z32F - 32 bit floating point Z buffer
  51. - GS_Z32F_S8X24 - 32 bit floating point Z buffer, 8 bit stencil
  52. .. enum:: gs_index_type
  53. Index buffer type. Can be one of the following values:
  54. - GS_UNSIGNED_SHORT - 16 bit index
  55. - GS_UNSIGNED_LONG - 32 bit index
  56. .. enum:: gs_cull_mode
  57. Cull mode. Can be one of the following values:
  58. - GS_BACK - Cull back faces
  59. - GS_FRONT - Cull front faces
  60. - GS_NEITHER - Cull neither
  61. .. enum:: gs_blend_type
  62. Blend type. Can be one of the following values:
  63. - GS_BLEND_ZERO
  64. - GS_BLEND_ONE
  65. - GS_BLEND_SRCCOLOR
  66. - GS_BLEND_INVSRCCOLOR
  67. - GS_BLEND_SRCALPHA
  68. - GS_BLEND_INVSRCALPHA
  69. - GS_BLEND_DSTCOLOR
  70. - GS_BLEND_INVDSTCOLOR
  71. - GS_BLEND_DSTALPHA
  72. - GS_BLEND_INVDSTALPHA
  73. - GS_BLEND_SRCALPHASAT
  74. .. enum:: gs_depth_test
  75. Depth test type. Can be one of the following values:
  76. - GS_NEVER
  77. - GS_LESS
  78. - GS_LEQUAL
  79. - GS_EQUAL
  80. - GS_GEQUAL
  81. - GS_GREATER
  82. - GS_NOTEQUAL
  83. - GS_ALWAYS
  84. .. enum:: gs_stencil_side
  85. Stencil side. Can be one of the following values:
  86. - GS_STENCIL_FRONT=1
  87. - GS_STENCIL_BACK
  88. - GS_STENCIL_BOTH
  89. .. enum:: gs_stencil_op_type
  90. Stencil operation type. Can be one of the following values:
  91. - GS_KEEP
  92. - GS_ZERO
  93. - GS_REPLACE
  94. - GS_INCR
  95. - GS_DECR
  96. - GS_INVERT
  97. .. enum:: gs_cube_sides
  98. Cubemap side. Can be one of the following values:
  99. - GS_POSITIVE_X
  100. - GS_NEGATIVE_X
  101. - GS_POSITIVE_Y
  102. - GS_NEGATIVE_Y
  103. - GS_POSITIVE_Z
  104. - GS_NEGATIVE_Z
  105. .. enum:: gs_sample_filter
  106. Sample filter type. Can be one of the following values:
  107. - GS_FILTER_POINT
  108. - GS_FILTER_LINEAR
  109. - GS_FILTER_ANISOTROPIC
  110. - GS_FILTER_MIN_MAG_POINT_MIP_LINEAR
  111. - GS_FILTER_MIN_POINT_MAG_LINEAR_MIP_POINT
  112. - GS_FILTER_MIN_POINT_MAG_MIP_LINEAR
  113. - GS_FILTER_MIN_LINEAR_MAG_MIP_POINT
  114. - GS_FILTER_MIN_LINEAR_MAG_POINT_MIP_LINEAR
  115. - GS_FILTER_MIN_MAG_LINEAR_MIP_POINT
  116. .. enum:: gs_address_mode
  117. Address mode. Can be one of the following values:
  118. - GS_ADDRESS_CLAMP
  119. - GS_ADDRESS_WRAP
  120. - GS_ADDRESS_MIRROR
  121. - GS_ADDRESS_BORDER
  122. - GS_ADDRESS_MIRRORONCE
  123. .. enum:: gs_texture_type
  124. Texture type. Can be one of the following values:
  125. - GS_TEXTURE_2D
  126. - GS_TEXTURE_3D
  127. - GS_TEXTURE_CUBE
  128. Graphics Structures
  129. -------------------
  130. .. struct:: gs_monitor_info
  131. .. member:: int gs_monitor_info.rotation_degrees
  132. .. member:: long gs_monitor_info.x
  133. .. member:: long gs_monitor_info.y
  134. .. member:: long gs_monitor_info.cx
  135. .. member:: long gs_monitor_info.cy
  136. ---------------------
  137. .. struct:: gs_tvertarray
  138. .. member:: size_t gs_tvertarray.width
  139. .. member:: void *gs_tvertarray.array
  140. ---------------------
  141. .. struct:: gs_vb_data
  142. .. member:: size_t gs_vb_data.num
  143. .. member:: struct vec3 *gs_vb_data.points
  144. .. member:: struct vec3 *gs_vb_data.normals
  145. .. member:: struct vec3 *gs_vb_data.tangents
  146. .. member:: uint32_t *gs_vb_data.colors
  147. .. member:: size_t gs_vb_data.num_tex
  148. .. member:: struct gs_tvertarray *gs_vb_data.tvarray
  149. ---------------------
  150. .. struct:: gs_sampler_info
  151. .. member:: enum gs_sample_filter gs_sampler_info.filter
  152. .. member:: enum gs_address_mode gs_sampler_info.address_u
  153. .. member:: enum gs_address_mode gs_sampler_info.address_v
  154. .. member:: enum gs_address_mode gs_sampler_info.address_w
  155. .. member:: int gs_sampler_info.max_anisotropy
  156. .. member:: uint32_t gs_sampler_info.border_color
  157. ---------------------
  158. .. struct:: gs_display_mode
  159. .. member:: uint32_t gs_display_mode.width
  160. .. member:: uint32_t gs_display_mode.height
  161. .. member:: uint32_t gs_display_mode.bits
  162. .. member:: uint32_t gs_display_mode.freq
  163. ---------------------
  164. .. struct:: gs_rect
  165. .. member:: int gs_rect.x
  166. .. member:: int gs_rect.y
  167. .. member:: int gs_rect.cx
  168. .. member:: int gs_rect.cy
  169. ---------------------
  170. .. struct:: gs_window
  171. A window structure. This structure is used with a native widget.
  172. .. member:: void *gs_window.hwnd
  173. (Windows only) an HWND widget.
  174. .. member:: id gs_window.view
  175. (macOS only) A view ID.
  176. .. member:: uint32_t gs_window.id
  177. void* gs_window.display
  178. (Linux only) Window ID and display
  179. ---------------------
  180. .. struct:: gs_init_data
  181. Swap chain initialization data.
  182. .. member:: struct gs_window gs_init_data.window
  183. .. member:: uint32_t gs_init_data.cx
  184. .. member:: uint32_t gs_init_data.cy
  185. .. member:: uint32_t gs_init_data.num_backbuffers
  186. .. member:: enum gs_color_format gs_init_data.format
  187. .. member:: enum gs_zstencil_format gs_init_data.zsformat
  188. .. member:: uint32_t gs_init_data.adapter
  189. ---------------------
  190. Initialization Functions
  191. ------------------------
  192. .. function:: void gs_enum_adapters(bool (*callback)(void *param, const char *name, uint32_t id), void *param)
  193. Enumerates adapters (this really only applies on Windows).
  194. :param callback: Enumeration callback
  195. :param param: Private data passed to the callback
  196. ---------------------
  197. .. function:: int gs_create(graphics_t **graphics, const char *module, uint32_t adapter)
  198. Creates a graphics context
  199. :param graphics: Pointer to receive the graphics context
  200. :param module: Module name
  201. :param adapter: Adapter index
  202. :return: Can return one of the following values:
  203. - GS_SUCCESS
  204. - GS_ERROR_FAIL
  205. - GS_ERROR_MODULE_NOT_FOUND
  206. - GS_ERROR_NOT_SUPPORTED
  207. ---------------------
  208. .. function:: void gs_destroy(graphics_t *graphics)
  209. Destroys a graphics context
  210. :param graphics: Graphics context
  211. ---------------------
  212. .. function:: void gs_enter_context(graphics_t *graphics)
  213. Enters and locks the graphics context
  214. :param graphics: Graphics context
  215. ---------------------
  216. .. function:: void gs_leave_context(void)
  217. Leaves and unlocks the graphics context
  218. :param graphics: Graphics context
  219. ---------------------
  220. .. function:: graphics_t *gs_get_context(void)
  221. :return: The currently locked graphics context for this thread
  222. ---------------------
  223. Matrix Stack Functions
  224. ----------------------
  225. .. function:: void gs_matrix_push(void)
  226. Pushes the matrix stack and duplicates the current matrix.
  227. ---------------------
  228. .. function:: void gs_matrix_pop(void)
  229. Pops the current matrix from the matrix stack.
  230. ---------------------
  231. .. function:: void gs_matrix_identity(void)
  232. Sets the current matrix to an identity matrix.
  233. ---------------------
  234. .. function:: void gs_matrix_transpose(void)
  235. Transposes the current matrix.
  236. ---------------------
  237. .. function:: void gs_matrix_set(const struct matrix4 *matrix)
  238. Sets the current matrix.
  239. :param matrix: The matrix to set
  240. ---------------------
  241. .. function:: void gs_matrix_get(struct matrix4 *dst)
  242. Gets the current matrix
  243. :param dst: Destination matrix
  244. ---------------------
  245. .. function:: void gs_matrix_mul(const struct matrix4 *matrix)
  246. Multiplies the current matrix
  247. :param matrix: Matrix to multiply the current stack matrix with
  248. ---------------------
  249. .. function:: void gs_matrix_rotquat(const struct quat *rot)
  250. Multiplies the current matrix with a quaternion
  251. :param rot: Quaternion to multiple the current matrix stack with
  252. ---------------------
  253. .. function:: void gs_matrix_rotaa(const struct axisang *rot)
  254. void gs_matrix_rotaa4f(float x, float y, float z, float angle)
  255. Multiplies the current matrix with an axis angle
  256. :param rot: Axis angle to multiple the current matrix stack with
  257. ---------------------
  258. .. function:: void gs_matrix_translate(const struct vec3 *pos)
  259. void gs_matrix_translate3f(float x, float y, float z)
  260. Translates the current matrix
  261. :param pos: Vector to translate the current matrix stack with
  262. ---------------------
  263. .. function:: void gs_matrix_scale(const struct vec3 *scale)
  264. void gs_matrix_scale3f(float x, float y, float z)
  265. Scales the current matrix
  266. :param scale: Scale value to scale the current matrix stack with
  267. ---------------------
  268. Draw Functions
  269. --------------
  270. .. function:: gs_effect_t *gs_get_effect(void)
  271. :return: The currently active effect, or *NULL* if none active
  272. ---------------------
  273. .. function:: void gs_draw_sprite(gs_texture_t *tex, uint32_t flip, uint32_t width, uint32_t height)
  274. Draws a 2D sprite. Sets the "image" parameter of the current effect
  275. to the texture and renders a quad.
  276. If width or height is 0, the width or height of the texture will be
  277. used. The flip value specifies whether the texture should be flipped
  278. on the U or V axis with GS_FLIP_U and GS_FLIP_V.
  279. :param tex: Texture to draw
  280. :param flip: Can be 0 or a bitwise-OR combination of one of the
  281. following values:
  282. - GS_FLIP_U - Flips the texture horizontally
  283. - GS_FLIP_V - Flips the texture vertically
  284. :param width: Width
  285. :param height: Height
  286. ---------------------
  287. .. function:: void gs_draw_sprite_subregion(gs_texture_t *tex, uint32_t flip, uint32_t x, uint32_t y, uint32_t cx, uint32_t cy)
  288. Draws a subregion of a 2D sprite. Sets the "image" parameter of the
  289. current effect to the texture and renders a quad.
  290. :param tex: Texture to draw
  291. :param flip: Can be 0 or a bitwise-OR combination of one of the
  292. following values:
  293. - GS_FLIP_U - Flips the texture horizontally
  294. - GS_FLIP_V - Flips the texture vertically
  295. :param x: X value within subregion
  296. :param y: Y value within subregion
  297. :param cx: CX value of subregion
  298. :param cy: CY value of subregion
  299. ---------------------
  300. .. function:: void gs_reset_viewport(void)
  301. Sets the viewport to current swap chain size
  302. ---------------------
  303. .. function:: void gs_set_2d_mode(void)
  304. Sets the projection matrix to a default screen-sized orthographic
  305. mode
  306. ---------------------
  307. .. function:: void gs_set_3d_mode(double fovy, double znear, double zfar)
  308. Sets the projection matrix to a default screen-sized perspective
  309. mode
  310. :param fovy: Field of view (in degrees)
  311. :param znear: Near plane
  312. :param zfar: Far plane
  313. ---------------------
  314. .. function:: void gs_viewport_push(void)
  315. Pushes/stores the current viewport
  316. ---------------------
  317. .. function:: void gs_viewport_pop(void)
  318. Pops/recalls the last pushed viewport
  319. ---------------------
  320. .. function:: void gs_perspective(float fovy, float aspect, float znear, float zfar)
  321. Sets the projection matrix to a perspective mode
  322. :param fovy: Field of view (in degrees)
  323. :param aspect: Aspect ratio
  324. :param znear: Near plane
  325. :param zfar: Far plane
  326. ---------------------
  327. .. function:: void gs_blend_state_push(void)
  328. Pushes/stores the current blend state
  329. ---------------------
  330. .. function:: void gs_blend_state_pop(void)
  331. Pops/restores the last blend state
  332. ---------------------
  333. .. function:: void gs_reset_blend_state(void)
  334. Sets the blend state to the default value: source alpha and invert
  335. source alpha.
  336. ---------------------
  337. Swap Chains
  338. -----------
  339. .. function:: gs_swapchain_t *gs_swapchain_create(const struct gs_init_data *data)
  340. Creates a swap chain (display view on a native widget)
  341. :param data: Swap chain initialization data
  342. :return: New swap chain object, or *NULL* if failed
  343. ---------------------
  344. .. function:: void gs_swapchain_destroy(gs_swapchain_t *swapchain)
  345. Destroys a swap chain
  346. ---------------------
  347. .. function:: void gs_resize(uint32_t cx, uint32_t cy)
  348. Resizes the currently active swap chain
  349. :param cx: New width
  350. :param cy: New height
  351. ---------------------
  352. .. function:: void gs_update_color_space(void)
  353. Updates the color space of the swap chain based on the HDR status of
  354. the nearest monitor
  355. ---------------------
  356. .. function:: void gs_get_size(uint32_t *cx, uint32_t *cy)
  357. Gets the size of the currently active swap chain
  358. :param cx: Pointer to receive width
  359. :param cy: Pointer to receive height
  360. ---------------------
  361. .. function:: uint32_t gs_get_width(void)
  362. Gets the width of the currently active swap chain
  363. ---------------------
  364. .. function:: uint32_t gs_get_height(void)
  365. Gets the height of the currently active swap chain
  366. ---------------------
  367. Resource Loading
  368. ----------------
  369. .. function:: void gs_load_vertexbuffer(gs_vertbuffer_t *vertbuffer)
  370. Loads a vertex buffer
  371. :param vertbuffer: Vertex buffer to load, or NULL to unload
  372. ---------------------
  373. .. function:: void gs_load_indexbuffer(gs_indexbuffer_t *indexbuffer)
  374. Loads a index buffer
  375. :param indexbuffer: Index buffer to load, or NULL to unload
  376. ---------------------
  377. .. function:: void gs_load_texture(gs_texture_t *tex, int unit)
  378. Loads a texture (this is usually not called manually)
  379. :param tex: Texture to load, or NULL to unload
  380. :param unit: Texture unit to load texture for
  381. ---------------------
  382. .. function:: void gs_load_samplerstate(gs_samplerstate_t *samplerstate, int unit)
  383. Loads a sampler state (this is usually not called manually)
  384. :param samplerstate: Sampler state to load, or NULL to unload
  385. :param unit: Texture unit to load sampler state for
  386. ---------------------
  387. .. function:: void gs_load_swapchain(gs_swapchain_t *swapchain)
  388. Loads a swapchain
  389. :param swapchain: Swap chain to load, or NULL to unload
  390. ---------------------
  391. Draw Functions
  392. --------------
  393. .. function:: enum gs_color_space gs_get_color_space(void)
  394. :return: The currently active color space
  395. ---------------------
  396. .. function:: gs_texture_t *gs_get_render_target(void)
  397. :return: The currently active render target
  398. ---------------------
  399. .. function:: gs_zstencil_t *gs_get_zstencil_target(void)
  400. :return: The currently active Z-stencil target
  401. ---------------------
  402. .. function:: void gs_set_render_target(gs_texture_t *tex, gs_zstencil_t *zstencil)
  403. Sets the active render target with implicit GS_CS_SRGB color space
  404. :param tex: Texture to set as the active render target
  405. :param zstencil: Z-stencil to use as the active render target
  406. ---------------------
  407. .. function:: void gs_set_render_target_with_color_space(gs_texture_t *tex, gs_zstencil_t *zstencil, enum gs_color_space space)
  408. Sets the active render target along with color space
  409. :param tex: Texture to set as the active render target
  410. :param zstencil: Z-stencil to use as the active render target
  411. :param space: Color space of the render target
  412. ---------------------
  413. .. function:: void gs_set_cube_render_target(gs_texture_t *cubetex, int side, gs_zstencil_t *zstencil)
  414. Sets a cubemap side as the active render target
  415. :param cubetex: Cubemap
  416. :param side: Cubemap side
  417. :param zstencil: Z-stencil buffer, or *NULL* if none
  418. ---------------------
  419. .. function:: void gs_copy_texture(gs_texture_t *dst, gs_texture_t *src)
  420. Copies a texture
  421. :param dst: Destination texture
  422. :param src: Source texture
  423. ---------------------
  424. .. function:: void gs_stage_texture(gs_stagesurf_t *dst, gs_texture_t *src)
  425. Copies a texture to a staging surface and copies it to RAM. Ideally
  426. best to give this a frame to process to prevent stalling.
  427. :param dst: Staging surface
  428. :param src: Texture to stage
  429. ---------------------
  430. .. function:: void gs_begin_scene(void)
  431. void gs_end_scene(void)
  432. Begins/ends a scene (this is automatically called by libobs, there's
  433. no need to call this manually).
  434. ---------------------
  435. .. function:: void gs_draw(enum gs_draw_mode draw_mode, uint32_t start_vert, uint32_t num_verts)
  436. Draws a primitive or set of primitives.
  437. :param draw_mode: The primitive draw mode to use
  438. :param start_vert: Starting vertex index
  439. :param num_verts: Number of vertices
  440. ---------------------
  441. .. function:: void gs_clear(uint32_t clear_flags, const struct vec4 *color, float depth, uint8_t stencil)
  442. Clears color/depth/stencil buffers.
  443. :param clear_flags: Flags to clear with. Can be one of the following
  444. values:
  445. - GS_CLEAR_COLOR - Clears color buffer
  446. - GS_CLEAR_DEPTH - Clears depth buffer
  447. - GS_CLEAR_STENCIL - Clears stencil buffer
  448. :param color: Color value to clear the color buffer with
  449. :param depth: Depth value to clear the depth buffer with
  450. :param stencil: Stencil value to clear the stencil buffer with
  451. ---------------------
  452. .. function:: void gs_present(void)
  453. Displays what was rendered on to the current render target
  454. ---------------------
  455. .. function:: void gs_flush(void)
  456. Flushes GPU calls
  457. ---------------------
  458. .. function:: void gs_set_cull_mode(enum gs_cull_mode mode)
  459. Sets the current cull mode.
  460. :param mode: Cull mode
  461. ---------------------
  462. .. function:: enum gs_cull_mode gs_get_cull_mode(void)
  463. :return: The current cull mode
  464. ---------------------
  465. .. function:: void gs_enable_blending(bool enable)
  466. Enables/disables blending
  467. :param enable: *true* to enable, *false* to disable
  468. ---------------------
  469. .. function:: void gs_enable_depth_test(bool enable)
  470. Enables/disables depth testing
  471. :param enable: *true* to enable, *false* to disable
  472. ---------------------
  473. .. function:: void gs_enable_stencil_test(bool enable)
  474. Enables/disables stencil testing
  475. :param enable: *true* to enable, *false* to disable
  476. ---------------------
  477. .. function:: void gs_enable_stencil_write(bool enable)
  478. Enables/disables stencil writing
  479. :param enable: *true* to enable, *false* to disable
  480. ---------------------
  481. .. function:: void gs_enable_color(bool red, bool green, bool blue, bool alpha)
  482. Enables/disables specific color channels
  483. :param red: *true* to enable red channel, *false* to disable
  484. :param green: *true* to enable green channel, *false* to disable
  485. :param blue: *true* to enable blue channel, *false* to disable
  486. :param alpha: *true* to enable alpha channel, *false* to disable
  487. ---------------------
  488. .. function:: void gs_blend_function(enum gs_blend_type src, enum gs_blend_type dest)
  489. Sets the blend function's source and destination factors
  490. :param src: Blend type for the blending equation's source factors
  491. :param dest: Blend type for the blending equation's destination factors
  492. ---------------------
  493. .. function:: void gs_blend_function_separate(enum gs_blend_type src_c, enum gs_blend_type dest_c, enum gs_blend_type src_a, enum gs_blend_type dest_a)
  494. Sets the blend function's source and destination factors for RGB and alpha separately
  495. :param src_c: Blend type for the blending equation's source RGB factor
  496. :param dest_c: Blend type for the blending equation's destination RGB factor
  497. :param src_a: Blend type for the blending equation's source alpha factor
  498. :param dest_a: Blend type for the blending equation's destination alpha factor
  499. ---------------------
  500. .. function:: void gs_blend_op(enum gs_blend_op_type op)
  501. Sets the blend function's operation type
  502. :param op: Operation type for the blending equation
  503. ---------------------
  504. .. function:: void gs_depth_function(enum gs_depth_test test)
  505. Sets the depth function
  506. :param test: Sets the depth test type
  507. ---------------------
  508. .. function:: void gs_stencil_function(enum gs_stencil_side side, enum gs_depth_test test)
  509. Sets the stencil function
  510. :param side: Stencil side
  511. :param test: Depth test
  512. ---------------------
  513. .. function:: void gs_stencil_op(enum gs_stencil_side side, enum gs_stencil_op_type fail, enum gs_stencil_op_type zfail, enum gs_stencil_op_type zpass)
  514. Sets the stencil operation
  515. :param side: Stencil side
  516. :param fail: Operation to perform on stencil test failure
  517. :param zfail: Operation to perform on depth test failure
  518. :param zpass: Operation to perform on depth test success
  519. ---------------------
  520. .. function:: void gs_set_viewport(int x, int y, int width, int height)
  521. Sets the current viewport
  522. :param x: X position relative to upper left
  523. :param y: Y position relative to upper left
  524. :param width: Width of the viewport
  525. :param height: Height of the viewport
  526. ---------------------
  527. .. function:: void gs_get_viewport(struct gs_rect *rect)
  528. Gets the current viewport
  529. :param rect: Pointer to receive viewport rectangle
  530. ---------------------
  531. .. function:: void gs_set_scissor_rect(const struct gs_rect *rect)
  532. Sets or clears the current scissor rectangle
  533. :rect: Scissor rectangle, or *NULL* to clear
  534. ---------------------
  535. .. function:: void gs_ortho(float left, float right, float top, float bottom, float znear, float zfar)
  536. Sets the projection matrix to an orthographic matrix
  537. ---------------------
  538. .. function:: void gs_frustum(float left, float right, float top, float bottom, float znear, float zfar)
  539. Sets the projection matrix to a frustum matrix
  540. ---------------------
  541. .. function:: void gs_projection_push(void)
  542. Pushes/stores the current projection matrix
  543. ---------------------
  544. .. function:: void gs_projection_pop(void)
  545. Pops/restores the last projection matrix pushed
  546. ---------------------
  547. Texture Functions
  548. -----------------
  549. .. function:: gs_texture_t *gs_texture_create(uint32_t width, uint32_t height, enum gs_color_format color_format, uint32_t levels, const uint8_t **data, uint32_t flags)
  550. Creates a texture.
  551. :param width: Width
  552. :param height: Height
  553. :param color_format: Color format
  554. :param levels: Number of total texture levels. Set to 1 if no
  555. mip-mapping
  556. :param data: Pointer to array of texture data pointers
  557. :param flags: Can be 0 or a bitwise-OR combination of one or
  558. more of the following value:
  559. - GS_BUILD_MIPMAPS - Automatically builds
  560. mipmaps (Note: not fully tested)
  561. - GS_DYNAMIC - Dynamic
  562. - GS_RENDER_TARGET - Render target
  563. :return: A new texture object
  564. ---------------------
  565. .. function:: gs_texture_t *gs_texture_create_from_file(const char *file)
  566. Creates a texture from a file. Note that this isn't recommended for
  567. animated gifs -- instead use the :ref:`image_file_helper`.
  568. :param file: Image file to open
  569. ---------------------
  570. .. function:: void gs_texture_destroy(gs_texture_t *tex)
  571. Destroys a texture
  572. :param tex: Texture object
  573. ---------------------
  574. .. function:: uint32_t gs_texture_get_width(const gs_texture_t *tex)
  575. Gets the texture's width
  576. :param tex: Texture object
  577. :return: The texture's width
  578. ---------------------
  579. .. function:: uint32_t gs_texture_get_height(const gs_texture_t *tex)
  580. Gets the texture's height
  581. :param tex: Texture object
  582. :return: The texture's height
  583. ---------------------
  584. .. function:: enum gs_color_format gs_texture_get_color_format(const gs_texture_t *tex)
  585. Gets the texture's color format
  586. :param tex: Texture object
  587. :return: The texture's color format
  588. ---------------------
  589. .. function:: bool gs_texture_map(gs_texture_t *tex, uint8_t **ptr, uint32_t *linesize)
  590. Maps a texture.
  591. :param tex: Texture object
  592. :param ptr: Pointer to receive the pointer to the texture data
  593. to write to
  594. :param linesize: Pointer to receive the line size (pitch) of the
  595. texture
  596. ---------------------
  597. .. function:: void gs_texture_unmap(gs_texture_t *tex)
  598. Unmaps a texture.
  599. :param tex: Texture object
  600. ---------------------
  601. .. function:: void gs_texture_set_image(gs_texture_t *tex, const uint8_t *data, uint32_t linesize, bool invert)
  602. Sets the image of a dynamic texture
  603. :param tex: Texture object
  604. :param data: Data to set as the image
  605. :param linesize: Line size (pitch) of the data
  606. :param invert: *true* to invert vertically, *false* otherwise
  607. ---------------------
  608. .. function:: gs_texture_t *gs_texture_create_from_dmabuf(unsigned int width, unsigned int height, uint32_t drm_format, enum gs_color_format color_format, uint32_t n_planes, const int *fds, const uint32_t *strides, const uint32_t *offsets, const uint64_t *modifiers)
  609. **Linux only:** Creates a texture from DMA-BUF metadata.
  610. Exchanging DMA-BUFs is a verbose process because of its multiplanar nature.
  611. For example, YUV can have each plane as a color channel, or a monitor buffer
  612. can have the cursor stored in a separate plane.
  613. This function treats the OBS Studio format and the DRM format separately.
  614. This allows creating textures from DMA-BUFs with unsupported formats (e.g.
  615. YUV) and perform the color format conversion using shaders. However, be
  616. careful to always try and match the formats correctly, otherwise textures
  617. can fail to be created or rendered.
  618. All modifiers passed in the modifiers array must be equal. Passing different
  619. modifiers for each plane is unsupported.
  620. :param width: Width of the texture
  621. :param height: Height of the texture
  622. :param drm_format: DRM format of the DMA-BUF buffer
  623. :param color_format: Color format compatible with OBS Studio
  624. :param n_planes: Number of planes of the DMA-BUF
  625. :param fds: Array of size *n_planes* with the file descriptor of each plane
  626. :param strides: Array of size *n_planes* with the stride of each plane
  627. :param offsets: Array of size *n_planes* with the offset of each plane
  628. :param modifiers: Array of size *n_planes* with the modifier of each plane
  629. :return: A texture object on success, or *NULL* on failure
  630. :rtype: gs_texture_t*
  631. ---------------------
  632. .. enum:: gs_dmabuf_flags
  633. DMA-BUF capabilities:
  634. - GS_DMABUF_FLAG_NONE
  635. - GS_DMABUF_FLAG_SUPPORTS_IMPLICIT_MODIFIERS - Renderer supports implicit modifiers
  636. ---------------------
  637. .. function:: bool *gs_query_dmabuf_capabilities(enum gs_dmabuf_flags *dmabuf_flags, uint32_t **drm_formats, size_t *n_formats)
  638. **Linux only:** Queries the capabilities for DMA-BUFs.
  639. Graphics cards can optimize frame buffers by storing them in custom layouts,
  640. depending on their hardware features. These layouts can make these frame
  641. buffers unsuitable for linear processing. This function allows querying whether
  642. the graphics card in use supports implicit modifiers, and the supported texture
  643. formats.
  644. The caller must free the `drm_formats` array with `bfree()` after use.
  645. :param dmabuf_flags: Pointer to receive a capability bitmap
  646. :param drm_formats: Pointer to receive an array of DRM formats
  647. :param n_formats: Pointer to receive the number of formats
  648. :rtype: bool
  649. ---------------------
  650. .. function:: bool *gs_query_dmabuf_modifiers_for_format(uint32_t drm_format, uint64_t **modifiers, size_t *n_modifiers)
  651. **Linux only:** Queries the supported DMA-BUF modifiers for a given format.
  652. This function queries all supported explicit modifiers for a format,
  653. stores them as an array and returns the number of supported modifiers.
  654. The caller must free the `modifiers` array with `bfree()` after use.
  655. :param drm_format: DRM format of the DMA-BUF buffer
  656. :param modifiers: Pointer to receive an array of modifiers
  657. :param n_modifiers: Pointer to receive the number of modifiers
  658. :rtype: bool
  659. ---------------------
  660. .. function:: gs_texture_t *gs_texture_create_from_iosurface(void *iosurf)
  661. **macOS only:** Creates a texture from an IOSurface.
  662. :param iosurf: IOSurface object
  663. ---------------------
  664. .. function:: bool gs_texture_rebind_iosurface(gs_texture_t *texture, void *iosurf)
  665. **macOS only:** Rebinds a texture to another IOSurface
  666. :param texture: Texture object
  667. :param iosuf: IOSurface object
  668. ---------------------
  669. .. function:: gs_texture_t *gs_texture_create_gdi(uint32_t width, uint32_t height)
  670. **Windows only:** Creates a GDI-interop texture
  671. :param width: Width
  672. :param height: Height
  673. ---------------------
  674. .. function:: void *gs_texture_get_dc(gs_texture_t *gdi_tex)
  675. **Windows only:** Gets the HDC of a GDI-interop texture. Call
  676. :c:func:`gs_texture_release_dc()` to release the HDC.
  677. :param gdi_tex: GDI-interop texture object
  678. :return: HDC object
  679. ---------------------
  680. .. function:: void gs_texture_release_dc(gs_texture_t *gdi_tex)
  681. **Windows only:** Releases the HDC of the GDI-interop texture.
  682. :param gdi_tex: GDI-interop texture object
  683. ---------------------
  684. .. function:: gs_texture_t *gs_texture_open_shared(uint32_t handle)
  685. **Windows only:** Creates a texture from a shared texture handle.
  686. :param handle: Shared texture handle
  687. :return: A texture object
  688. ---------------------
  689. .. function:: bool gs_gdi_texture_available(void)
  690. **Windows only:** Returns whether GDI-interop textures are available.
  691. :return: *true* if available, *false* otherwise
  692. ---------------------
  693. .. function:: bool gs_shared_texture_available(void)
  694. **Windows only:** Returns whether shared textures are available.
  695. :return: *true* if available, *false* otherwise
  696. ---------------------
  697. Cube Texture Functions
  698. ----------------------
  699. .. function:: gs_texture_t *gs_cubetexture_create(uint32_t size, enum gs_color_format color_format, uint32_t levels, const uint8_t **data, uint32_t flags)
  700. Creates a cubemap texture.
  701. :param size: Width/height/depth value
  702. :param color_format: Color format
  703. :param levels: Number of texture levels
  704. :param data: Pointer to array of texture data pointers
  705. :param flags: Can be 0 or a bitwise-OR combination of one or
  706. more of the following value:
  707. - GS_BUILD_MIPMAPS - Automatically builds
  708. mipmaps (Note: not fully tested)
  709. - GS_DYNAMIC - Dynamic
  710. - GS_RENDER_TARGET - Render target
  711. :return: A new cube texture object
  712. ---------------------
  713. .. function:: void gs_cubetexture_destroy(gs_texture_t *cubetex)
  714. Destroys a cube texture.
  715. :param cubetex: Cube texture object
  716. ---------------------
  717. .. function:: uint32_t gs_cubetexture_get_size(const gs_texture_t *cubetex)
  718. Get the width/height/depth value of a cube texture.
  719. :param cubetex: Cube texture object
  720. :return: The width/height/depth value of the cube texture
  721. ---------------------
  722. .. function:: enum gs_color_format gs_cubetexture_get_color_format(const gs_texture_t *cubetex)
  723. Gets the color format of a cube texture.
  724. :param cubetex: Cube texture object
  725. :return: The color format of the cube texture
  726. ---------------------
  727. .. function:: void gs_cubetexture_set_image(gs_texture_t *cubetex, uint32_t side, const void *data, uint32_t linesize, bool invert)
  728. Sets an image of a cube texture side.
  729. :param cubetex: Cube texture object
  730. :param side: Side
  731. :param data: Texture data to set
  732. :param linesize: Line size (pitch) of the texture data
  733. :param invert: *true* to invert texture data, *false* otherwise
  734. ---------------------
  735. Staging Surface Functions
  736. -------------------------
  737. Staging surfaces are used to efficiently copy textures from VRAM to RAM.
  738. .. function:: gs_stagesurf_t *gs_stagesurface_create(uint32_t width, uint32_t height, enum gs_color_format color_format)
  739. Creates a staging surface.
  740. :param width: Width
  741. :param height: Height
  742. :param color_format: Color format
  743. :return: The staging surface object
  744. ---------------------
  745. .. function:: void gs_stagesurface_destroy(gs_stagesurf_t *stagesurf)
  746. Destroys a staging surface.
  747. :param stagesurf: Staging surface object
  748. ---------------------
  749. .. function:: uint32_t gs_stagesurface_get_width(const gs_stagesurf_t *stagesurf)
  750. uint32_t gs_stagesurface_get_height(const gs_stagesurf_t *stagesurf)
  751. Gets the width/height of a staging surface object.
  752. :param stagesurf: Staging surface object
  753. :return: Width/height of the staging surface
  754. ---------------------
  755. .. function:: enum gs_color_format gs_stagesurface_get_color_format(const gs_stagesurf_t *stagesurf)
  756. Gets the color format of a staging surface object.
  757. :param stagesurf: Staging surface object
  758. :return: Color format of the staging surface
  759. ---------------------
  760. .. function:: bool gs_stagesurface_map(gs_stagesurf_t *stagesurf, uint8_t **data, uint32_t *linesize)
  761. Maps the staging surface texture (for reading). Call
  762. :c:func:`gs_stagesurface_unmap()` to unmap when complete.
  763. :param stagesurf: Staging surface object
  764. :param data: Pointer to receive texture data pointer
  765. :param linesize: Pointer to receive line size (pitch) of the texture
  766. data
  767. :return: *true* if map successful, *false* otherwise
  768. ---------------------
  769. .. function:: void gs_stagesurface_unmap(gs_stagesurf_t *stagesurf)
  770. Unmaps a staging surface.
  771. :param stagesurf: Staging surface object
  772. ---------------------
  773. Z-Stencil Functions
  774. -------------------
  775. .. function:: gs_zstencil_t *gs_zstencil_create(uint32_t width, uint32_t height, enum gs_zstencil_format format)
  776. Creates a Z-stencil surface object.
  777. :param width: Width
  778. :param height: Height
  779. :param format: Format
  780. :return: New Z-stencil surface object, or *NULL* if failed
  781. ---------------------
  782. .. function:: void gs_zstencil_destroy(gs_zstencil_t *zstencil)
  783. Destroys a Z-stencil buffer.
  784. :param zstencil: Z-stencil surface object
  785. ---------------------
  786. Sampler State Functions
  787. -----------------------
  788. .. function:: gs_samplerstate_t *gs_samplerstate_create(const struct gs_sampler_info *info)
  789. Creates a sampler state object.
  790. :param info: Sampler state information
  791. :return: New sampler state object
  792. ---------------------
  793. .. function:: void gs_samplerstate_destroy(gs_samplerstate_t *samplerstate)
  794. Destroys a sampler state object.
  795. :param samplerstate: Sampler state object
  796. ---------------------
  797. Vertex Buffer Functions
  798. -----------------------
  799. .. function:: gs_vertbuffer_t *gs_vertexbuffer_create(struct gs_vb_data *data, uint32_t flags)
  800. Creates a vertex buffer.
  801. :param data: Vertex buffer data to create vertex buffer with. The
  802. structure should be created with gs_vbdata_create(),
  803. and then buffers in this structure should be allocated
  804. with :c:func:`bmalloc()`, :c:func:`bzalloc()`, or
  805. :c:func:`brealloc()`. The ownership of the gs_vb_data
  806. pointer is then passed to the function, and they should
  807. not be destroyed by the caller once passed
  808. :param flags: Creation flags. Can be 0 or a bitwise-OR combination
  809. of any of the following values:
  810. - GS_DYNAMIC - Can be dynamically updated in real time.
  811. - GS_DUP_BUFFER - Do not pass buffer ownership of the
  812. structure or the buffer pointers within the
  813. structure.
  814. :return: A new vertex buffer object, or *NULL* if failed
  815. ---------------------
  816. .. function:: void gs_vertexbuffer_destroy(gs_vertbuffer_t *vertbuffer)
  817. Destroys a vertex buffer object.
  818. :param vertbuffer: Vertex buffer object
  819. ---------------------
  820. .. function:: void gs_vertexbuffer_flush(gs_vertbuffer_t *vertbuffer)
  821. Flushes a vertex buffer to its interval vertex data object. To
  822. modify its internal vertex data, call
  823. :c:func:`gs_vertexbuffer_get_data()`.
  824. Can only be used with dynamic vertex buffer objects.
  825. :param vertbuffer: Vertex buffer object
  826. ---------------------
  827. .. function:: void gs_vertexbuffer_flush_direct(gs_vertbuffer_t *vertbuffer, const struct gs_vb_data *data)
  828. Directly flushes a vertex buffer to the specified vertex buffer data.
  829. .
  830. Can only be used with dynamic vertex buffer objects.
  831. :param vertbuffer: Vertex buffer object
  832. :param data: Vertex buffer data to flush. Components that
  833. don't need to be flushed can be left *NULL*
  834. ---------------------
  835. .. function:: struct gs_vb_data *gs_vertexbuffer_get_data(const gs_vertbuffer_t *vertbuffer)
  836. Gets the vertex buffer data associated with a vertex buffer object.
  837. This data can be changed and vertex buffer can be updated with
  838. :c:func:`gs_vertexbuffer_flush()`.
  839. Can only be used with dynamic vertex buffer objects.
  840. :param vertbuffer: Vertex buffer object
  841. :return: Vertex buffer data structure
  842. ---------------------
  843. Index Buffer Functions
  844. ----------------------
  845. .. function:: gs_indexbuffer_t *gs_indexbuffer_create(enum gs_index_type type, void *indices, size_t num, uint32_t flags)
  846. Creates an index buffer.
  847. :param type: Index buffer type
  848. :param indices: Index buffer data. This buffer must be allocated
  849. with :c:func:`bmalloc()`, :c:func:`bzalloc()`, or
  850. :c:func:`bralloc()`, and ownership of this buffer is
  851. passed to the index buffer object.
  852. :param num: Number of indices in the buffer
  853. :param flags: Creation flags. Can be 0 or a bitwise-OR combination
  854. of any of the following values:
  855. - GS_DYNAMIC - Can be dynamically updated in real time.
  856. - GS_DUP_BUFFER - Do not pass buffer ownership
  857. :return: A new index buffer object, or *NULL* if failed
  858. ---------------------
  859. .. function:: void gs_indexbuffer_destroy(gs_indexbuffer_t *indexbuffer)
  860. Destroys an index buffer object.
  861. :param indexbuffer: Index buffer object
  862. ---------------------
  863. .. function:: void gs_indexbuffer_flush(gs_indexbuffer_t *indexbuffer)
  864. Flushes a index buffer to its interval index data object. To modify
  865. its internal index data, call :c:func:`gs_indexbuffer_get_data()`.
  866. Can only be used with dynamic index buffer objects.
  867. :param indexbuffer: Index buffer object
  868. ---------------------
  869. .. function:: void gs_indexbuffer_flush_direct(gs_indexbuffer_t *indexbuffer, const void *data)
  870. Flushes a index buffer to the specified index buffer data.
  871. Can only be used with dynamic index buffer objects.
  872. :param indexbuffer: Index buffer object
  873. :param data: Index buffer data to flush
  874. ---------------------
  875. .. function:: void *gs_indexbuffer_get_data(const gs_indexbuffer_t *indexbuffer)
  876. Gets the index buffer data associated with a index buffer object.
  877. This data can be changed and index buffer can be updated with
  878. :c:func:`gs_indexbuffer_flush()`.
  879. Can only be used with dynamic index buffer objects.
  880. :param vertbuffer: Index buffer object
  881. :return: Index buffer data pointer
  882. ---------------------
  883. .. function:: size_t gs_indexbuffer_get_num_indices(const gs_indexbuffer_t *indexbuffer)
  884. Gets the number of indices associated with this index buffer.
  885. :param indexbuffer: Index buffer object
  886. :return: Number of indices the vertex buffer object has
  887. ---------------------
  888. .. function:: enum gs_index_type gs_indexbuffer_get_type(const gs_indexbuffer_t *indexbuffer)
  889. Gets the type of index buffer.
  890. :param indexbuffer: Index buffer object
  891. :return: Index buffer type
  892. ---------------------
  893. Display Duplicator (Windows Only)
  894. ---------------------------------
  895. .. function:: gs_duplicator_t *gs_duplicator_create(int monitor_idx)
  896. ---------------------
  897. .. function:: void gs_duplicator_destroy(gs_duplicator_t *duplicator)
  898. ---------------------
  899. .. function:: bool gs_duplicator_update_frame(gs_duplicator_t *duplicator)
  900. ---------------------
  901. .. function:: gs_texture_t *gs_duplicator_get_texture(gs_duplicator_t *duplicator)
  902. ---------------------
  903. .. function:: bool gs_get_duplicator_monitor_info(int monitor_idx, struct gs_monitor_info *monitor_info)
  904. ---------------------
  905. Monitor Functions
  906. ---------------------------------
  907. .. function:: bool gs_is_monitor_hdr(void *monitor)
  908. ---------------------
  909. Render Helper Functions
  910. -----------------------
  911. .. function:: void gs_render_start(bool b_new)
  912. ---------------------
  913. .. function:: void gs_render_stop(enum gs_draw_mode mode)
  914. ---------------------
  915. .. function:: gs_vertbuffer_t *gs_render_save(void)
  916. ---------------------
  917. .. function:: void gs_vertex2f(float x, float y)
  918. ---------------------
  919. .. function:: void gs_vertex3f(float x, float y, float z)
  920. ---------------------
  921. .. function:: void gs_normal3f(float x, float y, float z)
  922. ---------------------
  923. .. function:: void gs_color(uint32_t color)
  924. ---------------------
  925. .. function:: void gs_texcoord(float x, float y, int unit)
  926. ---------------------
  927. .. function:: void gs_vertex2v(const struct vec2 *v)
  928. ---------------------
  929. .. function:: void gs_vertex3v(const struct vec3 *v)
  930. ---------------------
  931. .. function:: void gs_normal3v(const struct vec3 *v)
  932. ---------------------
  933. .. function:: void gs_color4v(const struct vec4 *v)
  934. ---------------------
  935. .. function:: void gs_texcoord2v(const struct vec2 *v, int unit)
  936. ---------------------
  937. Graphics Types
  938. --------------
  939. .. type:: struct gs_duplicator gs_duplicator_t
  940. .. type:: struct gs_texture gs_texture_t
  941. .. type:: struct gs_stage_surface gs_stagesurf_t
  942. .. type:: struct gs_zstencil_buffer gs_zstencil_t
  943. .. type:: struct gs_vertex_buffer gs_vertbuffer_t
  944. .. type:: struct gs_index_buffer gs_indexbuffer_t
  945. .. type:: struct gs_sampler_state gs_samplerstate_t
  946. .. type:: struct gs_swap_chain gs_swapchain_t
  947. .. type:: struct gs_texture_render gs_texrender_t
  948. .. type:: struct gs_shader gs_shader_t
  949. .. type:: struct gs_shader_param gs_sparam_t
  950. .. type:: struct gs_device gs_device_t
  951. .. type:: struct graphics_subsystem graphics_t