go-gl / mathgl

A pure Go 3D math library.
BSD 3-Clause "New" or "Revised" License
554 stars 65 forks source link

Fix use of deprecated GLSL functions. #19

Closed dmitshur closed 10 years ago

dmitshur commented 10 years ago

As far as I understand, texture2D has been deprecated as of OpenGL 3.0 and texture should be used instead.

Fixes the following issue:

$ ./tutorial05 
2014/06/14 16:17:40 vert shader compilation status: 0
2014/06/14 16:17:40 Info log: ERROR: 0:15: Call to undeclared function 'texture2D'
2014/06/14 16:17:40 Problem creating shader?
panic: Problem creating shader?

goroutine 1 [running]:
runtime.panic(0x40ff700, 0xc21000a2f0)
    /usr/local/go/src/pkg/runtime/panic.c:266 +0xb6
log.Panic(0x44d65b8, 0x1, 0x1)
    /usr/local/go/src/pkg/log/log.go:307 +0xac
github.com/go-gl/glh.MakeShader(0x8b30, 0xc21001f140, 0x13f, 0x200000001)
    /Users/Dmitri/Dropbox/Work/2013/GoLanding/src/github.com/go-gl/glh/shader.go:56 +0x377
github.com/go-gl/glh.Shader.Compile(0x8b30, 0xc21001f140, 0x13f, 0x2)
    /Users/Dmitri/Dropbox/Work/2013/GoLanding/src/github.com/go-gl/glh/shader.go:19 +0x36
github.com/go-gl/glh.NewProgram(0x44d6858, 0x2, 0x2, 0xc21001f140)
    /Users/Dmitri/Dropbox/Work/2013/GoLanding/src/github.com/go-gl/glh/shader.go:25 +0xc0
github.com/go-gl/mathgl/examples/opengl-tutorial/helper.MakeProgram(0x4189950, 0x22, 0x41898d0, 0x24, 0x0)
    /Users/Dmitri/Dropbox/Work/2013/GoLand/src/github.com/go-gl/mathgl/examples/opengl-tutorial/helper/helper.go:31 +0x24c
main.main()
    /Users/Dmitri/Dropbox/Work/2013/GoLand/src/github.com/go-gl/mathgl/examples/opengl-tutorial/tutorial05/main.go:54 +0x3e7

goroutine 3 [syscall]:
runtime.goexit()
    /usr/local/go/src/pkg/runtime/proc.c:1394

I am less confident about this change, so please review.

der-antikeks commented 10 years ago

At least in 3.3 it was marked as deprecated. See page 99 of 3.30 GLSL specification.