August 17, 2010 Leave a comment
Well, I was kind of distraught in my last few posts. I didn’t know what I was doing differently from some of the things other people were doing. The code was almost exactly the same (minus obviously different variable names). I found out later, after taking apart Processing.js and reducing it to less than 4000 lines (it’s currently sitting at 11000+ lines), that the problem was not the way I coded the 3D texture. The problem was the way we were redrawing 3D objects without a call to the background function. Or at least, if we didn’t call background in the redraw loop. I ended up changing my examples to working ones by adding background to the redraw loop.
After I did that, I made sure to make a ticket to fix the background redraw problem. Andor said he’d fix it, so I assigned it to him. It made it to the repository easily enough as the fix was one line but I’ve yet to test it with my work. I have been working on other things to make it for the 0.9.7 release. Hopefully, I can test out the examples soon though.
The other function I was working on was textMode. One particular function of textMode, the default, was already implemented. The other use of the function was something that I didn’t fully understand and needed the use of the beginRaw function that we will not put in until later. This textMode function was the reason I was looking at createGraphics again. The functionality I was working on was the textMode(SCREEN) parameter. This is basically a heads-up display (HUD). It writes the text you want on screen and removes / disallows any transformation changes affecting objects in the scene. So, it becomes written to the screen and unchangeable through transformation like a heads-up display in video games.
To get this working, I used another Processing instance (which is what createGraphics was for) and rendered the text there. I, then, textured that Processing instance/canvas onto a quad according to the coordinates given. I made sure that the quad wasn’t affected by transformation calls through pushMatrix and popMatrix functions. I did find a problem when using a white fill on a transparent background and filed a ticket for it.