golang / go

The Go programming language
https://go.dev
BSD 3-Clause "New" or "Revised" License
123.26k stars 17.57k forks source link

x/mobile: fix x/mobile/gl just like c opengl or go-gl #19777

Open fastfading opened 7 years ago

fastfading commented 7 years ago

Please answer these questions before submitting your issue. Thanks!

What version of Go are you using (go version)?

1.7

What operating system and processor architecture are you using (go env)?

mac os

What did you do?

migrate a program from pc to mobile go get -u github.com/go-gl/glfw/v3.2/glfw --> golang.org/x/mobile/app go get -u github.com/go-gl/gl/v2.1/gl --> golang.org/x/mobile/gl go get -u github.com/timshannon/go-openal/openal --> golang.org/x/mobile/exp/audio/al I wish to do the above change

What did you expect to see?

[golang.org/x/mobile/gl] act just like [github.com/go-gl/gl/v2.1/gl ]

What did you see instead?

There is lot of differences ,

//not implemented gl.TexImage1D gl.Begin(gl.TRIANGLE_STRIP) gl.End() gl.PushMatrix()
gl.PopMatrix() gl.MatrixMode(gl.PROJECTION) gl.TexCoord2f(1, 1) gl.Vertex2f(x2, y2) gl.Color4f(r, g, b, a) gl.LoadIdentity() gl.Ortho(0, float64(sys.scrrect[2]), 0, float64(sys.scrrect[3]), -1, 1) gl.Translated(0, float64(sys.scrrect[3]), 0)

//interface/behaviour change gl.GenTextures(1, &paltex) -->CreateTexture gl.DeleteTextures(1, &paltex) --> DeleteTexture

//unclear gl.Str(src) -->GetString(pname Enum) string ??? gl.DeleteObjectARB(fragObj) --> DeleteShader ???? gl.GetInfoLogARB -->GetProgramInfoLog| GetShaderInfoLog ????

strangebug commented 7 years ago

Hello,

The name of the package might be misleading, 'golang.org/x/mobile/gl' is built upon OpenGL ES 2.0 (w/ optional support for OpenGL 3.0) not the "desktop" OpenGL. OpenGL ES 2.0 dropped the support for the fixed pipeline so porting your code will a bit harder.

My two cents