vertex_array_range.py :  » Game-2D-3D » PyOpenGL » PyOpenGL-3.0.1 » OpenGL » GL » APPLE » Python Open Source

Home
Python Open Source
1.3.1.2 Python
2.Ajax
3.Aspect Oriented
4.Blog
5.Build
6.Business Application
7.Chart Report
8.Content Management Systems
9.Cryptographic
10.Database
11.Development
12.Editor
13.Email
14.ERP
15.Game 2D 3D
16.GIS
17.GUI
18.IDE
19.Installer
20.IRC
21.Issue Tracker
22.Language Interface
23.Log
24.Math
25.Media Sound Audio
26.Mobile
27.Network
28.Parser
29.PDF
30.Project Management
31.RSS
32.Search
33.Security
34.Template Engines
35.Test
36.UML
37.USB Serial
38.Web Frameworks
39.Web Server
40.Web Services
41.Web Unit
42.Wiki
43.Windows
44.XML
Python Open Source » Game 2D 3D » PyOpenGL 
PyOpenGL » PyOpenGL 3.0.1 » OpenGL » GL » APPLE » vertex_array_range.py
'''OpenGL extension APPLE.vertex_array_range

This module customises the behaviour of the 
OpenGL.raw.GL.APPLE.vertex_array_range to provide a more 
Python-friendly API

Overview (from thespec import 
  
  This extension is designed to allow very high vertex processing rates which
  are facilitated both by relieving the CPU of as much processing burden as
  possible and by allowing graphics hardware to directly access vertex data.
  Because this extension is implemented as an addition to the vertex array
  specification provided by OpenGL 1.1, applications can continue to use
  existing vertex submission logic while taking advantage of vertex array
  ranges to more efficiently process those arrays.
  
  The vertex array coherency model provided by OpenGL 1.1 requires that
  vertex data specified in vertex arrays be transferred from systemmemory import 
  each time Begin, DrawArrays, or DrawElements is called.  Further, OpenGL
  1.1 requires that the transfer of data be completed by the time End,
  DrawArrays, or DrawElements returns.  Both of these requirements are
  relaxed by the vertex array range extension.  Vertex data may be cached
  by the GL so there is no guarantee that changes to the vertex data will
  be reflected in following drawing commands unless it is flushed with
  FlushVertexArrayRangeAPPLE.  The reading of vertex data may be deferred 
  by the GL so there is no guarantee that the GL will be finished reading
  the data until completion is forced by the use of Finish or the APPLE_fence
  extension.
  
  EnableClientState must be used with the VERTEX_ARRAY_RANGE_APPLE param to
  enable vertex array range.  Once this is done use of vertex array range
  requires the definition of a specific memory range for vertex data through
  VertexArrayRangeAPPLE.  It is recommended this data be page aligned (4096
  byte boundaries) and a multiple of page size in length for maximum
  efficiency in data handling and internal flushing, but this is not a
  requirement and any location and length of data can be defined as a vertex
  array.  This extension provides no memory allocators as any convenient
  memory allocator can be used.
  
  Once a data set is established, using VertexArrayRangeAPPLE, it can be can
  be drawn using standard OpenGL vertex array commands, as one would do
  without this extension.  Note, if any the data for any enabled array for a
  given array element index falls outside of the vertex array range, an
  undefined vertex is generated.  One should also understand removing or
  replacing all calls to vertex array range functions with no-ops or disabling
  the vertex array range by disabling the VERTEX_ARRAY_RANGE_APPLE client
  state should not change the results of an application's OpenGL drawing.
  
  For static data no addition coherency nor synchronization must be done and
  the client is free to draw with the specified draw as it sees fit.
  
  If data is dynamic, thus to be modified, FlushVertexArrayRangeAPPLE should
  be used.  The command is issued when data has been modified since the last
  call to VertexArrayRangeAPPLE or FlushVertexArrayRangeAPPLE and prior to
  drawing with such data. FlushVertexArrayRangeAPPLE only provides memory
  coherency prior to drawing (such as ensuring CPU caches are flushed or VRAM
  cached copies are updated) and does not provide any synchronization with
  previously issued drawing commands. The range flushed can be the specific
  range modified and does not have to be the entire vertex array range.
  Additionally, data maybe read immediately after a flush without need for
  further synchronization, thus overlapping areas of data maybe read, modified
  and written between two successive flushings and the data will be
  consistent.
  
  To synchronize data modification after drawing two methods can be used. A
  Finish command can be issued which will not return until all previously
  issued commands are complete, forcing completely synchronous operation.
  While this guarantees all drawing is complete it may not be the optimal
  solution for clients which just need to ensure drawing with the vertex array
  range or a specific range with the array is compete.  The APPLE_fence
  extension can be used when dynamic data modifications need to be
  synchronized with drawing commands. Specifically, if data is to be modified,
  a fence can be set immediately after drawing with the data.  Once it comes
  time to modify the data, the application must test (or finish) this fence to
  ensure the drawing command has completed. Failure to do this could result in
  new data being used by the previously issued drawing commands.  It should be
  noted that providing the maximum time between the drawing set fence and the
  modification test/finish fence allows the most asynchronous behavior and
  will result in the least stalling waiting for drawing completion. Techniques
  such as double buffering vertex data can be used to help further prevent
  stalls based on fence completion but are beyond the scope of this extension.
  
  Once an application is finished with a specific vertex array range or at
  latest prior to exit, and prior to freeing the memory associated with this
  vertex array, the client should call VertexArrayRangeAPPLE with a data
  location and length of 0 to allow the internal memory managers to complete
  any commitments for the array range.  In this case once
  VertexArrayRangeAPPLE returns it is safe to de-allocate the memory.
  
  An additional option is presented for vertex array ranges, the ability of
  the client to hint to OpenGL the type of access and/or use the vertex array
  memory is expected to have, by using VertexArrayParameteriAPPLE with either
  of the STORAGE_CACHED_APPLE or STORAGE_SHARED_APPLE parameter.  By default,
  all vertex array ranges are considered to be "shared".  These options allow
  the tuning of memory handling by OpenGL.  "Shared" memory is normally used
  for dynamic data that is expected to be modified and is likely mapped to AGP
  space for access by the graphics hardware and client.  "Cached" memory is
  designed to support static data and could be cached into to VRAM to provide
  the maximum access bandwidth for the vertex array.  Note, these hints can
  affect how array flushes are handled and the overhead associated with
  flushing the array, it is recommended that data be left as "shared" unless
  it really is static and there are no plans to modify it.
  
  To summarize the vertex array range extension provides relaxed
  synchronization rules for handling vertex array data allowing high bandwidth
  asynchronous data transfer from clientmemorytographicshardware. import 
  Different flushing and synchronization rules are required to ensure data
  coherency when modifying data.  Lastly, memory handling hints are provided
  to allow the tunning of memory storage and access for maximum efficiency.

The official definition of this extension is available here:
http://www.opengl.org/registry/specs/APPLE/vertex_array_range.txt
'''
from OpenGL import platform,constants,constant,arrays
from OpenGL import extensions,wrapper
from OpenGL.GL import glget
import ctypes
from OpenGL.raw.GL.APPLE.vertex_array_range import *
### END AUTOGENERATED SECTION
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.