Eines de l'usuari

Eines del lloc


tutorials:processing:19_3d

3D amb processing

error: Profile GL4bc is not available on X11Graphics

Solució:

export LIBGL_ALWAYS_SOFTWARE=1
./processing

Perquè es quedi per sempre cal posar aquesta comanda sense l'export a l'arxiu /etc/environment

sudo nano /etc/environment
LIBGL_ALWAYS_SOFTWARE=1

Altra solució:

_JAVA_OPTIONS="-Djogl.disable.openglcore=false" ./processing-3.5.4/processing

pot posar-se dins del programa:

void settings() {
System.setProperty("jogl.disable.openglcore", "true");
size(400, 400, P3D);
}

false as in

System.setProperty("jogl.disable.openglcore", "false");

also works!

Per fer aplicacions amb 3d, podem començar per la documentació oficial, https://processing.org/tutorials/p3d/ tambè aquest pdf de la Politecnica de Valencia(Campus Alcoi) processing3d.pdf. A un nivell molt mes avançat podem consultar https://medium.com/@behreajj 3d_transformations_in_processing.zip

Que intentaré resumir i posar el exercicis mes significatius:

GUI3D al MIT(credor del processing). https://www.media.mit.edu/projects/gui3d/overview/ i al github https://github.com/irawinder/GUI3D, gui3d-master.zip, drivingfutures-master.zip

Diferencia P3D vs OPENGL

P3D is a 3D renderer developed by the creators of Processing . It should also be noted that anti-aliasing (enabled with the smooth( ) function) is not available with P3D. •

OPENGL is a 3D renderer that employs hardware acceleration. If you have an OpenGL compatible graphics card installed on your computer (which is pretty much every computer), you can use this mode. Although at the time of the writing of this book, there are still a few, minor kinks to be worked out with this mode (you may find things look slightly different between P3D and OPENGL), it may prove exceptionally useful in terms of speed. If you are planning to display large numbers of shapes onscreen in a high-resolution window, this mode will likely have the best performance.

To specify a mode, add a third argument in all caps to the size( ) function.

size(200,200);

    
// using the default JAVA2D mode     size(200,200,P3D);    
// using P3D     size(200,200,OPENGL); 

When using the OPENGL mode, you must also import the OPENGL library. This can be done by selecting the SKETCH ➝ IMPORT LIBRARY menu option or by manually adding the following line of code to the top of your sketch (see Chapter 12 for a detailed explanation on libraries):

import processing.opengl.*; 

millora la visualitació

Amb lums, smooth etc ortho()

http://creative-co.de/better_looking_processing/. a_guide_to_better_looking_processing_sketches.zip

Que es vegin le linies del shape pot ajudar

PShape pinyo;
float rotZ;

void setup(){
  size(800,600,P3D);
  pinyo=loadShape("pinyo.obj");
  ortho();
}
void draw(){
   background(32);
   smooth();
   lights();
   pinyo.setStroke(true);
   pinyo.setStroke(color(255, 0, 0));
   pinyo.setStrokeWeight(1.1f);
   pinyo.setFill(color(0,255, 12));
  
   
  
   translate(800/2,600/2);
   scale(10);
   rotateY(PI/4);
   rotateZ(rotZ);
    
   shape(pinyo);
}
void mouseDragged(){
    rotZ -= (mouseX - pmouseX) * 0.01;
 
}
tutorials/processing/19_3d.txt · Darrera modificació: 2021/04/30 21:18 per crevert