def shader_substring(body, stack_frame=1):
    """
    Call this method from a function that defines a literal shader string as the "body" argument.
    Dresses up a shader string in two ways:
        1) Insert #line number declaration
        2) un-indents
    The line number information can help debug glsl compile errors.
    The unindenting allows you to type the shader code at a pleasing indent level
    in your python method, while still creating an unindented GLSL string at the end.
    """
    line_count = len(body.splitlines(True))
    line_number = inspect.stack()[stack_frame][2] + 1 - line_count
    return """\
#line %d
%s
""" % (line_number, textwrap.dedent(body))