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 › Problem with PImage in OpenGL
Page Index Toggle Pages: 1
Problem with PImage in OpenGL (Read 1171 times)
Problem with PImage in OpenGL
May 27th, 2005, 10:43am
 
I have a problem using copy() in OPENGL:

I'm trying to store a detail of a large bitmap in a small PImage. The example code below works as expected in P3D rendering mode, but with OPENGL the copy() function seems to work only once - in subsequent frames, copy() does not have any effect on what's drawn to the display window.

Is this a bug or is there a way to refresh the bitmap that's drawn to the screen? Your advice would be appreciated.

(I'm using 0090 on OS X 10.3.9)

Code:

import processing.opengl.*;

PImage detail, img;

void setup() {
size(200, 200, OPENGL); //works fine with P3D
detail = new PImage(200, 200);
img = loadImage("img.jpg");
}

void draw() {
int startX = round((random(img.width - detail.width)));
int startY = round((random(img.height - detail.height)));

detail.copy(img,
startX, startY, detail.width, detail.height,
0, 0, detail.width, detail.height);

image(detail, 0, 0);
}

Re: Problem with PImage in OpenGL
Reply #1 - Jun 1st, 2005, 1:21am
 
get/copy/set aren't working too well in opengl currently.
Page Index Toggle Pages: 1