Here are the result: for Linux and Windows x86 ~11MB zip file (~28MB extracted) source code included.
Download: PureOpenGLDemo.zip
Wold be cool if someone can test it on 64 bit Linux/Windows too.
Thank you
DJ.
PureBasiuc Gtk window as OpenGL render target:
Code: Select all
*X11Display = gdk_x11_get_default_xdisplay_()
hWin = OpenWindow(id, x,y,w,h,title,flags)
If id=#PB_Any
id=hWin
EndIf
hWin=WindowID(id)
; a missing flush / sync command or something else on my linux box need this wait
Repeat : Delay(100) : Until IsWindow(id)<>0
Protected *Widget.GtkWidget = hWin
Protected *win = *Widget\Window
; X11 window from Gtk window
X11Win = gdk_x11_drawable_get_xid_(*win)
*vi = glXChooseVisual(*X11Display, 0, @attr(0))
hRC = glXCreateContext(*X11Display, *vi, 0,#GL_TRUE)
glXMakeCurrent(*X11Display,X11Win,hRC)
Code: Select all
Protected pfd.PIXELFORMATDESCRIPTOR
Protected pf.l
hWin = OpenWindow(id, x,y,w,h,title,flags)
If id=#PB_Any
id=hWin
EndIf
hWin=WindowID(id)
hDC = GetDC_(hWin)
pfd\nSize = SizeOf(PIXELFORMATDESCRIPTOR)
pfd\nVersion = 1
pfd\dwFlags = #PFD_SUPPORT_OPENGL | #PFD_DOUBLEBUFFER | #PFD_DRAW_TO_WINDOW
pfd\dwLayerMask = #PFD_MAIN_PLANE
pfd\iPixelType = #PFD_TYPE_RGBA
pfd\cColorBits = 24
pfd\cDepthBits = 16
pf = ChoosePixelFormat_(hDC,pfd)
SetPixelFormat_(hDC, pf, pfd)
hRC = wglCreateContext_(hDC)
wglMakeCurrent_(hDC,hRC)