Hi Michele, On Mon, Jan 30, 2006 at 04:11:50PM +0100, Michele Puccini wrote: > Thanks for your reply Dmitri, > > sadly I cannot go through a static method as I need to initialize ddraw and > other stuff once per canvas. I don't want to create/dispose it for each call > as it would cost me 'a lot' of time.
Well, the static method stuff was just an example, it should work as well with a non-static method. > Nice to hear about the 6378181 RFE. JDK1.6 looks so promising. It will be > really great for any kind of desktop application. Thanks for the feedback! > I did some more tests with my MediaPlayerCanvas with full screen > BufferStrategy (do you remember ?). Disabling DDraw it works as expected, > but it's not the way it should work. Without DDraw we're fall back using > blitting and not flipping. > > In my test, if you have a BufferStrategy with 2 buffers the media output > flickers as it was painted on the first buffer only. Looks like the player > window is not notified about the "flip" of the output surface. I suppose > this problem could be fixed somewhere in the jdk implementation. Or maybe > is't a VMR9 issue.. My sources are here for you. Since the player is rendering directly to the screen (to the window) instead of the ddraw back-buffer (and there's currently no way of accessing the DirectDraw backbuffer from JAWT), I'd expect flickering. > Have you ever verified such a problem with JAWT-based components used with a > BufferStrategy ? I don't thinkj it's a problem with BufferStrategy and JAWT, but rather a limitation of the latter. But we're really wary of extending JAWT because using it properly is a tricky business.. Thanks, Dmitri > > Cheers! > > Mik > ============================================================================ > >ClassX Development Italy Via Francesca, 368/I I-56030 S.M. a Monte (PI) < > >Tel.(+39)-0587-705153 Fax.(+39)-0587-705153 WEB: http://www.classx.it < > ============================================================================ > > > From: "Dmitri Trembovetski" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Monday, January 30, 2006 3:36 AM > Subject: Re: [JAVA2D] FullScreen, BufferStrategy, Vertical Blanking > > > > Hi Michele, > > > > I didn't work much with JAWT, so I'm not sure what's going wrong > > with it, unfortunately. > > > > But some of the things you'll need to make sure: > > - the awt and 2d is initialized > > - you'll need a realized canvas in order to work with jawt > > > > So your library should accept a realized (that is, added to a > > realized/visible hierarchy) Canvas so that you can > > get access to the ddraw surface. > > > > So, in your case you'd have something like > > public class VideoUtils { > > static { > > System.loadLibrary("videoutils"); > > } > > public static native void waitForVSync(Canvas c); > > } > > > > You might want to make sure that the Canvas is realized/visible in > > this method before going to native. > > > > Then on the native level: > >JNIEXPORT void JNICALL Java_VideoUtils_waitForVSync > >(JNIEnv* env, jclass utils, jobject canvas) > >{ > > JAWT awt; > > awt.version = JAWT_VERSION_1_4; > > if (JAWT_GetAWT(env, &awt) == JNI_FALSE) { > > printf("AWT Not found\n"); > > return; > > } > > JAWT_DrawingSurface* ds = awt.GetDrawingSurface(env, canvas); > > // wait for the vertical retrace > >} > > > > I don't see why this won't work. > > > > You might want to check out www.javagaming.org, I believe someone > > there was doing something similar. > > > > Also, the good news is that we're considering adding vsync > > functionality for mustang: > > 6378181: 2D needs a way to synchronize onscreen rendering with vertical > >retrace > > We'll provide the necessary API in the BufferStrategy class. > > > > Your library will still be useful for pre-6.0 jdks, though. > > > > Thanks, > > Dmitri > > > >On Fri, Jan 27, 2006 at 10:09:29AM +0100, Michele Puccini wrote: > >> Thanks Dmitri, > >> > >> taking a look of some other jawt-dependent implementations (JOGL,LWJGL) > >> I've > >> discovered that JAWT must be pre-loaded before any other JAWT-dependent > >> DLL > >> (at least on Win32). > >> > >> Infact the pre-loding solved all the "unsatisfied link error: jawt.ll > >> not > >> found..." problems I had in all my jawt-dependent dlls. > >> > >> About JAWT initialization I think I'm doing quite well with a little > >> useful > >> class I've found somewhere. Find it attached. Usage is strightforward: > >> > >> /* > >> * Class: it_classx_video_VideoUtils > >> * Method: createDDraw > >> * Signature: (Ljava/awt/Component;)I > >> */ > >> JNIEXPORT jint JNICALL > >> Java_it_classx_video_VideoUtils_createDDraw(JNIEnv * > >> env , jobject obj, jobject canvas) > >> { > >> __int64 ddraw = 0; > >> JAWT_Info info(env, canvas); > >> HWND hWnd = (HWND)info.getHWND(); > >> if (hWnd != NULL) > >> { > >> ... > >> } > >> } > >> > >> > >> But some problems still remain: > >> > >> - If the VideoUtils class extends Canvas > >> - JAWT is not loaded. -> CRASH > >> - JAWT is loaded in the static{} initializer. -> WORKS > >> - JAWT is loaded in the class constructor. -> WORKS > >> > >> - If the VideoUtils class does not extend Canvas > >> - JAWT is not loaded. -> CRASH > >> - JAWT is loaded in the static{} initializer. -> "JAWT.DLL not > >> loaded" > >> - JAWT is loaded in the class constructor. -> WORKS > >> > >> > >> Of course VideoUtils must not extend a Canvas as it's not a Canvas in my > >> design. > >> > >> > >> Thanks, > >> > >> Mik > >> > >============================================================================ > >> >ClassX Development Italy Via Francesca, 368/I I-56030 S.M. a Monte > >> >(PI) < > >> >Tel.(+39)-0587-705153 Fax.(+39)-0587-705153 WEB: http://www.classx.it > >> >< > >> > >============================================================================ > > =========================================================================== > 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".