I’m struggling to debug a subtle rendering issue in my game and could use some advice. The symptom of the problem is rect, sprite, text, and mesh:draw are visible only when another mesh:draw call is called. In my program I can narrow down the draw call to a particular mesh which looks like this (psuedo-code):
function draw()
background()
...
pushMatrix()
translate(z = 0.8)
mesh:draw() -- removing this causes all subsequent `rect`, `text`, and `sprite` calls to be invisible
rect()
popMatrix()
...
pushMatrix()
translate(z = 1.0)
rect() -- also invisible
popMatrix()
...
end
Investigation so far:
Immediate suspicions are something to do with depth testing; however, after significant investigation, this does not seem to be the case. There seems to be a subtle interaction between the mesh draw call and the others.
All mesh shaders use the standard modelViewProjection * position computation in the vertex shader, which should include the z transform.
The projection matrix is altered occasionally during draw but not for the problematic mesh draw call.
One can assume the vertices of the meshes and other calls are correctly specified.
All [push|pop]Matrix calls have been checked for matching pairs.
Not all draw calls are affected however affected draw calls are consistency affected.
I have hit similar issues with other meshes.
Are there any peculiarities regarding drawing meshes with depth testing that I should know about?
@alteous - thanks for that, just noticed something similar in development version with text() but I am pretty sure it’s just my coding. Taking a lot of digging to home into problem cause.
@alteous I wouldn’t look past it being our bug, it’s unfortunate that we don’t still support iOS 9 so we can see if it’s limited to that version of Codea.
I can offer to run your full project and comment / uncomment the offending line to see how it goes (and if the bug still exists, put it through the debugger on my end to see if it’s a problem in the engine).
@alteous Here’s an image of what I see with your code. It’s the same with the slider set to true or false. I’m on the latest everything. Codea 2.6.3 (136) ios 12.1.1 using an iPad Air.
The left/right image shows the output with bug_here = true/false. Both images are expected to have a white rectangle and a yellow rectangle outline. The yellow outline may have only three sides visible; that is expected and not noteworthy.
Note that the yellow rectangle appears if empty_mesh uses the default shader or if it is not drawn.
Hey @alteous have you checked to see if you are calling Background() because if you are there reason it may be showing up is because it is getting erased by the background function.
@pac What @Bri_G meant was he’s running the same Codea and iOS versions as I am. We are not the same person if that’s what you think. @Bri_G and I are seperated by about 3600 miles. @pac, we are seperated by about 800 miles.