[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r9272 - gnuradio/branches/developers/jblum/glwxgui/gr-
From: |
jblum |
Subject: |
[Commit-gnuradio] r9272 - gnuradio/branches/developers/jblum/glwxgui/gr-wxgui/src/python/plotter |
Date: |
Wed, 13 Aug 2008 20:07:40 -0600 (MDT) |
Author: jblum
Date: 2008-08-13 20:07:39 -0600 (Wed, 13 Aug 2008)
New Revision: 9272
Modified:
gnuradio/branches/developers/jblum/glwxgui/gr-wxgui/src/python/plotter/waterfall_plotter.py
Log:
non power of 2 fft in waterfall
Modified:
gnuradio/branches/developers/jblum/glwxgui/gr-wxgui/src/python/plotter/waterfall_plotter.py
===================================================================
---
gnuradio/branches/developers/jblum/glwxgui/gr-wxgui/src/python/plotter/waterfall_plotter.py
2008-08-14 01:49:30 UTC (rev 9271)
+++
gnuradio/branches/developers/jblum/glwxgui/gr-wxgui/src/python/plotter/waterfall_plotter.py
2008-08-14 02:07:39 UTC (rev 9272)
@@ -25,6 +25,7 @@
from gnuradio.wxgui import common
import numpy
import gltext
+import math
LEGEND_LEFT_PAD = 7
LEGEND_NUM_BLOCKS = 256
@@ -34,6 +35,8 @@
LEGEND_BORDER_COLOR_SPEC = (0, 0, 0) #black
PADDING = 35, 60, 40, 60 #top, right, bottom, left
+ceil_log2 = lambda x: 2**int(math.ceil(math.log(x)/math.log(2)))
+
def _get_rbga(red_pts, green_pts, blue_pts, alpha_pts=[(0, 0), (1, 0)]):
"""!
Get an array of 256 rgba values where each index maps to a color.
@@ -155,17 +158,18 @@
float(self.height-self.padding_top-self.padding_bottom-1),
1.0,
)
- #draw texture in 2 pieces
+ #draw texture with wrapping
glBegin(GL_QUADS)
- prop = float(self._pointer)/(self._num_lines-1)
+ prop_y = float(self._pointer)/(self._num_lines-1)
+ prop_x = float(self._fft_size)/ceil_log2(self._fft_size)
off = 1.0/(self._num_lines-1)
- glTexCoord2f(0, prop+1-off)
+ glTexCoord2f(0, prop_y+1-off)
glVertex2f(0, 1)
- glTexCoord2f(1, prop+1-off)
+ glTexCoord2f(prop_x, prop_y+1-off)
glVertex2f(1, 1)
- glTexCoord2f(1, prop)
+ glTexCoord2f(prop_x, prop_y)
glVertex2f(1, 0)
- glTexCoord2f(0, prop)
+ glTexCoord2f(0, prop_y)
glVertex2f(0, 0)
glEnd()
glPopMatrix()
@@ -222,7 +226,7 @@
if self._num_lines and self._fft_size:
glBindTexture(GL_TEXTURE_2D, self._waterfall_texture)
data = numpy.zeros(self._num_lines*self._fft_size*4,
numpy.uint8).tostring()
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, self._fft_size,
self._num_lines, 0, GL_RGBA, GL_UNSIGNED_BYTE, data)
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA,
ceil_log2(self._fft_size), self._num_lines, 0, GL_RGBA, GL_UNSIGNED_BYTE, data)
self._resize_texture_flag = False
def set_color_mode(self, color_mode):
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r9272 - gnuradio/branches/developers/jblum/glwxgui/gr-wxgui/src/python/plotter,
jblum <=