浏览代码

rlLoadShaderCode - set ShaderId variables to RLGL.State.default[VF]ShaderId if repesctive Code is NULL (#2281)

pull/2285/head
Matthew Owens 3 年前
committed by GitHub
父节点
当前提交
e621efe79f
找不到此签名对应的密钥 GPG 密钥 ID: 4AEE18F83AFDEB23
共有 1 个文件被更改,包括 10 次插入2 次删除
  1. +10
    -2
      src/rlgl.h

+ 10
- 2
src/rlgl.h 查看文件

@ -3544,8 +3544,16 @@ unsigned int rlLoadShaderCode(const char *vsCode, const char *fsCode)
unsigned int vertexShaderId = 0;
unsigned int fragmentShaderId = 0;
if (vsCode != NULL) vertexShaderId = rlCompileShader(vsCode, GL_VERTEX_SHADER);
if (fsCode != NULL) fragmentShaderId = rlCompileShader(fsCode, GL_FRAGMENT_SHADER);
if (vsCode != NULL) {
vertexShaderId = rlCompileShader(vsCode, GL_VERTEX_SHADER);
} else {
vertexShaderId = RLGL.State.defaultVShaderId;
}
if (fsCode != NULL) {
fragmentShaderId = rlCompileShader(fsCode, GL_FRAGMENT_SHADER);
} else {
fragmentShaderId = RLGL.State.defaultFShaderId;
}
// Load shader program if provided vertex/fragment shaders compile successfully
if ((vertexShaderId != 0) && (fragmentShaderId != 0)) id = rlLoadShaderProgram(vertexShaderId, fragmentShaderId);

正在加载...
取消
保存