[glumpy] push by Nicolas.Rougier@gmail.com - Fix gluScroll (issue 19) on 2012-08-17 07:59 GMT

1 view
Skip to first unread message

glu...@googlecode.com

unread,
Aug 17, 2012, 3:59:53 AM8/17/12
to nicolas...@inria.fr
Revision: 65bbaa600f8c
Author: Nicolas Rougier <Nicolas...@inria.fr>
Date: Fri Aug 17 00:59:33 2012
Log: Fix gluScroll (issue 19)

http://code.google.com/p/glumpy/source/detail?r=65bbaa600f8c

Modified:
/demos/axis-2d.py
/doc/introduction.rst
/glumpy/__init__.py
/glumpy/colormap.py
/glumpy/text/font.py
/glumpy/text/label.py
/glumpy/window/backend_glut.py
/setup.py

=======================================
--- /demos/axis-2d.py Tue Jun 26 00:17:22 2012
+++ /demos/axis-2d.py Fri Aug 17 00:59:33 2012
@@ -54,6 +54,11 @@
grid_offset += dx/float(frame.width), dy/float(frame.height)
fig.redraw()

+ @frame.event
+ def on_mouse_scroll(x, y, dx, dy):
+
+ fig.redraw()
+
@frame.event
def on_draw():
frame.lock()
=======================================
--- /doc/introduction.rst Mon Sep 12 07:54:56 2011
+++ /doc/introduction.rst Fri Aug 17 00:59:33 2012
@@ -5,7 +5,6 @@
Introduction

===============================================================================

-
glumpy is a python library for the fast vizualization of numpy arrays
(mainly
two dimensional), that has been designed with efficiency in mind. If you
want
to draw nice figures for inclusion in a scientific article, you'd better
use
@@ -14,7 +13,7 @@


Motivations
------------
+===========
Matplotlib (http://matplotlib.sourceforge.net) is an incredibly useful and
high-quality tool for scientific visualization that is widely used in the
scientific community. However, even if it is possible to animate matplotlib
@@ -28,7 +27,7 @@


How does it work ?
-------------------
+==================
glumpy makes extensive use of OpenGL™ and more specifically it uses
textures to
represent arrays since it is probably the fastest method of visualization
on
modern graphic hardware. However, the drawback is that it implies some
@@ -43,13 +42,19 @@
done entirely on the graphic card, saving CPU time for simulation.

Software requirements
----------------------
+=====================
glumpy is a python package and depends on a number of python components
that
can be easily installed (see instructions on respective homepages):

+Mandatory
+----------
+
* **PyOpenGL**, http://pyopengl.sourceforce.net
* **numpy**, http://numpy.scipy.org

+Optional
+--------
+
Optionaly, here are also some components and tools you might consider
installing:

* **matplotlib**, http://matplotlib.sourceforge.net
@@ -59,7 +64,7 @@


Hardware requirements
----------------------
+=====================
Glumpy uses OpenGL to do all of its rendering using both standard OpenGL
objects and shaders. All images operations (spatial interpolation,
colorization, isoline, etc.) are made using shaders. While this make things
=======================================
--- /glumpy/__init__.py Mon Sep 12 08:00:00 2011
+++ /glumpy/__init__.py Fri Aug 17 00:59:33 2012
@@ -37,6 +37,7 @@
from figure import Figure
from trackball import Trackball
from graphics import VertexBuffer
+from text import Label

from version import version as __version__

=======================================
--- /glumpy/colormap.py Mon Sep 12 08:00:00 2011
+++ /glumpy/colormap.py Fri Aug 17 00:59:33 2012
@@ -62,7 +62,7 @@
self.over = kwargs.get('over', self.get_color(1))
self.bad = kwargs.get('bad', self.bad)
self._update()
-
+

def set_alpha(self, alpha):
''' Set overall transparency. '''
=======================================
--- /glumpy/text/font.py Fri Sep 2 00:09:49 2011
+++ /glumpy/text/font.py Fri Aug 17 00:59:33 2012
@@ -32,7 +32,8 @@
import os
import numpy as np
from freetype import *
-
+from glumpy.text.atlas import Atlas
+from glumpy.text.glyph import Glyph

cached_fonts = {}

@@ -169,12 +170,19 @@

# Generate kerning
for g in self.glyphs.values():
- kerning = face.get_kerning(g.charcode, charcode,
mode=FT_KERNING_UNSCALED)
+ # 64 * 64 because of 26.6 encoding AND the transform
matrix used
+ # in texture_font_load_face (hres = 64)
+ kerning = face.get_kerning(g.charcode, charcode,
mode=FT_KERNING_UNFITTED)
if kerning.x != 0:
- glyph.kerning[g.charcode] = kerning.x
- kerning = face.get_kerning(charcode, g.charcode,
mode=FT_KERNING_UNSCALED)
+ glyph.kerning[g.charcode] = kerning.x/(64.0*64.0)
+ kerning = face.get_kerning(charcode, g.charcode,
mode=FT_KERNING_UNFITTED)
if kerning.x != 0:
- g.kerning[charcode] = kerning.x
+ g.kerning[charcode] = kerning.x/(64.0*64.0)
+
+ # High resolution advance.x calculation
+ # gindex = face.get_char_index( charcode )
+ # a = face.get_advance(gindex, FT_LOAD_RENDER |
FT_LOAD_TARGET_LCD)/(64*72)
+ # glyph.advance = a, glyph.advance[1]



=======================================
--- /glumpy/text/label.py Fri Sep 2 00:09:49 2011
+++ /glumpy/text/label.py Fri Aug 17 00:59:33 2012
@@ -35,8 +35,8 @@
import numpy as np
import OpenGL.GL as gl
import OpenGL.GLUT as glut
-from font import get_font
-from vertex_buffer import VertexBuffer
+from glumpy.text.font import get_font
+from glumpy.graphics import VertexBuffer


class Label(object):
=======================================
--- /glumpy/window/backend_glut.py Tue Jun 26 00:17:22 2012
+++ /glumpy/window/backend_glut.py Fri Aug 17 00:59:33 2012
@@ -43,11 +43,12 @@

# For OSX, see https://github.com/nanoant/osxglut
# GLUT for Mac OS X fork with Core Profile and scroll wheel support
+glutScrollFunc = None
try:
glutScrollFunc = GLUTCallback(
'Scroll', (c_float,c_float), ('delta_x','delta_y'),)
except:
- glutScrollFunc = None
+ pass


def show():
=======================================
--- /setup.py Thu Sep 15 08:04:26 2011
+++ /setup.py Fri Aug 17 00:59:33 2012
@@ -32,6 +32,7 @@
'glumpy.window',
'glumpy.image',
'glumpy.graphics',
+ 'glumpy.text',
'glumpy.atb'],
package_data={'glumpy.image': ['*.vert','*.frag']},
classifiers=CLASSIFIERS)
Reply all
Reply to author
Forward
0 new messages