clean up gl

pull/362/head
Alexander Medvednikov 2019-06-22 21:27:59 +02:00
parent f831fd62f2
commit d3e7738a5f
4 changed files with 9 additions and 48 deletions

25
gl/gl.v
View File

@ -1,8 +1,5 @@
module gl module gl
// #define STB_IMAGE_IMPLEMENTATION
// #include <stb_image.h>
// ///////
import const ( import const (
GL_TEXTURE_2D GL_TEXTURE_2D
GL_TEXTURE0 GL_TEXTURE0
@ -12,27 +9,23 @@ import const (
GL_DEPTH_TEST GL_DEPTH_TEST
) )
/* #include <Cocoa/Cocoa.h>
type Vec3 { #include <CoreGraphics/CoreGraphics.h>
x float #include "glad.h"
y float #include "glad.c"
z float fn init_glad() {
ok := C.gladLoadGL()
if !ok {
os.exit('Failed to initialize glad OpenGL context')
}
} }
type Vec2 {
x int
y int
}
*/
pub fn viewport(a int, b int, c int, d int) { pub fn viewport(a int, b int, c int, d int) {
C.glViewport(a, b, c, d) C.glViewport(a, b, c, d)
} }
pub fn clear_color(r, g, b, a int) { pub fn clear_color(r, g, b, a int) {
# glClearColor(((float)r)/255.0,((float)g)/255.0,b/255.0, a/255.0); # glClearColor(((float)r)/255.0,((float)g)/255.0,b/255.0, a/255.0);
// println('CLEAR COLOR')
// #glClearColor(0.3f, 0.9f, 0.32f, 1.0f);
// C.glClearColor(r, g, b, a)
} }
pub fn clear() { pub fn clear() {

View File

@ -1,7 +1,5 @@
module gl module gl
// #include <OpenGL/gl.h>
// #flag -framework OpenGL
#include "glad.h" #include "glad.h"
#include "glad.c" #include "glad.c"
fn init_glad() { fn init_glad() {

View File

@ -1,18 +0,0 @@
module gl
#include <Cocoa/Cocoa.h>
#include <CoreGraphics/CoreGraphics.h>
// #include <OpenGL/gl.h>
// #flag -framework OpenGL
#include "/Users/alex/code/lang/gl/glad.h"
#include "/Users/alex/code/lang/gl/glad.c"
fn init_glad() {
println('init_glad() win')
ok := C.gladLoadGL()
// # ok= gladLoadGLLoader((GLADloadproc) glfwGetProcAddress);
if !ok {
os.exit('Failed to initialize glad OpenGL context')
}
// # printf("glClear ADDR=%p\n", glClear);
}

View File

@ -1,12 +0,0 @@
module gl
fn init_glad() {
println('init_glad() win')
ok := false
# ok= gladLoadGLLoader((GLADloadproc) glfwGetProcAddress);
if !ok {
os.exit('Failed to initialize glad OpenGL context')
}
# printf("glClear ADDR=%p\n", glClear);
}