Disable error checking inside glBegin … glEnd
This commit is contained in:
parent
9dfcb45c0c
commit
2319321b04
1 changed files with 11 additions and 3 deletions
|
|
@ -306,7 +306,9 @@ const
|
||||||
## and ``enableAutoGlErrorCheck(bool)`` will have no effect when
|
## and ``enableAutoGlErrorCheck(bool)`` will have no effect when
|
||||||
## ``noAutoGlErrorCheck`` is defined.
|
## ``noAutoGlErrorCheck`` is defined.
|
||||||
|
|
||||||
var gAutoGlErrorCheck = true
|
var
|
||||||
|
gAutoGlErrorCheck = true
|
||||||
|
gInsideBeginEnd* = false # do not change manually.
|
||||||
|
|
||||||
proc enableAutoGlErrorCheck*(yes: bool) =
|
proc enableAutoGlErrorCheck*(yes: bool) =
|
||||||
## This determines (at run time) whether an exception should be raised if an
|
## This determines (at run time) whether an exception should be raised if an
|
||||||
|
|
@ -327,7 +329,8 @@ macro wrapErrorChecking(f: stmt): stmt =
|
||||||
ident"importc" , newLit($child.name))
|
ident"importc" , newLit($child.name))
|
||||||
).add(ident"ogl")
|
).add(ident"ogl")
|
||||||
|
|
||||||
glProc.name = ident($glProc.name & "Impl")
|
let rawGlProName = $glProc.name
|
||||||
|
glProc.name = ident(rawGlProName & "Impl")
|
||||||
var
|
var
|
||||||
body = newStmtList glProc
|
body = newStmtList glProc
|
||||||
returnsSomething = child.params[0].kind != nnkEmpty
|
returnsSomething = child.params[0].kind != nnkEmpty
|
||||||
|
|
@ -341,9 +344,14 @@ macro wrapErrorChecking(f: stmt): stmt =
|
||||||
else:
|
else:
|
||||||
glCall
|
glCall
|
||||||
|
|
||||||
|
if rawGlProName == "glBegin":
|
||||||
|
body.add newAssignment(ident"gInsideBeginEnd", ident"true")
|
||||||
|
if rawGlProName == "glEnd":
|
||||||
|
body.add newAssignment(ident"gInsideBeginEnd", ident"false")
|
||||||
|
|
||||||
template errCheck: stmt =
|
template errCheck: stmt =
|
||||||
when not (NoAutoGlErrorCheck):
|
when not (NoAutoGlErrorCheck):
|
||||||
if gAutoGlErrorCheck:
|
if gAutoGlErrorCheck and not gInsideBeginEnd:
|
||||||
checkGlError()
|
checkGlError()
|
||||||
|
|
||||||
body.add getAst(errCheck())
|
body.add getAst(errCheck())
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue