Hi,
I am creating a sketch that utilizes the Processing Utilities MultiSketch Library.
Refrence@:
http://www.soi.city.ac.uk/~jwo/processing/utilities/api/org/gicentre/processing/...I am trying to create a custom layout for a sketch that contains multiple sketches inside it. I am positioning the SketchPanels by setting the bounds of the component using the Java Rectangle function. I have also tried setting the Components position directly.
Both methods seem to be effected by the render method set in the Setup function. OpenGL seems to produce the most desirable results but produces white rectangles that cover part of the sketches.
I have included some images of what I see.
Note:
Background Color is Red
Sketches are shades of Grey
White is NOT included in sketch, unsure why it appears
This Is What The Desired Layout SHOULD look like:
Below are screen shots of what each renderer produces:
No Render Setting
P2D Render Setting
P3D Render Setting
OpenGL Render Setting
And Below is the source code for my primary Sketch:
Code:import processing.opengl.*;
import org.gicentre.processing.utils.multisketch.*;
// LOAD SKETCHES //
Viewfinder viewfinder = new Viewfinder();
InfoDisplay infoDisplay = new InfoDisplay();
XmlLoaderSketch xmlLoaderSketch = new XmlLoaderSketch();
ImgLoaderSketch imgLoaderSketch = new ImgLoaderSketch();
NavSketch navSketch = new NavSketch();
FooterSketch footerSketch = new FooterSketch();
HeaderSketch headerSketch = new HeaderSketch();
// VARIABLES //
int sketchWidth = 1024;
int sketchHeight = 768;
Rectangle SketchBound1,
SketchBound2,
SketchBound3,
SketchBound4,
SketchBound5,
SketchBound6,
SketchBound7;
SketchPanel sp1,
sp2,
sp3,
sp4,
sp5,
sp6,
sp7;
void setup () {
size(sketchWidth, sketchHeight, P3D/*, OPENGL*/);
// BOUNDING RECTANGLES //
SketchBound1 = new Rectangle(navSketch.sketchWidth, headerSketch.sketchHeight, viewfinder.sketchWidth, viewfinder.sketchHeight);
SketchBound2 = new Rectangle(navSketch.sketchWidth, headerSketch.sketchHeight+viewfinder.sketchHeight, infoDisplay.sketchWidth, infoDisplay.sketchHeight);
SketchBound3 = new Rectangle(0, 0, 0, 0);
SketchBound4 = new Rectangle(0, 0, 0, 0);
SketchBound5 = new Rectangle(0, headerSketch.sketchHeight, navSketch.sketchWidth, navSketch.sketchHeight);
SketchBound6 = new Rectangle(0, headerSketch.sketchHeight+navSketch.sketchHeight, footerSketch.sketchWidth, footerSketch.sketchHeight);
SketchBound7 = new Rectangle(0, 0, headerSketch.sketchWidth, headerSketch.sketchHeight);
// POPUP SKETCHES //
// SKETCH PANELS //
sp1 = new SketchPanel(this, viewfinder);
sp1.setBounds(SketchBound1);
// sp1.setLocation(navSketch.sketchWidth, headerSketch.sketchHeight);
add(sp1);
viewfinder.setParentSketch(this);
viewfinder.setIsActive(true);
viewfinder.setVisible(true);
sp2 = new SketchPanel(this, infoDisplay);
sp2.setBounds(SketchBound2);
// sp2.setLocation(navSketch.sketchWidth, headerSketch.sketchHeight+viewfinder.sketchHeight);
add(sp2);
infoDisplay.setParentSketch(this);
infoDisplay.setIsActive(true);
infoDisplay.setVisible(true);
sp3 = new SketchPanel(this, xmlLoaderSketch);
sp3.setBounds(SketchBound3);
add(sp3);
xmlLoaderSketch.setParentSketch(this);
xmlLoaderSketch.setIsActive(true);
xmlLoaderSketch.setVisible(false);
sp4 = new SketchPanel(this, imgLoaderSketch);
sp4.setBounds(SketchBound4);
add(sp4);
imgLoaderSketch.setParentSketch(this);
imgLoaderSketch.setIsActive(true);
imgLoaderSketch.setVisible(false);
sp5 = new SketchPanel(this, navSketch);
sp5.setBounds(SketchBound5);
// sp5.setLocation(0, headerSketch.sketchHeight);
add(sp5);
navSketch.setParentSketch(this);
navSketch.setIsActive(true);
navSketch.setVisible(true);
sp6 = new SketchPanel(this, footerSketch);
sp6.setBounds(SketchBound6);
// sp6.setLocation(0, headerSketch.sketchHeight+navSketch.sketchHeight);
add(sp6);
footerSketch.setParentSketch(this);
footerSketch.setIsActive(true);
footerSketch.setVisible(true);
sp7 = new SketchPanel(this, headerSketch);
sp7.setBounds(SketchBound7);
// sp7.setLocation(0, 0);
add(sp7);
headerSketch.setParentSketch(this);
headerSketch.setIsActive(true);
headerSketch.setVisible(true);
// INITALIZE PUBLIC VARIABLES //
noLoop();
}
void draw () {
background(255, 0, 0);
}
As of Right now the sketches are empty but for good measure this is how my sketches are defined:
Code:public class Viewfinder extends EmbeddedSketch {
// NEW SKETCH //
// VARIABLES //
int sketchWidth = 774;
int sketchHeight = 443;
void setup () {
size(sketchWidth, sketchHeight, OPENGL);
}
void draw () {
super.draw();
background(0);
}
// END OF SKETCH //
}
Does anybody know what I can do to fix this situation? What is causing the white rectangles in the sketch?
Any help would be appreciated,
Thank you for your time,
Bbq9000