I made this function, but it not working and Im not too understand. Anybody know what is wrong?


*note: hDC is a variable placed at .data

PFD_DRAW_TO_BITMAP equ 8
PFD_MAIN_PLANE equ 0
PFD_TYPE_COLORINDEX equ 1
PFD_TYPE_RGBA equ 0
PFD_DOUBLEBUFFER equ 1
PFD_DRAW_TO_WINDOW equ 4
PFD_SUPPORT_OPENGL equ 020h

NewLayer proc l:dword,t:Dword
LOCAL mdc:Dword
LOCAL mbmp:dword

invoke CreateCompatibleDC,hDC
mov mdc,eax
invoke CreateCompatibleBitmap,hDC,l,t
mov mbmp,eax

invoke SelectObject,mdc,eax

mov edx,mdc
mov eax,mbmp


ret
NewLayer endp

CreateLayerOGL proc
LOCAL PF:PIXELFORMATDESCRIPTOR
LOCAL dDC,PFH,OpenDC:Dword

invoke NewLayer,600,600
mov dDC,eax

mov PF.nSize,sizeof PF
mov PF.nVersion,1
mov PF.dwFlags,PFD_DRAW_TO_WINDOW or PFD_SUPPORT_OPENGL or PFD_DOUBLEBUFFER
mov PF.dwLayerMask,PFD_MAIN_PLANE
mov PF.iPixelType,PFD_TYPE_RGBA
mov PF.cColorBits,8
mov PF.cDepthBits,16
mov PF.cAccumBits,0
mov PF.cStencilBits,0

invoke ChoosePixelFormat,dDC,addr PF
mov PFH,eax
invoke SetPixelFormat,dDC,PFH,addr PF
or eax,eax
jz error

invoke wglCreateContext,dDC
mov OpenDC,eax
invoke wglMakeCurrent,eax,dDC

mov edx,dDC
mov eax,OpenDC

ret
error:
invoke DeleteDC,dDC
xor eax,eax
dec eax
ret
CreateLayerOGL endp
Posted on 2005-08-16 21:50:36 by realvampire