org.ogre4j
Class RenderWindow

java.lang.Object
  extended by org.xbig.base.NativeObject
      extended by org.ogre4j.RenderWindow
All Implemented Interfaces:
IAllocatedObject<IRenderSysAllocPolicy>, IRenderSysAllocatedObject, IRenderTarget, IRenderWindow, INativeObject

public class RenderWindow
extends NativeObject
implements IRenderWindow


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.ogre4j.IRenderTarget
IRenderTarget.IFrameStats, IRenderTarget.IImpl, IRenderTarget.IRenderTargetListenerList, IRenderTarget.IViewportList
 
Field Summary
 
Fields inherited from class org.xbig.base.NativeObject
deleted, object, remote
 
Constructor Summary
  RenderWindow(InstancePointer p)
          This constructor is public for internal useage only!
protected RenderWindow(InstancePointer p, boolean remote)
          Creates a Java wrapper object for an existing C++ object.
  RenderWindow(WithoutNativeObject val)
          Allows creation of Java objects without C++ objects.
 
Method Summary
 IRenderTarget.IImpl _getImpl()
          Get rendersystem specific interface for this .
 void _notifyCameraRemoved(ICamera cam)
          Utility method to notify a render target that a camera has been removed, incase it was referring to it as a viewer.
 void addListener(IRenderTargetListener listener)
          Add a listener to this which will be called back before & after rendering.
 IViewport addViewport(ICamera cam, int ZOrder, float left, float top, float width, float height)
          Adds a viewport to the rendering target.
 void copyContentsToMemory(IPixelBox dst, RenderTarget.FrameBuffer buffer)
          Copies the current contents of the render target to a pixelbox.
 void create(java.lang.String name, long width, long height, boolean fullScreen, INameValuePairList miscParams)
          Creates & displays the new window.
 void delete()
          Deletes the corresponding C++ object.
 void destroy()
          Destroys the window.
 void finalize()
           
 float getAverageFPS()
          Individual stats access - gets the average frames per second (FPS) since call to .
 int getBatchCount()
          Gets the number of batches rendered in the last call.
 float getBestFPS()
          Individual stats access - gets the best frames per second (FPS) since call to .
 float getBestFrameTime()
          Individual stats access - gets the best frame time
 long getColourDepth()
           
 void getCustomAttribute(java.lang.String name, VoidPointer pData)
          Gets a custom (maybe platform-specific) attribute.
 long getFSAA()
          Indicates whether multisampling is performed on rendering and at what level.
 long getHeight()
           
 float getLastFPS()
          Individual stats access - gets the number of frames per second (FPS) based on the last frame rendered.
 void getMetrics(LongPointer width, LongPointer height, LongPointer colourDepth)
           
 void getMetrics(LongPointer width, LongPointer height, LongPointer colourDepth, IntegerPointer left, IntegerPointer top)
          Overloaded version of getMetrics from , including extra details specific to windowing systems.
 java.lang.String getName()
           
 int getNumViewports()
          Returns the number of viewports attached to this target.
 short getPriority()
          Gets the priority of a render target.
 IRenderTarget.IFrameStats getStatistics()
           
 void getStatistics(FloatPointer lastFPS, FloatPointer avgFPS, FloatPointer bestFPS, FloatPointer worstFPS)
          Retieves details of current rendering performance.
 int getTriangleCount()
          Gets the number of triangles rendered in the last call.
 IViewport getViewport(int index)
          Retrieves a pointer to the viewport with the given index.
 long getWidth()
           
 float getWorstFPS()
          Individual stats access - gets the worst frames per second (FPS) since call to .
 float getWorstFrameTime()
          Individual stats access - gets the worst frame time
 boolean isActive()
          Overridden from , flags invisible windows as inactive
 boolean isAutoUpdated()
          Gets whether this target is automatically updated if Ogre's rendering loop or is being used.
 boolean isClosed()
          Indicates whether the window has been closed by the user.
 boolean isDeactivatedOnFocusChange()
          Returns true if the window will automatically de-activate itself when it loses focus.
 boolean isFullScreen()
          Returns true if window is running in fullscreen mode.
 boolean isHardwareGammaEnabled()
          Indicates whether on rendering, linear colour space is converted to sRGB gamma colour space.
 boolean isPrimary()
          Indicates whether the window is the primary window.
 boolean isVisible()
          Indicates whether the window is visible (not minimized or obscured)
 void removeAllListeners()
          Removes all listeners from this instance.
 void removeAllViewports()
          Removes all viewports on this target.
 void removeListener(IRenderTargetListener listener)
          Removes a previously registered using addListener.
 void removeViewport(int ZOrder)
          Removes a viewport at a given ZOrder.
 void reposition(int left, int top)
          Reposition the window.
 boolean requiresTextureFlipping()
           
 void resetStatistics()
          Resets saved frame-rate statistices.
 void resize(long width, long height)
          Alter the size of the window.
 void setActive(boolean state)
          Used to set the active state of the render target.
 void setAutoUpdated(boolean autoupdate)
          Sets whether this target should be automatically updated if Ogre's rendering loop or is being used.
 void setDeactivateOnFocusChange(boolean deactivate)
          Indicates whether the window will automatically deactivate itself when it loses focus.
 void setFullscreen(boolean fullScreen, long width, long height)
          Alter fullscreen mode options.
 void setPriority(short priority)
          Sets the priority of this render target in relation to the others.
 void setVisible(boolean visible)
          Set the visibility state
 PixelFormat suggestPixelFormat()
          Suggests a pixel format to use for extracting the data in this target, when calling copyContentsToMemory.
 void swapBuffers(boolean waitForVSync)
          Swaps the frame buffers to display the next frame.
 void update(boolean swapBuffers)
          Tells the target to update it's contents.
 void windowMovedOrResized()
          Notify that the window has been resized
 void writeContentsToFile(java.lang.String filename)
          Writes the current contents of the render target to the named file.
 java.lang.String writeContentsToTimestampedFile(java.lang.String filenamePrefix, java.lang.String filenameSuffix)
          Writes the current contents of the render target to the (PREFIX)(time-stamp)(SUFFIX) file.
 
