Calling all you openGL gurus.. I'm trying to figure out how to copy the contents of the processing window into a GLTexture.
The reason I want to do this is to work around the issues regarding
GLGraphicOffScreen and partially transparent pixels, but now I'm hoping it can be a good experience to learn a little more about openGL too. I've tried a bunch of different things but have either had no luck, or have run into strange error messages that lead me to dead-end google searching..
Here's my simple sketch which exhibits the problem, but I don't know why it's not working.
// The image appears to be blank (transparent) instead of a copy of the main screen.
image(tex, 0, 0, 128, 128);
}
So, lines 23 - 28 are the important ones. I bind the texture, and then copy a 512x512 region into it.. Seems simple but the "tex" instance of GLTexture always seems to be blank (transparent) instead of containing a copy of what was just drawn..
Any help would be greatly appreciated, I've searched all over the forums and internet and am out of ideas..
I've been playing with a projector, trying to project from processing onto various surfaces (a cardboard box, for example). After looking around the forums I found the keystone library, but it has a big problem.. After adjusting the keystone rectangle to fit the cardboard box, the grid squares are not consistently sized. They are wider on one side of the projection than they are on the other. The result is that if you move a circle (or any other shape) across the keystoned region, it will slowly stretch horizontally. Not only does this look bad, but it makes any attempt to match the rendering with any real world features virtually impossible. For example, if I wanted to project onto a wall that had a grid painted on it, the projected grid wouldn't line up due to the horizontal stretching. Has anybody else noticed this problem? Is there an easy solution?
Additionally:
After lots more googling, I found a technique called homography which is a way to create a projection matrix which solves the same problem, but seems to work much better. The tool vvvv has a node that does this, and it works perfectly in my test setup. The problem is, my brain just doesn't work with patch-based tools so I'd like to stick with processing if at all possible. I looked around on the forum and it seems that the projection matrices for the rendering system aren't accessible (not that I know enough math to implement the homography solution anyway.. :| ).
So.. thoughs? ideas? While I'm obviously interested in a solution I'm also just hoping to spur some discussion on this topic since I couldn't find much about it on the forums so far.