I would like to animate something inside a PGraphics (with a transparent background) but I don't find any way to reset totally a PGraphics instance. I would like to apply a transparentBackground that erase all the content I have inside the PGraphics.
The only way I found is to create a new PGraphics for each frame, but it take immediatly too much memory and crashes.
Do you think it's possible to add the "reset-feature" in the next release ? It could be very helpful.
I'm trying to apply a custom shader on a textured plane.
I want to add custom attributes that represent the position (XYZ) , the rotation (XYZ) and the scale (XYZ) and apply the transformation inside the vertexShader.
I maybe wrong but I suppose that pushMatrix method create a new Matrix3D instance , so it means one Matrix by DisplayObject and a very complex calcul for each (easy to use but deeply complex inside). It's actually possible to do not use matrix operation at all, and replace it by a few simple operations , and that's exactly what I want to do , but it doesn't work in my processing code (it works well in other languages)
My code is strongly inspired from this very old Flash-5 code that you can find here
This code apply a rotationX,rotationY,rotationZ on a point.
Scale operation are only multiplications, translation are additions ; so it's all we need to create the transformation without a matrix object.
Scale and translation can be applyed after this calculation
projmodelviewMatrix * inVertex
and it works without problem.
But the rotations must be applyed on the vertex before using the projection, and the results are very weird.
If all rotations are set to zero, there is no problem ; if not, it work a little bit but it's like other calculations were applyed before and the transformations are wrong.
Here is the whole code (sorry for the very long post, I know it's not a pleasure to read it...)
First of all, sorry if my english is not perfect, I'm from France and speak english approximately.
I'm new in Processing / OpenGL (I discovered it one month ago) but I'm good enough in ActionScript3 and have already done some projects based on GPU with FlashPlayer 11.
I'm trying to build a java library to "simulate" a Flash-project structure in Processing (with different kinds of displayObject / DisplayObjectContainer , customEvents , ...). I actually know how to do it easily with pushMatrix and popMatrix but what I really want to do is calculate all these stuffs inside a VertexShader.
My vertexShader works as expected with a single plane using pgl.drawArrays , but because I have no access to the 'IndexBuffer' (-> the buffer that registers the indices) with pgl.drawArray , I can't figure out how I can draw more than one "shape" in the same 'drawArrays' call.
I mean... If I undestand well (but maybe I don't) how works pgl.drawArrays , all the triangles must be interconnected , but I want to draw thousands of 'single plane' in the same 'draw call'.
I look around in the source code of PGL.java and found pgl.drawElements and I think that's what I want :)
But, obviously, there is a problem : drawElements needs 4 int arguments and no int[]. I guess it works like pgl.
getAttribLocation but I don't find the good method... I searched a lot, found some stuff for processing 1.5 but nothing for processing 2...