Methods inherited from class org.xbig.base.NativeObject
disconnectFromNativeObject, equals, getInstancePointer, hashCode, setInstancePointer, setInstancePointer, setInstancePointer, toString
 
Methods inherited from class java.lang.Object
clone, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.xbig.base.INativeObject
disconnectFromNativeObject, getInstancePointer, setInstancePointer, setInstancePointer, setInstancePointer
 

Constructor Detail

RenderWindow

public RenderWindow(InstancePointer p)
This constructor is public for internal useage only! Do not use it!


RenderWindow

protected RenderWindow(InstancePointer p,
                       boolean remote)
Creates a Java wrapper object for an existing C++ object. If remote is set to 'true' this object cannot be deleted in Java.


RenderWindow

public RenderWindow(WithoutNativeObject val)
Allows creation of Java objects without C++ objects.

See Also:
WithoutNativeObject, INativeObject.disconnectFromNativeObject()
Method Detail

delete

public void delete()
Description copied from interface: INativeObject
Deletes the corresponding C++ object.

Subclasses must implement this but if the native instance was created by the underlying library the native call to dispose must not happen!

Specified by:
delete in interface INativeObject
Specified by:
delete in class NativeObject
See Also:
#remote

finalize

public void finalize()
Overrides:
finalize in class NativeObject

create

public void create(java.lang.String name,
                   long width,
                   long height,
                   boolean fullScreen,
                   INameValuePairList miscParams)
Creates & displays the new window.

Specified by:
create in interface IRenderWindow

setFullscreen

public void setFullscreen(boolean fullScreen,
                          long width,
                          long height)
Alter fullscreen mode options.

Specified by:
setFullscreen in interface IRenderWindow

destroy

public void destroy()
Destroys the window.

Specified by:
destroy in interface IRenderWindow

resize

public void resize(long width,
                   long height)
Alter the size of the window.

Specified by:
resize in interface IRenderWindow

windowMovedOrResized

public void windowMovedOrResized()
Notify that the window has been resized

Specified by:
windowMovedOrResized in interface IRenderWindow

reposition

public void reposition(int left,
                       int top)
Reposition the window.

Specified by:
reposition in interface IRenderWindow

isVisible

public boolean isVisible()
Indicates whether the window is visible (not minimized or obscured)

Specified by:
isVisible in interface IRenderWindow

setVisible

public void setVisible(boolean visible)
Set the visibility state

Specified by:
setVisible in interface IRenderWindow

isActive

public boolean isActive()
Overridden from , flags invisible windows as inactive

Specified by:
isActive in interface IRenderTarget
Specified by:
isActive in interface IRenderWindow

