/
opengl.go
42 lines (29 loc) · 853 Bytes
/
opengl.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package allegro
/*
#cgo pkg-config: allegro-5.0
#include <allegro5/allegro.h>
#include <allegro5/allegro_opengl.h>
*/
import "C"
// We don't return a gl.GLuint as I don't want to add the full gl package
// as a dependency. If you need this, cast it. Otherwise, ignore
func (b *Bitmap) GetGLTexture() uint32 {
var tex uint32
tex = uint32(C.al_get_opengl_texture((*C.ALLEGRO_BITMAP)(b)))
return tex
}
func (b *Bitmap) GetGLTextureSize() (int, int) {
var w, h C.int
C.al_get_opengl_texture_size((*C.ALLEGRO_BITMAP)(b), &w, &h)
return int(w), int(h)
}
func (b *Bitmap) GetGLTexturePosition() (int, int) {
var x, y C.int
C.al_get_opengl_texture_position((*C.ALLEGRO_BITMAP)(b), &x, &y)
return int(x), int(y)
}
func (b *Bitmap) GetGLFBO() uint32 {
var fbo uint32
fbo = uint32(C.al_get_opengl_fbo((*C.ALLEGRO_BITMAP)(b)))
return fbo
}