func InitGL(width, height, msaa int, fullscreen bool) { C.SDL_Init(C.SDL_INIT_VIDEO) C.SDL_VideoInit( /*nil*/ C.SDL_GetVideoDriver(0)) C.SDL_GL_SetAttribute(C.SDL_GL_CONTEXT_MAJOR_VERSION, 3) C.SDL_GL_SetAttribute(C.SDL_GL_CONTEXT_MINOR_VERSION, 2) if msaa != 0 { C.SDL_GL_SetAttribute(C.SDL_GL_MULTISAMPLEBUFFERS, 1) C.SDL_GL_SetAttribute(C.SDL_GL_MULTISAMPLESAMPLES, C.int(msaa)) } C.SDL_GL_SetAttribute(C.SDL_GL_DEPTH_SIZE, 16) //win = C.SDL_CreateWindow(nil, C.SDL_WINDOWPOS_CENTERED, C.SDL_WINDOWPOS_CENTERED,C.int(width), C.int(height), C.SDL_WINDOW_OPENGL) if fullscreen { win = C.SDL_CreateWindow(nil, C.SDL_WINDOWPOS_CENTERED, C.SDL_WINDOWPOS_CENTERED, C.int(width), C.int(height), C.SDL_WINDOW_OPENGL|C.SDL_WINDOW_FULLSCREEN_DESKTOP) } else { win = C.SDL_CreateWindow(nil, C.SDL_WINDOWPOS_CENTERED, C.SDL_WINDOWPOS_CENTERED, C.int(width), C.int(height), C.SDL_WINDOW_OPENGL) } C.SDL_ShowWindow(win) wat := C.SDL_GL_CreateContext(win) fmt.Println(C.GoString(C.SDL_GetVideoDriver(0))) C.SDL_GL_MakeCurrent(win, wat) //C.SDL_GL_SetSwapInterval(1) C.glEnable(C.GL_DEPTH_TEST) C.glDepthFunc(C.GL_LEQUAL) C.glClearColor(0.3, 0.5, 1, 0) C.glClear(C.GL_COLOR_BUFFER_BIT | C.GL_DEPTH_BUFFER_BIT) printerr("failed to initialize openGL") }
func (window *Window) Show() { _window := (*C.SDL_Window)(unsafe.Pointer(window)) C.SDL_ShowWindow(_window) }
func (win *Window) Show() { C.SDL_ShowWindow(win.c) }
// Window (https://wiki.libsdl.org/SDL_ShowWindow) func (window *Window) Show() { C.SDL_ShowWindow(window.cptr()) }
func (w *Window) Show() { C.SDL_ShowWindow(w.win) }