Loading...
Logo
Processing Forum
Hello, i am trying to render images or polygons with the new glgraphics integrated with P2.04, i only need (for now) to render a Ptexture, but the PTexture dosent have the Render method, as GLGraphics have in P1.51 .

Searching in the source, i realize that PTexture would render in a  PGraphicsAndroid3D renderer, using a function like PGraphicsAndroid3D.drawTexture(), but i cant access to the PGraphicsAndroid3D of the surfaceView  default of the render P3D in android, not like size(600,600); this.g.setTint... does (G is the PGraphics default created in the draw Applet)

so i just try to render the Ptexture in a new PGraphicsAndroid3D, but in the emulator crash.

here is my code
Copy code
  1. PTexture a;
    PGraphicsAndroid3D pg;
    import processing.core.PGraphicsAndroid3D;
    void setup()
    {
          size(screenWidth,screenHeight, P3D);
        a = new PTexture(this,10 ,10);
         pg = new PGraphicsAndroid3D();
         pg.setSize(screenWidth,screenHeight);

    }
    void draw()
    {
      pg.beginDraw();
      pg.endDraw();
    }
is there any other way to render PTexture? is  PGraphicsAndroid3D.drawTexture() working? perhaps the android emulator is too weak to support PGraphicsAndroid3D, i didnt test it in my tablet o a phone.

Any help to use ptexture, PGraphicsAndroid3D would be help a lot, thank.

Sorry for my bad English

Replies(1)

Offscreen rendering is working in the Android mode of Processing 2.0a5. The following code should let you draw an image inside an offscreen surface:
Copy code
  1. PImage img;
  2. PGraphics pg;

  3. void setup() {
  4.   size(400, 400, P3D); 
  5.   img = loadImage("eames.jpg");
  6.   pg = createGraphics(400, 400, P3D);
  7. }

  8. void draw() {
  9.   pg.beginDraw();
  10.   pg.image(img, 0, 0, 400, 400);
  11.   pg.endDraw();
  12.   image(pg, 0, 0);
  13. }

Sorry for the late reply, I hope this is still useful.