Both sides previous revisionPrevious revisionNext revision | Previous revisionLast revisionBoth sides next revision |
renderer_identification [2019/08/26 03:45] – [IsOpenGL] korshun | renderer_identification [2019/08/26 03:53] – korshun |
---|
====== Renderer identification ====== | ====== Renderer detect ====== |
| |
===== Introduction ===== | ===== Introduction ===== |
| |
You can identify whether the software or OpenGL renderer is currently being used by using the ''IsOpenGL'' function from ACSUtils. | 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> |
''bool IsOpenGL()'' -- returns true if the mod is being played in the OpenGL renederer, false if in 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. | 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> | <note important> |
===== How it works ===== | ===== How it works ===== |
| |
First, ''IsOpenGL'' checks if it's running serverside (see above). | This functions first calls [[client_server_detection|IsClient]] to see if it's running on a client (see above). |
| |
Then ''IsOpenGL'' calls [[renderer_identification|IsZDoom]] to check if it's running in ZDoom. Since ZDoom doesn't have an OpenGL renderer, the renderer is assumed to be software in this case. | 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''. |
| |
Then, ''IsOpenGL'' checks ''gl_nogl'' -- a CVar that lets the user to disable the OpenGL renderer in GZDoom and Zandronum. If it's set, the renderer is assumed to be software. | 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. |
| |
And only then ''IsOpenGL'' checks ''vid_renderer''. If its value is not 0, the renderer is assumed to be OpenGL. | |
| |
| |