We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpPrograms › Lights in 3D
Page Index Toggle Pages: 1
Lights in 3D (Read 692 times)
Lights in 3D
Apr 13th, 2010, 4:49am
 
hello
i'm new in programming with Processing tools, i'm writing a simple code to illuminate a 3D scene with a box, my problem is that when I use the functions smooth() and lights() togheter strange lines appears on my box and I don't know how to erase them (or keep them not visible),
the code below is the one i'm working on:(you can just copy and run)


//--------------------------
//--------------------------

float spin = 0.0;

void setup()
{
 size(640, 360, P3D);
 noStroke();
 smooth();
}

void draw()
{
 background(51);
 lights();
 fill(255,0,0);
 spin += 0.01;
 
 pushMatrix();
 translate(width/2, height/2, 0);
 rotateX(PI/9);
 rotateY(PI/5 + spin);
 box(150);
 popMatrix();
}


//--------------------------
//--------------------------


thank you for your attention. Smiley
Re: Lights in 3D
Reply #1 - Apr 13th, 2010, 5:11am
 
If you run your sketch in OPENGL mode the lines disappear. This is quite normal in my experience.
Code:

import processing.opengl.*;

###
size(640, 360, OPENGL);
configureOpenGL();
####

void configureOpenGL(){
 hint(ENABLE_OPENGL_4X_SMOOTH);
 hint(DISABLE_OPENGL_ERROR_REPORT);
}


The configureOpenGL is something I like to include in my opengl sketches (smooth() has no effect on opengl, disabling the error report makes it run a bit quicker)
Re: Lights in 3D
Reply #2 - Apr 13th, 2010, 6:45am
 
it works perfectly !!!! Smiley
thank you very much
Page Index Toggle Pages: 1