func CreateContext(win window.Window) { dpy := win.GetHDC() xData := (*XWinData)(dpy) if xData == nil { //TODO: Handle error somehow ??? return } //attr := make([]C.int,) /* attr := []C.int{ C.GLX_RGBA, C.GLX_DEPTH_SIZE, 24, C.GLX_DOUBLEBUFFER, C.None, } */ //vi := C.glXChooseVisual(xData.dpy, 0, (*C.int)(unsafe.Pointer(&attr))); vi := C.Test(xData.dpy) tmpContext := C.glXCreateContext(xData.dpy, vi, nil, C.GL_TRUE) err := C.glGetError() if err != C.GL_NO_ERROR { fmt.Println("Error") } C.glXMakeCurrent(xData.dpy, (C.GLXDrawable)(xData.win), tmpContext) C.glewInit() /* C.glXMakeCurrent(xData.dpy) C.glewInit() var context C.HGLRC if C.wglewIsSupported(C.CString("WGL_ARB_create_context")) == 1 { //TODO: Figure out how to send attr to c func so it works!!! context = C.openglCreateContextAttribsARB(*(*C.HDC)(hdc), nil) C.wglMakeCurrent(nil, nil) C.wglDeleteContext(tmpContext) C.wglMakeCurrent(*(*C.HDC)(hdc), context) } */ return }
func Test(s1 string, s2 string) { C.Test(C.CString(s1), C.CString(s2)) }