Please expose hdc value of gl graphics driver

BlitzMax Forums/BlitzMax Programming/Please expose hdc value of gl graphics driver

JoshK(Posted 2009) [#1]
Please expose the hdc and hwnd values. I could do it myself, but then all BMX users would need a modify glgraphics module.


N(Posted 2009) [#2]
You should be able to get the hwnd and such by wrapping a call to Graphics(), e.g.,

?Win32

Const HDC_OFF% = 7
Const HWND_OFF% = 8
Const HGLRC_OFF% = 9

Function InitGraphics:TGraphics( width%, height%, depth%=0, hertz%=60, flags%=0 )
	Local gfx:TGLGraphics=TGLGraphics(GLGraphics(width, height, depth, hertz, flags))
	Local data:Int Ptr = Int Ptr(gfx._context)
	Print "HDC: "+data[HDC_OFF]
	Print "HWND: "+data[HWND_OFF]
	Return gfx
End Function

?

Bearing in mind that this is untested since I'm not under Windows. Either way, work-arounds will have to do, since there likely will not be direct access to it, since the point is to keep that all abstracted away from the user.

It may be worth it to simply write your own TGraphics/TGraphicsDriver types instead. It's not very complex, just takes a bit more time.


Flemmonk(Posted 2009) [#3]
I dont get it...
The hdc and hwnd values are exposed already. TGLGraphics has a field called _context, which is a C Structure containing the hwnd and hdc.