|
FS2_Open
Open source remastering of the Freespace 2 engine
|
#include "cmdline/cmdline.h"#include "globalincs/def_files.h"#include "graphics/2d.h"#include "graphics/grinternal.h"#include "graphics/gropengldraw.h"#include "graphics/gropenglextension.h"#include "graphics/gropengllight.h"#include "graphics/gropenglpostprocessing.h"#include "graphics/gropenglshader.h"#include "graphics/gropenglstate.h"#include "graphics/gropengltexture.h"#include "graphics/gropengltnl.h"#include "lighting/lighting.h"#include "math/vecmat.h"#include "mod_table/mod_table.h"#include "render/3d.h"Go to the source code of this file.
Variables | |
| SCP_vector< opengl_shader_t > | GL_shader |
| GLuint | Framebuffer_fallback_texture_id = 0 |
| geometry_sdr_params * | Current_geo_sdr_params = NULL |
| opengl_shader_t * | Current_shader = NULL |
| int gr_opengl_maybe_create_shader | ( | shader_type | shader_t, |
| unsigned int | flags | ||
| ) |
Given a set of flags, determine whether a shader with these flags exists within the GL_shader vector. If no shader with the requested flags exists, attempt to compile one.
| shader_t | shader_type variable, a reference to the shader program needed |
| flags | Integer variable, holding a combination of SDR_* flags |
Definition at line 229 of file gropenglshader.cpp.
Sets the currently active animated effect.
| effect | Effect ID, needs to be implemented and checked for in the shader |
| timer | Timer value to be passed to the shader |
Definition at line 876 of file gropenglshader.cpp.
| int opengl_compile_shader | ( | shader_type | sdr, |
| uint | flags | ||
| ) |
Compiles a new shader, and creates an opengl_shader_t that will be put into the GL_shader vector if compilation is successful.
| sdr | Identifier defined with the program we wish to compile |
| flags | Combination of SDR_* flags |
Definition at line 372 of file gropenglshader.cpp.
Definition at line 247 of file gropenglshader.cpp.
| void opengl_shader_check_info_log | ( | GLhandleARB | shader_object | ) |
Retrieve the compilation log for a given shader object, and store it in the GLshader_info_log global variable
| shader_object | OpenGL handle of a shader object |
Definition at line 526 of file gropenglshader.cpp.
| void opengl_shader_compile_deferred_light_shader | ( | ) |
Compile the deferred light shader.
Definition at line 903 of file gropenglshader.cpp.
| GLhandleARB opengl_shader_compile_object | ( | const SCP_vector< SCP_string > & | shader_source, |
| GLenum | shader_type | ||
| ) |
Pass a GLSL shader source to OpenGL and compile it into a usable shader object. Prints compilation errors (if any) to the log. Note that this will only compile shaders into objects, linking them into executables happens later
| shader_source | GLSL sourcecode for the shader |
| shader_type | OpenGL ID for the type of shader being used, like GL_FRAGMENT_SHADER_ARB, GL_VERTEX_SHADER_ARB |
Definition at line 546 of file gropenglshader.cpp.
| GLhandleARB opengl_shader_create | ( | const SCP_vector< SCP_string > & | vs, |
| const SCP_vector< SCP_string > & | fs, | ||
| const SCP_vector< SCP_string > & | gs | ||
| ) |
Creates an executable shader.
| vs | Vertex shader source code |
| fs | Fragment shader source code |
| gs | Geometry shader source code |
Definition at line 663 of file gropenglshader.cpp.
| int opengl_shader_get_animated_effect | ( | ) |
Returns the currently active animated effect ID.
Definition at line 887 of file gropenglshader.cpp.
| float opengl_shader_get_animated_timer | ( | ) |
Get the timer for animated effects.
Definition at line 895 of file gropenglshader.cpp.
| GLint opengl_shader_get_attribute | ( | const char * | attribute_text | ) |
Get the internal OpenGL location for a given attribute. Requires that the Current_shader global variable is valid
| attribute_text | Name of the attribute |
Definition at line 750 of file gropenglshader.cpp.
| GLint opengl_shader_get_uniform | ( | const char * | uniform_text | ) |
Get the internal OpenGL location for a given uniform. Requires that the Current_shader global variable is valid
| uniform_text | Name of the uniform |
Definition at line 799 of file gropenglshader.cpp.
| GLint opengl_shader_get_uniform_block | ( | const char * | uniform_text | ) |
Get the internal OpenGL location for a given uniform. Requires that the Current_shader global variable is valid
| uniform_text | Name of the uniform |
Definition at line 852 of file gropenglshader.cpp.
| void opengl_shader_init | ( | ) |
Initializes the shader system. Creates a 1x1 texture that can be used as a fallback texture when framebuffer support is missing. Also compiles the shaders used for particle rendering.
Definition at line 487 of file gropenglshader.cpp.
| void opengl_shader_init_attribute | ( | const char * | attribute_text | ) |
Initialize a shader attribute. Requires that the Current_shader global variable is valid.
| attribute_text | Name of the attribute to be initialized |
Definition at line 724 of file gropenglshader.cpp.
| void opengl_shader_init_uniform | ( | const char * | uniform_text | ) |
Initialize a shader uniform. Requires that the Current_shader global variable is valid.
| uniform_text | Name of the uniform to be initialized |
Definition at line 773 of file gropenglshader.cpp.
| void opengl_shader_init_uniform_block | ( | const char * | uniform_text | ) |
Initialize a shader uniform. Requires that the Current_shader global variable is valid.
| uniform_text | Name of the uniform to be initialized |
Definition at line 823 of file gropenglshader.cpp.
| GLhandleARB opengl_shader_link_object | ( | GLhandleARB | vertex_object, |
| GLhandleARB | fragment_object, | ||
| GLhandleARB | geometry_object | ||
| ) |
Link vertex shader, fragment shader and geometry shader objects into a usable shader executable.
Prints linker errors (if any) to the log.
| vertex_object | Compiled vertex shader object |
| fragment_object | Compiled fragment shader object |
| geometry_object | Compiled geometry shader object |
Definition at line 599 of file gropenglshader.cpp.
| void opengl_shader_set_current | ( | opengl_shader_t * | shader_obj | ) |
Set the currently active shader
| shader_obj | Pointer to an opengl_shader_t object. This function calls glUseProgramARB with parameter 0 if shader_obj is NULL or if function is called without parameters, causing OpenGL to revert to fixed-function processing |
Definition at line 180 of file gropenglshader.cpp.
Definition at line 214 of file gropenglshader.cpp.
| void opengl_shader_shutdown | ( | ) |
Go through GL_shader and call glDeleteObject() for all created shaders, then clear GL_shader
Definition at line 269 of file gropenglshader.cpp.
| geometry_sdr_params* Current_geo_sdr_params = NULL |
Definition at line 37 of file gropenglshader.cpp.
| opengl_shader_t* Current_shader = NULL |
Definition at line 170 of file gropenglshader.cpp.
| GLuint Framebuffer_fallback_texture_id = 0 |
Definition at line 32 of file gropenglshader.cpp.
| SCP_vector<opengl_shader_t> GL_shader |
Definition at line 28 of file gropenglshader.cpp.