hej!

  boy.. did i screw up! ? :(

  ok.. i sat back and had a serious redesign of the Cube3D
  application - started using the -Wall option - cleaned up
  all data types etc.

  if i do this:

     scrnBuffer = WinGetDrawWindow();
     backBuffer = WinCreateOffscreenWindow();  
     
  and every time i draw something i do this:

     SetDrawWindow(backBuffer);
     WinDraw...
     SetDrawWindow(scrnBuffer);

  and then forget to do this:

     WinCopyRectangle(backBuffer, scrnBuffer, ...);

  i should get NOTHING on the screen? this is because all the
  drawing occurs to the buffer, and it is never copied to the 
  screen.

  i commented out the WinCopyRectangle, and it still drew to the
  screen. why? because i had done something really STUPID in
  my attempt to try and get this stuff working.

  the problem is WinInitializeWindow()

  here are the specs:

  ---
    Purpose:    Initialize the screen-dependant members of a 
                WindowType structure and set the window's 
                clipping bounds to the window's bounds.

    Prototype:  void WinInitializeWindow(WinHandle winHandle)

    Parameters: winHandle    Handle of a window.

    Result:     Returns nothing.

    See Also:   WinCreateWindow
  ---

  my interpretation was that the scrnBuffer and backBuffer 
  objects would have the same properties.. (as in size, 
  clipping etc)..  

  what i overlooked was that one of these properties was the
  screen address (in memory).

  hence the double buffering did not work. 

  (ie: the backBuffer was the scrnBuffer)

  i should have dug around the header files a bit more to see 
  what the hell this "WindowType" structure was.

---
typedef struct WinTypeStruct {
  Word                  displayWidth;
  Word                  displayHeight;
  VoidPtr               displayAddr;       <---- this!!
  WindowFlagsType       windowFlags;
  RectangleType         windowBounds;
  AbsRectType           clippingBounds;
  PointType             viewOrigin;
  FrameBitsType         frameType;
  GraphicStatePtr       gstate;
  struct WinTypeStruct  *nextWindow;
} WindowType;

typedef WindowType *WinPtr;
typedef WinPtr     WinHandle;
---

  my screw up. removed the function call, and now it all works like
  a dream.

  however, i did find the documentation a bit hard to understand as
  there is no stated relationship between WinHandle and WindowType.
  (maybe there is - but i have not read the whole document yet)

  it is only available if one looks inside the <UI/Window.h>
  header file. 

  at least we know the answer to this question if it pops up again!

  cheers.

az.
--
Aaron Ardiri 
Lecturer                       http://www.hig.se/~ardiri/
University-College i G�vle     mailto:[EMAIL PROTECTED]
SE 801 76 G�vle SWEDEN       
Tel: +46 26 64 87 38           Fax: +46 26 64 87 88
Mob: +46 70 352 8192           A/H: +46 26 10 16 11


Reply via email to