Updated examples

This commit is contained in:
codeanticode
2011-02-12 15:57:36 +00:00
parent b78cf2eb5f
commit f6c7ebcbdf
6 changed files with 16 additions and 13 deletions
@@ -25,11 +25,11 @@ void draw() {
tint(255, 255);
image(pic1, 0, 0, pic1.width, pic1.height);
blend(selMode);
screenBlend(selMode);
tint(255, picAlpha);
image(pic2, 0, 0, pic2.width, pic2.height);
noBlend();
screenBlend(REPLACE);
fill(200, 50, 50);
rect(0, height - 50, map(picAlpha, 0, 255, 0, width), 50);
fill(255);
+5 -4
View File
@@ -28,15 +28,16 @@ void setup() {
// We need trilinear sampling for this texture so it looks good
// even when rendered very small.
surftex2 = loadImage("mercury.jpg", TRILINEAR);
PTexture.Parameters params1 = PTexture.newParameters(ARGB, TRILINEAR);
surftex2 = loadImage("mercury.jpg", params1);
// The clouds texture will "move" having the values of its u
// texture coordinates displaced by adding a constant increment
// in each frame. This requires REPEAT wrapping mode so texture
// coordinates can be larger than 1.
PTexture.Parameters params = PTexture.newParameters();
params.wrapU = REPEAT;
cloudtex = createImage(512, 256, params);
PTexture.Parameters params2 = PTexture.newParameters();
params2.wrapU = REPEAT;
cloudtex = createImage(512, 256, ARGB, params2);
// Using 3D Perlin noise to generate a clouds texture that is seamless on
// its edges so it can be applied on a sphere.
+4 -2
View File
@@ -43,10 +43,12 @@ void createRibbonModel(ArrayList residues, PShape3D model, ArrayList trj) {
}
if (renderMode == 0) {
model = createShape(vertices.size(), LINES, STATIC);
PShape3D.Parameters params = PShape3D.newParameters(LINES, STATIC);
model = (PShape3D)createShape(vertices.size(), params);
model.setVertices(vertices);
} else {
model = createShape(vertices.size(), TRIANGLES, STATIC);
PShape3D.Parameters params = PShape3D.newParameters(TRIANGLES, STATIC);
model = (PShape3D)createShape(vertices.size(), params);
model.setVertices(vertices);
model.setNormals(normals);
}
+1 -1
View File
@@ -30,7 +30,7 @@ void setup() {
// The particle system is stored in a PShape3D object set to
// POINT_SPRITES mode
particles = createShape(numParticlesTotal, POINT_SPRITES, DYNAMIC);
particles = (PShape3D)createShape(numParticlesTotal, PShape3D.newParameters(POINT_SPRITES, DYNAMIC));
particleLifetime = numParticlesTotal / numParticlesPerFrame;
lifetimes = new int[numParticlesTotal];
+1 -1
View File
@@ -15,7 +15,7 @@ void setup() {
// it will hold (this number cannot be changed later). Also, how
// the vertices will be connected is specified here (this can be
// changed later though).
cube = createShape(36, TRIANGLES);
cube = (PShape3D)createShape(36, PShape3D.newParameters(TRIANGLES));
// The vertices array gives access to all the vertex data
// in the PShape3D object. It can only be used between
+3 -3
View File
@@ -30,7 +30,7 @@ void setup() {
pg = createGraphics(32, 512, A3D);
// Initializing particle system
particles = createShape(1000, POINT_SPRITES, DYNAMIC);
particles = (PShape3D)createShape(1000, PShape3D.newParameters(POINT_SPRITES, DYNAMIC));
particles.loadVertices();
for (int i = 0; i < particles.getVertexCount(); i++) {
particles.set(i, random(0, 10), random(0, 10), 0);
@@ -89,10 +89,10 @@ void draw() {
if (mode == 0) {
trefoil.enableStyle();
hint(DISABLE_DEPTH_MASK);
blend(ADD);
screenBlend(ADD);
} else {
trefoil.disableStyle();
blend(BLEND);
screenBlend(BLEND);
}
shape(trefoil);