isClosed

public boolean isClosed()
Indicates whether the window has been closed by the user.

Specified by:
isClosed in interface IRenderWindow

isPrimary

public boolean isPrimary()
Indicates whether the window is the primary window. The primary window is special in that it is destroyed when ogre is shut down, and cannot be destroyed directly. This is the case because it holds the context for vertex, index buffers and textures.

Specified by:
isPrimary in interface IRenderTarget
Specified by:
isPrimary in interface IRenderWindow

isFullScreen

public boolean isFullScreen()
Returns true if window is running in fullscreen mode.

Specified by:
isFullScreen in interface IRenderWindow

getMetrics

public void getMetrics(LongPointer width,
                       LongPointer height,
                       LongPointer colourDepth,
                       IntegerPointer left,
                       IntegerPointer top)
Overloaded version of getMetrics from , including extra details specific to windowing systems.

Specified by:
getMetrics in interface IRenderWindow

suggestPixelFormat

public PixelFormat suggestPixelFormat()
Description copied from interface: IRenderTarget
Suggests a pixel format to use for extracting the data in this target, when calling copyContentsToMemory.

Specified by:
suggestPixelFormat in interface IRenderTarget
Specified by:
suggestPixelFormat in interface IRenderWindow

isDeactivatedOnFocusChange

public boolean isDeactivatedOnFocusChange()
Returns true if the window will automatically de-activate itself when it loses focus.

Specified by:
isDeactivatedOnFocusChange in interface IRenderWindow

setDeactivateOnFocusChange

public void setDeactivateOnFocusChange(boolean deactivate)
Indicates whether the window will automatically deactivate itself when it loses focus.

Specified by:
setDeactivateOnFocusChange in interface IRenderWindow

getName

public java.lang.String getName()
Specified by:
getName in interface IRenderTarget

getMetrics

public void getMetrics(LongPointer width,
                       LongPointer height,
                       LongPointer colourDepth)
Specified by:
getMetrics in interface IRenderTarget

getWidth

public long getWidth()
Specified by:
getWidth in interface IRenderTarget

getHeight

public long getHeight()
Specified by:
getHeight in interface IRenderTarget

getColourDepth

public long getColourDepth()
Specified by:
getColourDepth in interface IRenderTarget

update

public void update(boolean swapBuffers)
Tells the target to update it's contents.

Specified by:
update in interface IRenderTarget

swapBuffers

public void swapBuffers(boolean waitForVSync)
Swaps the frame buffers to display the next frame.

Specified by:
swapBuffers in interface IRenderTarget

addViewport

public IViewport addViewport(ICamera cam,
                             int ZOrder,
                             float left,
                             float top,
                             float width,
                             float height)
Adds a viewport to the rendering target.

Specified by:
addViewport in interface IRenderTarget

getNumViewports

public int getNumViewports()
Returns the number of viewports attached to this target.

Specified by:
getNumViewports in interface IRenderTarget

getViewport

public IViewport getViewport(int index)
Retrieves a pointer to the viewport with the given index.

Specified by:
getViewport in interface IRenderTarget

removeViewport

public void removeViewport(int ZOrder)
Removes a viewport at a given ZOrder.

Specified by:
removeViewport in interface IRenderTarget

removeAllViewports

public void removeAllViewports()
Removes all viewports on this target.

Specified by:
removeAllViewports in interface IRenderTarget

getStatistics

public void getStatistics(FloatPointer lastFPS,
                          FloatPointer avgFPS,
                          FloatPointer bestFPS,
                          FloatPointer worstFPS)
Retieves details of current rendering performance.

Specified by:
getStatistics in interface IRenderTarget

getStatistics

public IRenderTarget.IFrameStats getStatistics()
Specified by:
getStatistics in interface IRenderTarget

getLastFPS

public float getLastFPS()
Individual stats access - gets the number of frames per second (FPS) based on the last frame rendered.

Specified by:
getLastFPS in interface IRenderTarget

getAverageFPS

public float getAverageFPS()
Individual stats access - gets the average frames per second (FPS) since call to .

Specified by:
getAverageFPS in interface IRenderTarget

getBestFPS

public float getBestFPS()
Individual stats access - gets the best frames per second (FPS) since call to .

Specified by:
getBestFPS in interface IRenderTarget

getWorstFPS

public float getWorstFPS()
Individual stats access - gets the worst frames per second (FPS) since call to .

