📄 graphicscontext3d.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><!--NewPage--><HTML><HEAD><!-- Generated by javadoc (build 1.5.0_06) on Wed Dec 13 16:20:02 PST 2006 --><TITLE>GraphicsContext3D (Java 3D 1.5.0)</TITLE><META NAME="keywords" CONTENT="javax.media.j3d.GraphicsContext3D class"><LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style"><SCRIPT type="text/javascript">function windowTitle(){ parent.document.title="GraphicsContext3D (Java 3D 1.5.0)";}</SCRIPT><NOSCRIPT></NOSCRIPT></HEAD><BODY BGCOLOR="white" onload="windowTitle();"><!-- ========= START OF TOP NAVBAR ======= --><A NAME="navbar_top"><!-- --></A><A HREF="#skip-navbar_top" title="Skip navigation links"></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""><TR><TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"><A NAME="navbar_top_firstrow"><!-- --></A><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> </TR></TABLE></TD><TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM></EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../javax/media/j3d/GraphicsConfigTemplate3D.html" title="class in javax.media.j3d"><B>PREV CLASS</B></A> <A HREF="../../../javax/media/j3d/GraphStructureChangeListener.html" title="interface in javax.media.j3d"><B>NEXT CLASS</B></A></FONT></TD><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../index.html?javax/media/j3d/GraphicsContext3D.html" target="_top"><B>FRAMES</B></A> <A HREF="GraphicsContext3D.html" target="_top"><B>NO FRAMES</B></A> <SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>'); } //--></SCRIPT><NOSCRIPT> <A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A></NOSCRIPT></FONT></TD></TR><TR><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY: NESTED | <A HREF="#field_summary">FIELD</A> | CONSTR | <A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">DETAIL: <A HREF="#field_detail">FIELD</A> | CONSTR | <A HREF="#method_detail">METHOD</A></FONT></TD></TR></TABLE><A NAME="skip-navbar_top"></A><!-- ========= END OF TOP NAVBAR ========= --><HR><!-- ======== START OF CLASS DATA ======== --><H2><FONT SIZE="-1">javax.media.j3d</FONT><BR>Class GraphicsContext3D</H2><PRE>java.lang.Object <IMG SRC="../../../resources/inherit.gif" ALT="extended by "><B>javax.media.j3d.GraphicsContext3D</B></PRE><HR><DL><DT><PRE>public class <B>GraphicsContext3D</B><DT>extends java.lang.Object</DL></PRE><P>A GraphicsContext3D object is used for immediate mode rendering into a 3D canvas. It is created by, and associated with, a specific Canvas3D object. A GraphicsContext3D defines methods to set 3D graphics state and draw 3D geometric primitives. There are no public constructors of GraphicsContext3D. An application obtains a 3D graphics context object from the Canvas3D object that the application wishes to render into by using the getGraphicsContext3D method. A new graphics context is created if one does not already exist. A new GraphicsContext3D initializes its state variables to the following defaults: <UL> <LI> Background object: null </LI> <LI> Fog object: null </LI> <LI> ModelClip object: null </LI> <LI> Appearance object: null </LI> <LI> List of Light objects: empty </LI> <LI> high-res coordinate: (0, 0, 0) </LI> <LI> modelTransform: identity </LI> <LI> AuralAttributes object: null </LI> <LI> List of Sound objects: empty </LI> <LI> buffer override: false </LI> <LI> front buffer rendering: false </LI> <LI> stereo mode: <code>STEREO_BOTH</code> </LI> </UL> <p> Note that the drawing methods in this class are not necessarily executed immediately. They may be buffered up for future execution. Applications must call the <code><a href="#flush(boolean)">flush</a>(boolean)</code> method to ensure that the rendering actually happens. The flush method is implicitly called in the following cases: <ul> <li>The <code>readRaster</code> method calls <code>flush(true)</code></li> <li>The <code>Canvas3D.swap</code> method calls <code>flush(true)</code></li> <li>The Java 3D renderer calls <code>flush(true)</code> prior to swapping the buffer for a double buffered on-screen Canvas3D</li> <li>The Java 3D renderer calls <code>flush(true)</code> prior to copying into the off-screen buffer of an off-screen Canvas3D</li> <li>The Java 3D renderer calls <code>flush(false)</code> after calling the preRender, renderField, postRender, and postSwap Canvas3D callback methods.</li> </ul> <p> A single-buffered, pure-immediate mode application must explicitly call flush to ensure that the graphics will be rendered to the Canvas3D.<P><P><DL><DT><B>See Also:</B><DD><A HREF="../../../javax/media/j3d/Canvas3D.html#getGraphicsContext3D()"><CODE>Canvas3D.getGraphicsContext3D()</CODE></A></DL><HR><P><!-- =========== FIELD SUMMARY =========== --><A NAME="field_summary"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"><B>Field Summary</B></FONT></TH></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static int</CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/media/j3d/GraphicsContext3D.html#STEREO_BOTH">STEREO_BOTH</A></B></CODE><BR> Specifies that rendering is done to both eyes.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static int</CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/media/j3d/GraphicsContext3D.html#STEREO_LEFT">STEREO_LEFT</A></B></CODE><BR> Specifies that rendering is done to the left eye.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static int</CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/media/j3d/GraphicsContext3D.html#STEREO_RIGHT">STEREO_RIGHT</A></B></CODE><BR> Specifies that rendering is done to the right eye.</TD></TR></TABLE> <!-- ========== METHOD SUMMARY =========== --><A NAME="method_summary"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"><B>Method Summary</B></FONT></TH></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/media/j3d/GraphicsContext3D.html#addLight(javax.media.j3d.Light)">addLight</A></B>(<A HREF="../../../javax/media/j3d/Light.html" title="class in javax.media.j3d">Light</A> light)</CODE><BR> Appends the specified light to this graphics context's list of lights.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/media/j3d/GraphicsContext3D.html#addSound(javax.media.j3d.Sound)">addSound</A></B>(<A HREF="../../../javax/media/j3d/Sound.html" title="class in javax.media.j3d">Sound</A> sound)</CODE><BR> Appends the specified sound to this graphics context's list of sounds.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/media/j3d/GraphicsContext3D.html#clear()">clear</A></B>()</CODE><BR> Clear the Canvas3D to the color or image specified by the current background node.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/media/j3d/GraphicsContext3D.html#draw(javax.media.j3d.Geometry)">draw</A></B>(<A HREF="../../../javax/media/j3d/Geometry.html" title="class in javax.media.j3d">Geometry</A> geometry)</CODE><BR> Draw the specified Geometry component object.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/media/j3d/GraphicsContext3D.html#draw(javax.media.j3d.Shape3D)">draw</A></B>(<A HREF="../../../javax/media/j3d/Shape3D.html" title="class in javax.media.j3d">Shape3D</A> shape)</CODE><BR> Draw the specified Shape3D leaf node object.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/media/j3d/GraphicsContext3D.html#flush(boolean)">flush</A></B>(boolean wait)</CODE><BR> Flushes all previously executed rendering operations to the drawing buffer for this 3D graphics context.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> java.util.Enumeration</CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/media/j3d/GraphicsContext3D.html#getAllLights()">getAllLights</A></B>()</CODE><BR> Retrieves the enumeration object of all the lights.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> java.util.Enumeration</CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/media/j3d/GraphicsContext3D.html#getAllSounds()">getAllSounds</A></B>()</CODE><BR> Retrieves the enumeration object of all the sounds.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../../javax/media/j3d/Appearance.html" title="class in javax.media.j3d">Appearance</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/media/j3d/GraphicsContext3D.html#getAppearance()">getAppearance</A></B>()</CODE><BR> Retrieves the current Appearance component object.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../../javax/media/j3d/AuralAttributes.html" title="class in javax.media.j3d">AuralAttributes</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/media/j3d/GraphicsContext3D.html#getAuralAttributes()">getAuralAttributes</A></B>()</CODE><BR> Retrieves the current AuralAttributes component object.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../../javax/media/j3d/Background.html" title="class in javax.media.j3d">Background</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/media/j3d/GraphicsContext3D.html#getBackground()">getBackground</A></B>()</CODE><BR> Retrieves the current Background leaf node object.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> boolean</CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/media/j3d/GraphicsContext3D.html#getBufferOverride()">getBufferOverride</A></B>()</CODE><BR> Returns the current buffer override flag.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../../javax/media/j3d/Canvas3D.html" title="class in javax.media.j3d">Canvas3D</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/media/j3d/GraphicsContext3D.html#getCanvas3D()">getCanvas3D</A></B>()</CODE>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -