mirror of
https://github.com/Dadido3/noita-mapcap.git
synced 2024-11-22 21:17:33 +00:00
Add error handling to glReadPixels
This commit is contained in:
parent
1d83b0dfa0
commit
1936dc100c
@ -132,8 +132,6 @@ ProcedureDLL Capture(*capRect.RECT, x.l, y.l, sx.l, sy.l)
|
|||||||
ProcedureReturn #False
|
ProcedureReturn #False
|
||||||
EndIf
|
EndIf
|
||||||
|
|
||||||
;Protected *pixelBuf = AllocateMemory(3 * width * height)
|
|
||||||
|
|
||||||
hDC = StartDrawing(ImageOutput(imageID))
|
hDC = StartDrawing(ImageOutput(imageID))
|
||||||
If Not hDC
|
If Not hDC
|
||||||
FreeImage(imageID)
|
FreeImage(imageID)
|
||||||
@ -142,19 +140,11 @@ ProcedureDLL Capture(*capRect.RECT, x.l, y.l, sx.l, sy.l)
|
|||||||
|
|
||||||
*pixelBuffer = DrawingBuffer()
|
*pixelBuffer = DrawingBuffer()
|
||||||
glReadPixels_(*capRect\left, *capRect\top, capWidth, capHeight, #GL_BGR_EXT, #GL_UNSIGNED_BYTE, *pixelBuffer)
|
glReadPixels_(*capRect\left, *capRect\top, capWidth, capHeight, #GL_BGR_EXT, #GL_UNSIGNED_BYTE, *pixelBuffer)
|
||||||
|
If glGetError_() <> #GL_NO_ERROR
|
||||||
; For y = 0 To *capRect\height - 1
|
StopDrawing()
|
||||||
; *Line.Pixel = Buffer + Pitch * y
|
FreeImage(imageID)
|
||||||
;
|
ProcedureReturn #False
|
||||||
; For x = 0 To *capRect\width - 1
|
EndIf
|
||||||
;
|
|
||||||
; *Line\Pixel = ColorTable(pos2) ; Write the pixel directly to the memory !
|
|
||||||
; *Line+Offset
|
|
||||||
;
|
|
||||||
; ; You can try with regular plot to see the speed difference
|
|
||||||
; ; Plot(x, y, ColorTable(pos2))
|
|
||||||
; Next
|
|
||||||
; Next
|
|
||||||
|
|
||||||
StopDrawing()
|
StopDrawing()
|
||||||
|
|
||||||
@ -188,8 +178,8 @@ EndProcedure
|
|||||||
|
|
||||||
; IDE Options = PureBasic 6.04 LTS (Windows - x64)
|
; IDE Options = PureBasic 6.04 LTS (Windows - x64)
|
||||||
; ExecutableFormat = Shared dll
|
; ExecutableFormat = Shared dll
|
||||||
; CursorPosition = 116
|
; CursorPosition = 99
|
||||||
; FirstLine = 99
|
; FirstLine = 72
|
||||||
; Folding = -
|
; Folding = -
|
||||||
; Optimizer
|
; Optimizer
|
||||||
; EnableThread
|
; EnableThread
|
||||||
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user