Specified by:
getWorstFPS in interface IRenderTarget

getBestFrameTime

public float getBestFrameTime()
Individual stats access - gets the best frame time

Specified by:
getBestFrameTime in interface IRenderTarget

getWorstFrameTime

public float getWorstFrameTime()
Individual stats access - gets the worst frame time

Specified by:
getWorstFrameTime in interface IRenderTarget

resetStatistics

public void resetStatistics()
Resets saved frame-rate statistices.

Specified by:
resetStatistics in interface IRenderTarget

getCustomAttribute

public void getCustomAttribute(java.lang.String name,
                               VoidPointer pData)
Gets a custom (maybe platform-specific) attribute.

Specified by:
getCustomAttribute in interface IRenderTarget

addListener

public void addListener(IRenderTargetListener listener)
Add a listener to this which will be called back before & after rendering.

Specified by:
addListener in interface IRenderTarget

removeListener

public void removeListener(IRenderTargetListener listener)
Removes a previously registered using addListener.

Specified by:
removeListener in interface IRenderTarget

removeAllListeners

public void removeAllListeners()
Removes all listeners from this instance.

Specified by:
removeAllListeners in interface IRenderTarget

setPriority

public void setPriority(short priority)
Sets the priority of this render target in relation to the others.

Specified by:
setPriority in interface IRenderTarget

getPriority

public short getPriority()
Gets the priority of a render target.

Specified by:
getPriority in interface IRenderTarget

setActive

public void setActive(boolean state)
Used to set the active state of the render target.

Specified by:
setActive in interface IRenderTarget

setAutoUpdated

public void setAutoUpdated(boolean autoupdate)
Sets whether this target should be automatically updated if Ogre's rendering loop or is being used.

Specified by:
setAutoUpdated in interface IRenderTarget

isAutoUpdated

public boolean isAutoUpdated()
Gets whether this target is automatically updated if Ogre's rendering loop or is being used.

Specified by:
isAutoUpdated in interface IRenderTarget

copyContentsToMemory

public void copyContentsToMemory(IPixelBox dst,
                                 RenderTarget.FrameBuffer buffer)
Copies the current contents of the render target to a pixelbox.

Specified by:
copyContentsToMemory in interface IRenderTarget

writeContentsToFile

public void writeContentsToFile(java.lang.String filename)
Writes the current contents of the render target to the named file.

Specified by:
writeContentsToFile in interface IRenderTarget

writeContentsToTimestampedFile

public java.lang.String writeContentsToTimestampedFile(java.lang.String filenamePrefix,
                                                       java.lang.String filenameSuffix)
Writes the current contents of the render target to the (PREFIX)(time-stamp)(SUFFIX) file.

Specified by:
writeContentsToTimestampedFile in interface IRenderTarget

requiresTextureFlipping

public boolean requiresTextureFlipping()
Specified by:
requiresTextureFlipping in interface IRenderTarget

getTriangleCount

public int getTriangleCount()
Gets the number of triangles rendered in the last call.

Specified by:
getTriangleCount in interface IRenderTarget

getBatchCount

public int getBatchCount()
Gets the number of batches rendered in the last call.

Specified by:
getBatchCount in interface IRenderTarget

_notifyCameraRemoved

public void _notifyCameraRemoved(ICamera cam)
Utility method to notify a render target that a camera has been removed, incase it was referring to it as a viewer.

Specified by:
_notifyCameraRemoved in interface IRenderTarget

isHardwareGammaEnabled

public boolean isHardwareGammaEnabled()
Indicates whether on rendering, linear colour space is converted to sRGB gamma colour space. This is the exact opposite conversion of what is indicated by , and can only be enabled on creation of the render target. For render windows, it's enabled through the 'gamma' creation misc parameter. For textures, it is enabled through the hwGamma parameter to the create call.

Specified by:
isHardwareGammaEnabled in interface IRenderTarget

getFSAA

public long getFSAA()
Indicates whether multisampling is performed on rendering and at what level.

Specified by:
getFSAA in interface IRenderTarget

_getImpl

public IRenderTarget.IImpl _getImpl()
Get rendersystem specific interface for this . This is used by the to (un)bind this target, and to get specific information like surfaces and framebuffer objects.

Specified by:
_getImpl in interface IRenderTarget


Copyright © 2007 netAllied GmbH. All Rights Reserved.