If you want to ask a question about the OGL pipeline, you'll need to at least provide: - graphics card - driver version - OS version
Also, it would help to know the size in pixels of the original BufferedImage. As you suspect, calling DataBuffer.getData() will defeat image management, so you'll be getting sysmem->VRAM blits, which are slow (and bilinear ones are even slower, although they might get a bit faster if we fix 4841762 someday). Image management doesn't provide any benefit in the case of video applications though anyway, because the image content is changing on every frame and therefore we don't get a chance to cache it in VRAM. In any case, you won't get any benefit from the OGL pipeline by scaling a (sysmem-based) BufferedImage with bilinear filtering because OpenGL doesn't really offer a direct route for that. I think the alternate approach you describe is about the best you can do: - copy video data into (unmanaged) BufferedImage - copy BufferedImage into VolatileImage - scale VolatileImage to the destination (with BILINEAR enabled) Assuming you have a modern GPU with FBO support, then that should be reasonably fast. Chris On May 13, 2007, at 8:43 PM, [EMAIL PROTECTED] wrote:
I'm writing a video renderer using java2d, and it works fine with either the opengl or the standard pipeline when doing nearest- neighbor scaling. However, when I use the OpenGL pipeline and set the interpolation to bilinear, it slows down to about 1fps. However, If I draw the BufferedImage into a VolatileImage and then draw that to screen, speed is excellent (about the same speed as opengl with nearest-neighbour interpolation). Here is how I'm rendering: 1) new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB) 2) load video into the BufferedImage: int[] pixels = ((DataBufferInt) bImage.getRaster().getDataBuffer ()).getData(); ... read video data from native memory into the pixel array ... 3) call repaint() on the JComponent 4) in paintComponent(), draw the image using: g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR); g.drawImage(bImage, 0, 0, getWidth(), getHeight(), null); Knowing that getting the DataBuffer from the BufferedImage unmanages it, I tried getting a BufferedImage via GraphicsConfiguration.createCompatibleImage(), drawing the video image into that without scaling, and using the compatible image in paintComponent(), but it runs just as slow. When not scaling, the java2d trace during paintComponent() looks like: sun.java2d.opengl.OGLSwToSurfaceBlit::Blit(IntRgb, AnyAlpha, "OpenGL Surface") When scaling, it becomes hundreds of repititions of: sun.java2d.loops.Blit::Blit(IntArgbPre, SrcNoEa, IntArgb) sun.java2d.opengl.OGLMaskBlit::MaskBlit(IntArgb, SrcOver, "OpenGL Surface") sun.java2d.opengl.OGLGeneralBlit::Blit(Any, AnyAlpha, "OpenGL Surface") sun.java2d.loops.Blit::Blit(IntArgb, SrcNoEa, IntArgbPre) sun.java2d.loops.MaskBlit$General::MaskBlit(IntArgbPre, SrcOverNoEa, "OpenGL Surface (render-to-texture)") So the question is: Is that expected behaviour, and its just a trap for the unwary or am I doing something wrong somewhere? [Message sent by forum member 'wmeissner' (wmeissner)] http://forums.java.net/jive/thread.jspa?messageID=216689 ====================================================================== ===== To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff JAVA2D-INTEREST". For general help, send email to [EMAIL PROTECTED] and include in the body of the message "help".
=========================================================================== To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff JAVA2D-INTEREST". For general help, send email to [EMAIL PROTECTED] and include in the body of the message "help".