glPolygonStipple glShadeModel glTexParameterfv glTexSubImage2D glStencilOp glStencilFunc glClearStencil glDepthFunc glLightf glLightfv glClipPlane glFogi GlColor4fv glFogf glNormal3fv glTexCoord3fv glColor3fv glTexCoord2fv glNormalPointer glVertex3fv glInterleavedArrays glEnableClientState glColorPointer glVertexPointer glDrawArrays glTexCoordPointer glDisableClientState glDeleteTextures glReadPixels wglGetProcAddress glEndList glDeleteLists glCallList GlFlush glNewList glFinish glDrawBuffer glAccum glClearAccum glBindTexture glClearColor glPixelStorei GlOrtho glTexParameterf glTexEnvf glTexCoord2f glTexImage2D glBegin glGetBooleanv glVertex2f glEnd glBlendFunc glIsEnabled glDisable glRasterPos3f glMatrixMode glLoadMatrixd glDepthMask glPixelZoom glDrawPixels wglShareLists glClear glGetIntegerv 332
Note: If you are looking for good and high quality web space to host and run your application check Lunarwebhost JSP Web Hosting services
glReadBuffer glEnable glColorMaterial wglMakeCurrent wglDeleteContext wglCreateContext glTexEnvi glGetString glTexEnvfv glLightModeli glLineStipple 18.13 Summary I hope this quick summary of Sun s Java 3D implementation has given you an appreciation for how it works and has piqued your interest. Poking around, using fairly simple tools and a little guesswork you can learn a lot either purely for education or to help performance tune or debug your Java 3D applications. One of the criticisms of Java 3D has been the lack of information on the implementation of the API. Parts of the Java 3D Specification are vague and the semantics of how changes to the scenegraph are propagated across the runtime, synchronized, and rendered are largely undocumented. I hope this chapter will spur on others at Sun, or elsewhere, to further document some of these more advanced aspects of the implementation. Since this is the last chapter, I say well done! I m sure it s been a hard slog, especially if you are new to Java 3D, but I hope it has been worth it. Don t hesitate to contact me through the Manning Authors Online forum, or we may run into each other on Sun s Java 3D email list. May all your capability bits be set correctly! 333
Note: If you are looking for good and high quality web space to host and run your application check Lunarwebhost JSP Web Hosting services
GetCurrentThreadId VirtualFree HeapCreate VirtualAlloc HeapAlloc GetStartupInfoA HeapDestroy GetStdHandle SetHandleCount GetFileType DeleteCriticalSection InitializeCriticalSection GetCommandLineA HeapFree GetVersion EnterCriticalSection GetCurrentProcess LeaveCriticalSection TerminateProces FormatMessageA ExitProcess USER32.dll GetSystemMetrics CallWindowProcA SetWindowLongA GDI32.dll ChoosePixelFormat SwapBuffers CreateDCA DeleteObject DescribePixelFormat CreateCompatibleDC SetPixelFormat CreateDIBSection SelectObject DeleteDC OPENGL32.dll glLogicOp glAlphaFunc glPolygonMode glLightModelfv glPolygonOffset glViewport glLineWidth glMultMatrixd glPointSize glTexGenfv glTexGeni glHint glCullFace glFogfv glPopAttrib glLoadIdentity glPushAttrib glMaterialfv 331
Note: If you are looking for good and high quality web space to host and run your application check Lunarwebhost JSP Web Hosting services
TextureUnitStateRetained _TextureUnitStateRetained_updateTextureUnitState@20 Texture _Texture_freeTexture@16 TransparencyAttributesRetained _TransparencyAttributesRetained_updateNative@40 18.12.2 Imported methods The J3D.DLL Windows library of course also imports methods from other Windows libraries. The list that follows describes the methods that the J3D.DLL library relies upon from other Windows libraries. This information is not particularly relevant except for the imports from OPENGL32.DLL (which is the standard OpenGL library on Windows). By looking at these imports you can see exactly which OpenGL functions the Sun Java 3D requires and uses. KERNEL32.dll GetLastError GetSystemInfo LCMapStringW RtlUnwind LCMapStringA CloseHandle SetFilePointer SetStdHandle LoadLibraryA SetEnvironmentVariableA GetACP CompareStringW GetOEMCP GetCPInfo CompareStringA GetStringTypeA MultiByteToWideChar GetStringTypeW InterlockedIncrement InterlockedDecrement FlushFileBuffers GetEnvironmentStringsW GetEnvironmentStrings WriteFile FreeEnvironmentStringsA GetModuleFileNameA FreeEnvironmentStringsW GetModuleHandleA GetProcAddress WideCharToMultiByte TlsGetValue SetLastError TlsAlloc TlsSetValue TlsFree HeapReAlloc 330
Note: If you are looking for good and high quality web space to host and run your application check Lunarwebhost JSP Web Hosting services
GeometryArrayRetained _GeometryArrayRetained_buildGA@64 _GeometryArrayRetained_defineByteColorPointer@44 _GeometryArrayRetained_defineDoubleVertexPointer@20 _GeometryArrayRetained_defineFloatColorPointer@44 _GeometryArrayRetained_defineFloatVertexPointer@20 _GeometryArrayRetained_defineNormalPointer@20 _GeometryArrayRetained_defineTexCoordPointer@28 _GeometryArrayRetained_disableGlobalAlpha@24 _GeometryArrayRetained_execute@76 _GeometryArrayRetained_executeInterLeaved@72 _GeometryArrayRetained_executeVA@32 _GeometryArrayRetained_globalAlphaSUN@8 _GeometryArrayRetained_setVertexFormat@20 GraphicsContext3D _GraphicsContext3D_readRasterNative@48 LineAttributesRetained _LineAttributesRetained_updateNative@32 LinearFogRetained _LinearFogRetained_update@40 MasterControl _MasterControl_getMaximumLights@8 _MasterControl_getNumberOfProcessor@8 _MasterControl_getThreadConcurrency@8 _MasterControl_initializeJ3D@8 _MasterControl_setThreadConcurrency@12 MaterialRetained _MaterialRetained_updateNative@84 ModelClipRetained _ModelClipRetained_update@52 NativeConfigTemplate3D _NativeConfigTemplate3D_choosePixelFormat@16 _NativeConfigTemplate3D_isDoubleBufferAvailable@24 _NativeConfigTemplate3D_isSceneAntialiasingAvailable@24 _NativeConfigTemplate3D_isStereoAvailable@24 NativeWSInfo _NativeWSInfo_subclass@12 328
Note: If you are looking for good and high quality web space to host and run your application check Lunarwebhost Tomcat Web Hosting services
PointAttributesRetained _PointAttributesRetained_updateNative@20 PointLightRetained _PointLightRetained_updateLight@52 PolygonAttributesRetained _PolygonAttributesRetained_updateNative@32 RasterRetained _RasterRetained_execute@56 Renderer _Renderer_freeContext@16 RenderingAttributesRetained _RenderingAttributesRetained_updateNative@48 Screen3D _Screen3D_getDisplayParameters@24 SpotLightRetained _SpotLightRetained_updateLight@72 TexCoordGenerationRetained _TexCoordGenerationRetained_updateNative@76 Texture3DRetained _Texture3DRetained_bindTexture@20 _Texture3DRetained_updateTextureFields@52 _Texture3DRetained_updateTextureImage@44 TextureAttributesRetained _TextureAttributesRetained_updateNative@44 _TextureAttributesRetained_updateTextureColorTableNative@ TextureRetained _TextureRetained_bindTexture@20 _TextureRetained_updateTextureFields@48 _TextureRetained_updateTextureImage@40 _TextureRetained_updateTextureSubImage@44 329
Note: If you are looking for good and high quality web space to host and run your application check Lunarwebhost Tomcat Web Hosting services
_Canvas3D_decalNthChildSetup@12 _Canvas3D_decalReset@16 _Canvas3D_destroyContext@20 _Canvas3D_destroyOffScreenBuffer@20 _Canvas3D_disableFog@12 _Canvas3D_disableModelClip@12 _Canvas3D_endDisplayList@12 _Canvas3D_freeDisplayList@16 _Canvas3D_freeTexture@16 _Canvas3D_getNumCtxLights@12 _Canvas3D_getTextureColorTableSize@12 _Canvas3D_getTextureUnitCount@12 _Canvas3D_newDisplayList@16 _Canvas3D_readOffScreenBuffer@24 _Canvas3D_resetColoringAttributes@32 _Canvas3D_resetLineAttributes@12 _Canvas3D_resetPointAttributes@12 _Canvas3D_resetPolygonAttributes@12 _Canvas3D_resetRenderingAttributes@20 _Canvas3D_resetTexCoordGeneration@12 _Canvas3D_resetTextureAttributes@12 _Canvas3D_resetTextureNative@16 _Canvas3D_resetTransparency@24 _Canvas3D_setBlendFunc@20 _Canvas3D_setDepthBufferWriteEnable@16 _Canvas3D_setDepthFunc@16 _Canvas3D_setFogEnableFlag@16 _Canvas3D_setLightEnables@24 _Canvas3D_setLightingEnable@16 _Canvas3D_setModelViewMatrix@20 _Canvas3D_setProjectionMatrix@16 _Canvas3D_setRenderMode@20 _Canvas3D_setSceneAmbient@24 _Canvas3D_setViewport@28 _Canvas3D_swapBuffers@20 _Canvas3D_syncRender@16 _Canvas3D_texturemapping@48 _Canvas3D_updateMaterial@28 _Canvas3D_useCtx@20 _Canvas3D_useSharedCtx@8 ColoringAttributesRetained _ColoringAttributesRetained_updateNative@48 CompressedGeometryRetained _CompressedGeometryRetained_decompressByRef@12 _CompressedGeometryRetained_decompressHW@20 _CompressedGeometryRetained_execute@40 DirectionalLightRetained _DirectionalLightRetained_updateLight@40 ExponentialFogRetained _ExponentialFogRetained_update@28 327
Note: If you are looking for good and high quality web space to host and run your application check Lunarwebhost Tomcat Web Hosting services
BEHAVIOR 17 GROUP 23 SWITCH 18 TRANSFORMGROUP 24 BRANCHGROUP 19 BOUNDINGLEAF 25 ORDEREDGROUP 20 MODELCLIP 26 DECALGROUP 21 ALTERNATEAPPEARANCE 27 SHAREDGROUP 22 ORIENTEDSHAPE3D 28 18.11 Exception Strings Read from ExceptionStrings.properties (inside J3DCORE.JAR). Appearance0=Appearance: no capability to set material Appearance1=Appearance: no capability to get material Appearance2=Appearance: no capability to set texture Appearance3=Appearance: no capability to get texture Appearance4=Appearance: no capability to set textureAttributes Appearance5=Appearance: no capability to get textureAttributes And so forth 18.12 J3D DLL The native methods within the Java 3D implementation are packaged within J3D.DLL (for Windows) and called using JNI from the Java code. The native code implements a procedural API for both OpenGL and DirectX rendering. There are many programming tools that can list the signatures of the methods exported from a Windows DLL. The native method listings which follow are useful in that they not only expose where Java 3D calls down into native code but they also provide a blueprint for how an ambitious programmer might patch or hook a native DLL to implement an alternative rendering scheme or produce debugging output. 18.12.1 Exported methods The following lists are sorted by ordinal (the numeric index of an exported method within a DLL) and arranged by Java 3D class. Prepend java_javax_media_j3dto the names in the following lists. For example J3D.DLL exports a method called java_javax_media_j3d_Canvas3D_callDisplayListwhich implements the method callDisplayListwhich was declared as native within the Canvad3Dclass. Canvas3D _Canvas3D_accum@16 _Canvas3D_accumReturn@12 _Canvas3D_callDisplayList@20 _Canvas3D_clear@28 _Canvas3D_clearAccum@28 _Canvas3D_composite@40 _Canvas3D_createContext@28 _Canvas3D_createOffScreenBuffer@28 _Canvas3D_createQueryContext@24 _Canvas3D_ctxUpdateEyeLightingEnable@16 _Canvas3D_decal1stChildSetup@12 326
Note: If you are looking for good and high quality web space to host and run your application check Lunarwebhost Tomcat Web Hosting services
BitSet capabilities A BitSetis an object that contains the capability bits that have been set on the SceneGraphObject. SceneGraphObjectRetained retained The retained field holds the private Java 3D implementation object for this SceneGraphObject. The SceneGraphObjectRetainedmaintains a reference to its source object and implements several setLivemethods that can be overridden to respond in a Nodespecific manner. By having an internal delegate class separate from the public implementation class defined by the specification Sun has more leeway in modifying the implementation without breaking the API or exposing protected or package level access to methods or fields. private boolean compiled This field is trueif this node has been compiled. private boolean live This field is trueif this node has been attached to a live scenegraph. private boolean liveOrCompiled This field is trueif this node has been attached to a live scenegraph or has been compiled. private Object userData This field holds a reference to the User Data object for this scenegraph node. Hashtable nodeHashtable Some ScenegraphObjectshave a Hashtableof NodeComponentsassociated with them. 18.10 Node types Table 18.10 contains a list of Nodetypes and their identifiers. Table 18.10 Thread Group: System Name Identifier Name Identifier BACKGROUND 1 LINK 9 CLIP 2 MORPH 10 LINEARFOG 3 SHAPE 11 EXPONENTIALFOG 4 BACKGROUNDSOUND 12 AMBIENTLIGHT 5 POINTSOUND 13 DIRECTIONALLIGHT 6 CONESOUND 14 POINTLIGHT 7 SOUNDSCAPE 15 SPOTLIGHT 8 VIEWPLATFORM 16 325
Note: If you are looking for good and high quality web space to host and run your application check Lunarwebhost Java Web Hosting services
18.6.2 RenderAtoms and RenderMolecule RenderAtomsare self-contained rendering units that can be passed to the underlying rendering engine. The RenderAtomcontains lights, fog, model clipping information, an Appearance, and a model transformation matrix. RenderAtomscan be linked using double linked-list RenderAtommembers within the RenderAtomclass. Higher level rendering operations are described using the RenderMoleculeclass. In addition to maintaining a list of RenderAtoms, RenderMoleculesare able to remove redundant changes in Appearancebetween consecutive RenderAtoms. In this way, the number of Appearancestate changes (Appearance, Material, Transparency, etc.) performed by the underlying rendering engine is minimized. 18.7 StructureUpdateThread The StructureUpdateThreadis a J3dThreadthat can be attached to a J3dStructureobject to perform message processing. The StructureUpdateThreadinstances are: J3D-GeometryStructureUpdateThread J3D-RenderStructureUpdateThread J3D-BehaviorStructureUpdateThread J3D-SoundStructureUpdateThread J3D-RenderingAttributesStructureUpdateThread J3D-RenderingEnvironmentStructureUpdateThread J3D-TransformStructureUpdateThread J3D-SoundSchedulerUpdateThread The StructureUpdateThreadis attached to an instance of a J3dStructureobject, and its doWork method calls the processMessagesmethod on the J3dStructure. The various classes derived from J3dStructure(such as SoundStructure) implement structure specific message execution. 18.8 TimerThread The J3D-TimerThreadmanages: Any number of WakeupOnElapsedTimeobjects, stored in a WakeupOnElaspsedTimeHeap (sorted, resizable array) 1 InputDeviceScheduler(sampling time loaded from Systemproperty) 1 SoundScheduler(WakeupOnElapsedTimeevery 2 minutes, by default) The TimerThreadwill call the setTriggeredmethod on each WakeupOnElapsedTimeas appropriate. 18.9 SceneGraphObject SceneGraphObjectis the base class for all the objects that can be added to a Java 3D scenegraph. It includes a number of interesting capabilities and defines some general architectural principals for Java 3D (such as capability bits and the retained delegate class pattern). The attributes of the SceneGraphObject class are described in more detail next. 324
Note: If you are looking for good and high quality web space to host and run your application check Lunarwebhost Java Web Hosting services