Browse Source

util: check for frag/vertShader=0 before attaching

tags/mesa_7_3_rc1
Brian Paul 16 years ago
parent
commit
637f06dcdc
1 changed files with 7 additions and 2 deletions
  1. 7
    2
      progs/util/shaderutil.c

+ 7
- 2
progs/util/shaderutil.c View File

@@ -6,6 +6,7 @@
*/


#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <GL/glut.h>
@@ -106,8 +107,12 @@ LinkShaders(GLuint vertShader, GLuint fragShader)
{
GLuint program = glCreateProgram_func();

glAttachShader_func(program, fragShader);
glAttachShader_func(program, vertShader);
assert(vertShader || fragShader);

if (fragShader)
glAttachShader_func(program, fragShader);
if (vertShader)
glAttachShader_func(program, vertShader);
glLinkProgram_func(program);

/* check link */

Loading…
Cancel
Save