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 › OpenGL giving me black background
Page Index Toggle Pages: 1
OpenGL giving me black background (Read 613 times)
OpenGL giving me black background
Oct 31st, 2005, 9:43pm
 
I have the following script which utilizes the OpenGL library.  If I make the sketch 1000 by 1000 pixels, everything works fine.  If I make the sketch 3000 by 3000 pixels or larger, I get a black background and nothing else.  Is this an OpenGL problem?  Without OpenGL, I can produce an image at 10000 by 10000 pixels (any bigger and the applet crashes), but that takes hours to render...

Much thanks for any help...I'm still very much a newbie

Code:

import processing.opengl.*;

size(1000, 1000); //Ultimately, I want this to be 12000 x 12000 so I can make a 40" square print at 300dpi

background(255);

colorMode(RGB, 255);

PImage d = loadImage("DSC_0013.JPG"); //pretty big image...3008 x 2000 pixels, 752kb


int cR, cG, cB;


for(int i=0; i<d.width*d.height; i+=75){


int n=2;

cR = (d.pixels[i] >> 16) & 0x000000ff;
cG = (d.pixels[i] >> 8) & 0x000000ff;
cB = d.pixels[i] & 0x000000ff;

int x1 = width/2;
int y1 = int(height/2-(cR*n));

int x2 = int(width/2-(cG*n)*cos(PI/6));
int y2 = int(height/2+(cG*n)*sin(PI/6));

int x3 = int(width/2+(cB*n)*cos(PI/6));
int y3 = int(height/2+(cB*n)*sin(PI/6));



stroke(cR,cG,cB,50);
noFill();
smooth();
triangle(x1,y1,x2,y2,x3,y3);

}
save("test2.tiff");


Re: OpenGL giving me black background
Reply #1 - Oct 31st, 2005, 9:55pm
 
oh yeah...In the actual code I have been using I declare OPENGL in size()

so it's :

size(1000,1000,OPENGL);
Re: OpenGL giving me black background
Reply #2 - Oct 31st, 2005, 11:22pm
 
yes, as i understand it, opengl is limited by the size of your display device. so if your display is at 1920x1200 then the max size you can get is that many pixels (though it needn't be that dimension). the restriction is somewhere between the os and opengl.

there are some other threads on making big things (and setting memory for them) elsewhere on the board.
Re: OpenGL giving me black background
Reply #3 - Oct 31st, 2005, 11:38pm
 
Ah.  Thank you.  For the record, my display is 2560 x 1900, and I can create sketches at 2000 x 2000 (but no bigger), so it seems you can get a little bigger than your screen resolution.  

I'm just going to use translate() and patch my image together in photoshop...seems like the most efficient solution.

Re: OpenGL giving me black background
Reply #4 - Oct 31st, 2005, 11:44pm
 
you shoudl be able to go a little higher than 2000x2000.. the issue is pixel count, not dimensions.. so you've got 4,864,000 pixels in your display, which should mean you can do 2400x2000 or something like that.
Page Index Toggle Pages: 1