[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r10573 - gnuradio/branches/developers/jblum/gui_guts/g
From: |
jblum |
Subject: |
[Commit-gnuradio] r10573 - gnuradio/branches/developers/jblum/gui_guts/gr-wxgui/src/python/plotter |
Date: |
Sat, 7 Mar 2009 04:11:45 -0700 (MST) |
Author: jblum
Date: 2009-03-07 04:11:44 -0700 (Sat, 07 Mar 2009)
New Revision: 10573
Modified:
gnuradio/branches/developers/jblum/gui_guts/gr-wxgui/src/python/plotter/grid_plotter_base.py
Log:
Switched draw_grid_line to use GL_LINES over line stipple,
and manually calculate the dash points.
intel graphics driver seems to have a stipple bug when rendering the color.
Modified:
gnuradio/branches/developers/jblum/gui_guts/gr-wxgui/src/python/plotter/grid_plotter_base.py
===================================================================
---
gnuradio/branches/developers/jblum/gui_guts/gr-wxgui/src/python/plotter/grid_plotter_base.py
2009-03-07 08:15:46 UTC (rev 10572)
+++
gnuradio/branches/developers/jblum/gui_guts/gr-wxgui/src/python/plotter/grid_plotter_base.py
2009-03-07 11:11:44 UTC (rev 10573)
@@ -38,6 +38,7 @@
POINT_LABEL_FONT_SIZE = 8
POINT_LABEL_COLOR_SPEC = (1, 1, .5)
POINT_LABEL_PADDING = 3
+GRID_LINE_DASH_LEN = 4
##################################################
# Grid Plotter Base Class
@@ -63,7 +64,15 @@
self.enable_point_label(False)
self.set_point_label_coordinate(None)
common.point_label_thread(self)
+ #init grid plotter
+ self.register_init(self._init_grid_plotter)
+ def _init_grid_plotter(self):
+ """
+ Run gl initialization tasks.
+ """
+ GL.glEnableClientState(GL.GL_VERTEX_ARRAY)
+
def set_point_label_coordinate(self, coor):
"""
Set the point label coordinate.
@@ -198,10 +207,9 @@
##################################################
# Draw Grid X
##################################################
- GL.glColor3f(*GRID_LINE_COLOR_SPEC)
for tick, label in x_tick_labels:
scaled_tick =
(self.width-self.padding_left-self.padding_right)*\
-
(tick/self.x_scalar-self.x_min)/(self.x_max-self.x_min) + self.padding_left-1
+
(tick/self.x_scalar-self.x_min)/(self.x_max-self.x_min) + self.padding_left
self._draw_grid_line(
(scaled_tick, self.padding_top),
(scaled_tick, self.height-self.padding_bottom),
@@ -211,7 +219,6 @@
##################################################
# Draw Grid Y
##################################################
- GL.glColor3f(*GRID_LINE_COLOR_SPEC)
for tick, label in y_tick_labels:
scaled_tick =
(self.height-self.padding_top-self.padding_bottom)*\
(1 -
(tick/self.y_scalar-self.y_min)/(self.y_max-self.y_min)) + self.padding_top
@@ -304,13 +311,17 @@
@param corr2 a tuple of x, y
"""
if not self.enable_grid_lines(): return
- GL.glEnable(GL.GL_LINE_STIPPLE)
- GL.glLineStipple(1, int("1110" + "0000" + "1110" + "0000", 2))
- GL.glBegin(GL.GL_LINES)
- GL.glVertex2f(*coor1)
- GL.glVertex2f(*coor2)
- GL.glEnd()
- GL.glDisable(GL.GL_LINE_STIPPLE)
+ length = math.sqrt((coor1[0] - coor2[0])**2 + (coor1[1] -
coor2[1])**2)
+ num_points = int(length/GRID_LINE_DASH_LEN)
+ #calculate points array
+ points = [(
+ coor1[0] + i*(coor2[0]-coor1[0])/(num_points - 1),
+ coor1[1] + i*(coor2[1]-coor1[1])/(num_points - 1)
+ ) for i in range(num_points)]
+ #set color and draw
+ GL.glColor3f(*GRID_LINE_COLOR_SPEC)
+ GL.glVertexPointerf(points)
+ GL.glDrawArrays(GL.GL_LINES, 0, len(points))
def _draw_rect(self, x, y, width, height, fill=True):
"""
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r10573 - gnuradio/branches/developers/jblum/gui_guts/gr-wxgui/src/python/plotter,
jblum <=