home
 
 index of namespace default
 
 index of project tksdl
 
 index of module tksdl

Class tksdl.Viewport


SynopsisStatic wrapper class for a couple of viewport related functions

  Base classes:
  Methods: See also:  


Method beginPaint
Begin painting
Signature
beginPaint()
Description

Set viewport cliprect. Reset texture and modelview matrices to identity.

 
 top of page
Method close
Close desktop or fullscreen window
Signature
close()

 
 top of page
Method endPaint
Flush GL commandlist and swap buffers
Signature
endPaint()

 
 top of page
Method getDepth
Query color depth
Signature
getDepth():int
Returns
intNumber of pixels (15,16,24,32)

 
 top of page
Method getDesktopHeight
Query desktop height
Signature
getDesktopHeight():int
Returns
int

 
 top of page
Method getDesktopWidth
Query desktop width
Signature
getDesktopWidth():int
Returns
int

 
 top of page
Method getDoubleBuffer
Query whether a double buffered OpenGL surface shall be allocated
Signature
getDoubleBuffer():boolean
Returns
boolean

 
 top of page
Method getEnableGLError
Query whether GL error reporting (see setEnableGLError()) is currently enabled.
Signature
getEnableGLError():boolean
Returns
booleanStatus of GL error tracer

 
 top of page
Method getFlags
Query openWindow() resp. openScreen() flags
Signature
getFlags():int
Returns
int

 
 top of page
Method getFrequency
Query monitor frequency
Signature
getFrequency():int
Returns
int

 
 top of page
Method getHeight
Query window/screen height
Signature
getHeight():int
Returns
int

 
 top of page
Method getMultisampleBuffers
Query number of GL multisample buffers
Signature
getMultisampleBuffers():int
Returns
int

 
 top of page
Method getMultisampleSamples
Query number of GL multisample samples
Signature
getMultisampleSamples():int
Returns
int

 
 top of page
Method getWidth
Query window/screen width
Signature
getWidth():int
Returns
int

 
 top of page
Method interruptScreenSaver
Try to interrupt the screensaver, usually by sending a synthetic event to the root/desktop window.
Signature
interruptScreenSaver()

 
 top of page
Method needRedraw
If the repaint strategy is REDRAW_DIRTY, this will cause a display redraw.
Signature
needRedraw()

 
 top of page
Method openScreen
Open fullscreen window
Signature
openScreen(intw,
  inth,
  intz 
  )  
 :boolean
Arguments
intwScreen width
inthScreen height
intz16,24,32 bits
Returns
booleantrue if the screen has been opened, false if something went terribly wrong.
Description

This is a wrapper for the SDL_InitSubSystem(), SDL_GetVideoInfo(), SDL_GL_SetAttribute() and SDL_SetVideoMode() native functions.
See also:  


 
 top of page
Method openWindow
Open desktop window.
Signature
openWindow(intw,
  inth 
  )  
 :boolean
Arguments
intwWindow width
inthWindow height
Returns
booleantrue if the window has been opened, false if something went terribly wrong.
Description

This is a wrapper for the SDL_InitSubSystem(), SDL_GetVideoInfo(), SDL_GL_SetAttribute() and SDL_SetVideoMode() native functions.
See also:  


 
 top of page
Method resizeWindow
Resize desktop window
Signature
resizeWindow(intw,
  inth 
  )  
 :boolean
Arguments
intw
inth
Returns
boolean

 
 top of page
Method setCaption
Set window title
Signature
setCaption():String
Returns
String

 
 top of page
Method setDoubleBuffer
Hint that a double buffered OpenGL surface shall be allocated
Signature
setDoubleBuffer(booleanbEnabled)
Arguments
booleanbEnabled
Description

This method should only be called prior to opening a window or screen.

 
 top of page
Method setEnableGLError
Enable/disable GL error reporting (default=false).
Signature
setEnableGLError(booleanbEnabled)
Arguments
booleanbEnabledtrue=enable glGetError() calls after each GL call outside of glBegin..glEnd. false=never call glGetError.
Description

Please notice that with some GL drivers (noticably the latest Win32 GF 9800 GT driver on Vista/32bit), a simple call to glGetError() will take 16ms at a ~60 FPS refresh rate after ~60 frames / glFlush() / SwapBuffers() calls have been made.
This didn't happen with older driver releases although there are internet discussions about this going back to 2006. FIX IT, NVIDIA!!
GL error reporting can also be enabled using the TKSDL_GLERROR environment variable (0=disable, 1=enable).

 
 top of page
Method setEnableRendering
Mainly for debugging purposes / CPU load measurement
Signature
setEnableRendering(booleanbEnabled)
Arguments
booleanbEnabled

 
 top of page
Method setFlags
Set flags for openWindow() resp. openScreen() call
Signature
setFlags(intflags)
Arguments
intflagsA bitmask of SDL_RESIZABLE and SDL_NOFRAME.
Description

This method should only be called prior to opening a window or screen.

 
 top of page
Method setMultisampleBuffers
Set number of GL multisample buffers.
Signature
setMultisampleBuffers(intnum)
Arguments
intnum
Description

This method should only be called prior to opening a window or screen.

 
 top of page
Method setMultisampleSamples
Set number of GL multisample samples
Signature
setMultisampleSamples(intnum)
Arguments
intnum
Description

This method should only be called prior to opening a window or screen.

 
 top of page
Method setScreenResolution
Set fullscreen resolution and depth for next toggleFullScreen() call
Signature
setScreenResolution(intw,
  inth,
  intz 
  )  
Arguments
intw
inth
intz

 
 top of page
Method setStencilBits
Set number of stencil buffer bits
Signature
setStencilBits(intnum)
Arguments
intnum
Description

This method should only be called prior to opening a window or screen.

 
 top of page
Method swapInterval
A wrapper for the wglSwapIntervalEXT() resp. glXSwapIntervalSGI() native functions
Signature
swapInterval(intinterval)
Arguments
intinterval0=disable vsync, 1=enable vsync, 2..n only swap buffers every 2..nth frame.
Description

This function can effectively be used to disable or enable vertical blank synchronisation and it is, to my knowledge, the best way to achieve absolutely smooth vsync'd OpenGL graphics.
In practice, the ATI/NVidia GL drivers act a bit different than how this GL extension was originally specified (different in a good sense).

 
 top of page
Method toggleFullScreen
Toggle fullscreen mode
Signature
toggleFullScreen()
See also:  


 
 top of page
Method waitVBlank
Deprecated:  Not the optimal way to achieve absolutely smooth scrolling with OpenGL. Use swapInterval()() instead.
Wait for vertical retrace interrupt
Signature
waitVBlank()
See also:  


 
 top of page
 

Project Modules:tksdl 
Project Classes:AudioDevice , AudioSample , Cursor , FPS , Joystick , Key , Mouse , SamplePlayer , SDL , Viewport 
Project Functions:MIDINoteToFrequency 
All Namespaces:default , ui 
All Projects:core , debugtext , tkfreetype2 , tkmath , tkmidi , tkopengl , tkportaudio , tksdl , tkui , tkunit 


auto-generated by "DOG", the TkScript document generator. Mon, 28/Dec/2015 13:15:54