ACSUtils Wiki

An ACS library for ZDoom-based ports

User Tools

Site Tools


renderer_identification

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
Last revisionBoth sides next revision
renderer_identification [2019/08/26 03:17] – created korshunrenderer_identification [2019/08/26 03:53] korshun
Line 1: Line 1:
-====== Renderer identification ======+====== Renderer detect ======
  
 ===== Introduction ===== ===== Introduction =====
  
-You can identify whether the software or OpenGL renderer is currently being used by calling ''IsOpenGL''.+You can detect whether the client is currently using the software renderer or the OpenGL renderer by calling the ''IsOpenGL'' function from ACSUtils.
  
 <note warning> <note warning>
Line 10: Line 10:
   * don't just check for ''vid_renderer'' and ''gl_nogl'' -- the user may be playing in ZDoom, which doesn't have the OpenGL renderer.    * don't just check for ''vid_renderer'' and ''gl_nogl'' -- the user may be playing in ZDoom, which doesn't have the OpenGL renderer. 
   * don't just use [[source_port_identification|IsGZDoom]] and assume that if the engine is GZDoom, the user is playing in OpenGL renderer.   * don't just use [[source_port_identification|IsGZDoom]] and assume that if the engine is GZDoom, the user is playing in OpenGL renderer.
-  * don't store the value of ''IsOpenGL'' in a variable -- the renderer can change mid-game. 
   * don't check the renderer serverside -- the server has no renderer.   * don't check the renderer serverside -- the server has no renderer.
 +
 +Nonetheless, many badly coded mods do a lot of the above and get incorrect results.
 </note> </note>
  
 ===== IsOpenGL ===== ===== IsOpenGL =====
  
-''bool IsOpenGL()'' -- returns true if the mod is being played in the OpenGL renederer, false if software renderer.+''bool IsOpenGL()'' -- returns true if the mod is being played in the OpenGL renederer, false if in software renderer
 + 
 +If called serverside, ''IsOpenGL'' logs an [[error]] and returns true, because the server can't identify a client's renderer remotely. The renderer is assumed to be OpenGL when called serverside because the OpenGL renderer has less restrictions. 
 + 
 +<note important> 
 +This function will return an incorrect value if ''vid_renderer'' or ''gl_nogl'' is changed mid-game because the renderer only actually switches after restart, but the values of the cvars change immediately.  
 +</note> 
 + 
 + 
 +===== How it works ===== 
 + 
 +This functions first calls [[client_server_detection|IsClient]] to see if it's running on a client (see above). 
 + 
 +If it's running on a client, it calls [[port_detection|IsGZDoom]] to check if the port is GZDoom or a derivative like Zandronum. If the port is not a GZDoom derivative, it can't have the OpenGL renderer, and this function returns false. This is to prevent detecting the OpenGL renderer when ZDoom is run with a config from GZDoom which has ''vid_renderer=1''.
  
 +If the port is confirmed to be a GZDoom derivative, this function checks for two CVars: ''vid_renderer'' and ''gl_nogl''. This function only returns true if ''vid_renderer'' is true and ''gl_nogl'' is false.