Hi I get this error:
After adding a text overlay rendered thru the PGgraphics canvas.*** error: can't allocate region*** set a breakpoint in malloc_error_break to debugjava(1281,0xb4f1d000) malloc: *** mmap(size=4096000) failed (error code=12)
here's a part of my code:
- import processing.opengl.*;
- import javax.media.opengl.*;
- import codeanticode.glgraphics.*;
- int myColorBackground = color(0, 0, 0);
- int colorMin = 100;
- int colorMax = 100;
- controlP5.Range range;
- controlP5.Range range2;
- PImage[] imagePhone;
- import peasy.*;
- int sliderValue = 100;
- int sliderTicks1 = 100;
- int sliderTicks2 = 30;
- int myColor = color(0, 0, 0);
- int begin, eind;
- int images = 1;
- int setBrightness = 200;
- import codeanticode.glgraphics.*;
- PeasyCam cam;
- ControlP5 controlP5;
- PMatrix3D currCameraMatrix;
- PGraphicsOpenGL g3;
- PFont font;
- PFont font2;
- PGraphics canvas;
- PApplet app = this;
- void setCam() {
- PeasyDragHandler PanDragHandler;
- PeasyDragHandler ZoomDragHandler;
- PanDragHandler = cam.getPanDragHandler();
- ZoomDragHandler = cam.getZoomDragHandler();//then you can just map this to the left mouse handlercam.setLeftDragHandler(PanDragHandler);
- cam.setMinimumDistance(50);
- cam.setMaximumDistance(1000);
- }
- void setup() {
- size(1280, 800, GLConstants.GLGRAPHICS);
- canvas = createGraphics(1280, 800, P2D);
- g3 = (PGraphicsOpenGL)g;
- this.hint(ENABLE_OPENGL_4X_SMOOTH);
- cam = new PeasyCam(this, 100);
- cam.setMinimumDistance(500);
- cam.setMaximumDistance(500);
- controlP5 = new ControlP5(this);
- // add horizontal sliders
- frameRate(15);
- canvas.textMode(SCREEN);
- textMode(SCREEN);
- setCam();
- hint(DISABLE_NATIVE_FONTS);
- //font = createFont("MisterGiacco-MediumCaps 2.ttf",10);
- font = loadFont("MisterGiacco-MediumCaps-30.vlw");
- font2 = loadFont("MisterGiacco-MediumCaps-15.vlw");
- GLGraphics renderer = (GLGraphics)g;
- // font3 = renderer.loadGLFont("MisterGiacco-MediumCaps-30.vlw");
- // font4 = renderer.loadGLFont("MisterGiacco-MediumCaps-15.vlw");
- }
- void draw() {
- background(0);
- if (controlP5.window(this).isMouseOver()) {
- cam.setActive(false);
- }
- else {
- cam.setActive(true);
- }
- GLGraphics renderer = (GLGraphics)g;
- // GLGraphics renderer = (GLGraphics)g;
- for ( int i=imageMin ;i<imageMax; i++) {
- pixelDepth im1 = new pixelDepth(imagePhone[i]);
- im1.loadPix();
- pushMatrix();
- translate(-200, -200, setDistance *index);
- renderer.beginGL();
- renderer.model(texquad[i]);
- renderer.endGL();
- popMatrix();
- index++;
- }
- canvas.beginDraw();
- canvas.background(0,0,0,0);
- canvas.smooth();
- canvas.fill(255);
- canvas.textFont(font);
- float sw = textWidth(pngList[imageMin+index-1].substring(0, 4));
- canvas.textFont(font2);
- int addVal = 3;
- canvas.text( "images", range.position().x+range.getWidth()+addVal, range.position().y+range.getHeight());
- canvas.text( "Brightness", s1.position().x+s1.getWidth()+addVal, s1.position().y+s1.getHeight());
- canvas.text( "Distance", s2.position().x+s2.getWidth()+addVal, s2.position().y+s2.getHeight());
- canvas.endDraw();
- //When we're done drawing, we grab pixels from the offscreen GO and store it temporarily in a PImage.
- PImage temp = canvas;
- //Finally, we create a GLtexture, and put the image data inside of it
- blitImage = new GLTexture(app);
- blitImage.putImage(temp);
- image(blitImage,0,0);
- currCameraMatrix = new PMatrix3D(g3.camera);
- camera();
- controlP5.draw();
- g3.camera = currCameraMatrix;
- }
1