Merge branch 'master' of github.com:tito/kivy

This commit is contained in:
Christopher Denter 2011-01-30 15:00:37 +01:00
commit 15eee8a72b
2 changed files with 10 additions and 3 deletions

View File

@ -19,6 +19,7 @@ cdef class Shader:
cdef int get_uniform_loc(self, str name)
cdef void bind_attrib_locations(self)
cdef void build(self)
cdef int is_linked(self)
cdef GLuint compile_shader(self, char* source, shadertype)
cdef str get_shader_log(self, shader)
cdef str get_program_log(self, shader)

View File

@ -158,6 +158,13 @@ cdef class Shader:
glLinkProgram(self.program)
self.uniform_locations = dict()
self.process_build_log()
if not self.is_linked():
raise Exception('Shader didnt link, check info log.')
cdef int is_linked(self):
cdef GLint result
glGetProgramiv(self.program, GL_LINK_STATUS, &result)
return 1 if result == GL_TRUE else 0
cdef GLuint compile_shader(self, char* source, shadertype):
shader = glCreateShader(shadertype)
@ -191,8 +198,7 @@ cdef class Shader:
cdef void process_message(self, str ctype, str message):
message = message.strip()
if message and message != 'Success.':
Logger.error('Shader: %s: <%s>' % (ctype, message))
raise Exception(message)
Logger.info('Shader: %s: <%s>' % (ctype, message))
else:
Logger.debug('Shader: %s compiled successfully' % ctype)
Logger.info('Shader: %s compiled successfully' % ctype)