Ejemplo n.º 1
0
// util function
void VR_OVR_InitShader(r_ovr_shader_t *shader, r_shaderobject_t *object)
{
	GLint texloc;
	if (!object->program)
		R_CompileShaderFromFiles(object);

	shader->shader = object;
	glUseProgram(shader->shader->program);
	shader->uniform.EyeToSourceUVOffset = glGetUniformLocation(shader->shader->program,"EyeToSourceUVOffset");
	shader->uniform.EyeToSourceUVScale = glGetUniformLocation(shader->shader->program,"EyeToSourceUVScale");
	shader->uniform.EyeRotationStart = glGetUniformLocation(shader->shader->program,"EyeRotationStart");
	shader->uniform.EyeRotationEnd = glGetUniformLocation(shader->shader->program,"EyeRotationEnd");

	shader->uniform.OverdriveScales = glGetUniformLocation(shader->shader->program,"OverdriveScales");
	shader->uniform.VignetteFade = glGetUniformLocation(shader->shader->program,"VignetteFade");
	shader->uniform.InverseResolution = glGetUniformLocation(shader->shader->program,"InverseResolution");
	shader->uniform.Desaturate = glGetUniformLocation(shader->shader->program,"Desaturate");

	texloc = glGetUniformLocation(shader->shader->program,"currentFrame");
	glUniform1i(texloc,0);
	shader->uniform.currentFrame = texloc;

	texloc = glGetUniformLocation(shader->shader->program,"lastFrame");
	glUniform1i(texloc,1);
	shader->uniform.lastFrame = texloc;

	glUseProgram(0);
}
Ejemplo n.º 2
0
// util function
void R_VR_InitDistortionShader(vr_distort_shader_t *shader, r_shaderobject_t *object)
{
	if (!object->program)
		R_CompileShaderFromFiles(object);

	shader->shader = object;
	glUseProgram(shader->shader->program);
	shader->uniform.texture = glGetUniformLocation(shader->shader->program, "tex");
	shader->uniform.distortion = glGetUniformLocation(shader->shader->program, "dist");
	shader->uniform.texture_size = glGetUniformLocation(shader->shader->program, "textureSize");
	glUseProgram(0);
}