/[fenfire]/fenfire/org/fenfire/test/gfx.py
ViewVC logotype

Diff of /fenfire/org/fenfire/test/gfx.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.2 by humppake, Tue Mar 11 14:33:44 2003 UTC revision 1.3 by benja, Sun Mar 16 16:24:12 2003 UTC
# Line 1  Line 1 
1  #  #
2  # Copyright (c) 2003, Tuomas J. Lukka  # Copyright (c) 2003, Tuomas J. Lukka
3  #  #
4  # This file is part of Gzz.  # This file is part of Fenfire.
5  #  #
6  # Gzz is free software; you can redistribute it and/or modify it under  # Fenfire is free software; you can redistribute it and/or modify it under
7  # the terms of the GNU Lesser General Public License as published by  # the terms of the GNU Lesser General Public License as published by
8  # the Free Software Foundation; either version 2 of the License, or  # the Free Software Foundation; either version 2 of the License, or
9  # (at your option) any later version.  # (at your option) any later version.
10  #  #
11  # Gzz is distributed in the hope that it will be useful, but WITHOUT  # Fenfire is distributed in the hope that it will be useful, but WITHOUT
12  # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY  # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13  # or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General  # or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General
14  # Public License for more details.  # Public License for more details.
15  #  #
16  # You should have received a copy of the GNU Lesser General  # You should have received a copy of the GNU Lesser General
17  # Public License along with Gzz; if not, write to the Free  # Public License along with Fenfire; if not, write to the Free
18  # Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,  # Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
19  # MA  02111-1307  USA  # MA  02111-1307  USA
20  #  #
# Line 24  Line 24 
24  from jarray import array, zeros  from jarray import array, zeros
25    
26  from java.awt import Color  from java.awt import Color
27  from gzz.vob import *  from org.nongnu.libvob import *
28  from gzz.vob.vobs import *  from org.nongnu.libvob.vobs import *
29  import gzz  
30    import org
31    
32  print "Init test.gfx"  print "Init test.gfx"
 print dir(gzz)  
 print dir(gzz.client)  
33    
34  _didRender = 0  _didRender = 0
35    
36  _realwin = gzz.client.GraphicsAPI.getInstance().createWindow()  _realwin = org.nongnu.libvob.GraphicsAPI.getInstance().createWindow()
37  _realwin.setLocation(0, 0, 600, 600)  _realwin.setLocation(0, 0, 600, 600)
38    
39  if gzz.client.GraphicsAPI.getInstance().getTypeString() == "gl":  if org.nongnu.libvob.GraphicsAPI.getInstance().getTypeString() == "gl":
40      from gzz.gfx.gl import GL      from org.nongnu.libvob.gl import GL
41      if GL.workaroundStupidBuggyAtiDrivers:      if GL.workaroundStupidBuggyAtiDrivers:
42          # Sorry, ATI doesn't let us use pbuffers on R300 except in FireGL.          # Sorry, ATI doesn't let us use pbuffers on R300 except in FireGL.
43          # Because of that, don't put another window in front when using          # Because of that, don't put another window in front when using
44          # this.          # this.
45          win = _realwin          win = _realwin
46      else:      else:
47          win = gzz.client.GraphicsAPI.getInstance().createStableOffscreen(500, 500)          win = org.nongnu.libvob.GraphicsAPI.getInstance().createStableOffscreen(500, 500)
48          from gzz.gfx.gl import GL, GLCache, GLRen          from org.nongnu.libvob.gl import GL, GLCache, GLRen
49          _buf = GL.createByteVector(500*500*3)          _buf = GL.createByteVector(500*500*3)
50          _drawbufvs = _realwin.createVobScene()          _drawbufvs = _realwin.createVobScene()
51          _drawbufvs.map.put(SolidBackdropVob(Color(0, 0, 0.2)))          _drawbufvs.map.put(SolidBackdropVob(Color(0, 0, 0.2)))
# Line 86  def render(vs): Line 85  def render(vs):
85  def getAvgColor(x, y, w, h):  def getAvgColor(x, y, w, h):
86            
87      colors = win.readPixels(x, y, w, h)      colors = win.readPixels(x, y, w, h)
88      color = gzz.util.ColorUtil.avgColor(colors)      color = org.nongnu.libvob.util.ColorUtil.avgColor(colors)
89      return [c*255 for c in color.getComponents(None)]      return [c*255 for c in color.getComponents(None)]
90    
91  def checkAvgColor(x, y, w, h, color, delta=10):  def checkAvgColor(x, y, w, h, color, delta=10):

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26