Hi I would like to render an offscreen texture with PGraphics on some vertex's:
- PGraphics off;
- void setup()
- {
- size( 640, 480 , P3D);
- off = createGraphics( 500, 500, P3D );
- }
- void draw()
- {
- background( 0 );
- off.beginDraw();
- off.background( 0 );
- off.fill( 255 );
- off.rect( 0, 0, off.width, off.height );
- off.endDraw();
- PImage offCopy = off.get();
- // rendering using beginShape gives a black screen
- beginShape();
- texture( offCopy );
- vertex( 0, 0 );
- vertex( width, 0 );
- vertex( width, height );
- vertex( 0, height );
- endShape( CLOSE );
- // rendering with image() gives white screen
- // uncomment out this line to see the white rect
- // image( off, 0,0, width, height );
- }
I would expect the beginShape to render a white screen as the rect should be covering the entire area. It is only rendering the black background and I can't get anything to render inside the visible area. If I render using image()
I get a white screen as you would expect.
I thought image would be doing something similar to the beginSHape/ endSHape block? I really don't know where I am going wrong and would love some insight.
Stephen
I thought image would be doing something similar to the beginSHape/ endSHape block? I really don't know where I am going wrong and would love some insight.
Stephen
1