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 & HelpOpenGL and 3D Libraries › speeding up PImage to OPENGL transfer
Page Index Toggle Pages: 1
speeding up PImage to OPENGL transfer (Read 1056 times)
speeding up PImage to OPENGL transfer
May 3rd, 2008, 6:32am
 
Hello Processing community-

I've got an applet running in OPENGL that makes highway billboards fly towards the screen.
Each billboard consists of a PImage that is dynamically generated by messing around with pixels in PGraphics buffer and copying them to the PImage.

I am using one PGraphics buffer to draw all the billboards. (in other words only one PGraphics object in the applet).

I then use translate() and rotate() commands to place my PImages in 3d space

Once a board passes behind the camera, i regenerate an image in the PGraphics object, copy this to board's PImage, and reset the z coordinate on the board (i send it way back so it can come towards the screen again)

here is the current applet:
http://clementvalla.com/mcdunco/

Th problem i am running into, is that there is a slight lag every time i generate a new image in the PGraphics and copy it into the PImage.
I assume this lag is worsened by then sending the PImage data to opengl.

i am wondering if there is a way to bypass the PImage, and copy the pixel data directly from the PGraphics buffer to an opengl texture.

If this is possible, would it improve the performance of the applet?

any other suggestions would be really helpful, as i can't get this thing running smoothly, though it seems like it should be able to (but maybe that's wishful thinking on my part).

Thanks in advance.

Clement
Re: speeding up PImage to OPENGL transfer
Reply #1 - May 4th, 2008, 8:35pm
 
don't use pi image use pure open gl textures instead:

http://processing.org/discourse/yabb_beta/YaBB.cgi?board=OpenGL;action=display;num=1199399046
Re: speeding up PImage to OPENGL transfer
Reply #2 - May 18th, 2008, 9:44am
 
you can draw a PImage directly via gldrawPixels, which is very fast. Then its no texture and only 2D.

see here -> http://processing.org/discourse/yabb_beta/YaBB.cgi?board=OpenGL;action=display;num=1211032462

greetings ascorbin
Re: speeding up PImage to OPENGL transfer
Reply #3 - May 18th, 2008, 4:15pm
 
or use set(), which calls glDrawPixels().
Page Index Toggle Pages: 1