[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r9146 - in gnuradio/branches/features/experimental-gui
From: |
jblum |
Subject: |
[Commit-gnuradio] r9146 - in gnuradio/branches/features/experimental-gui: . plotter |
Date: |
Fri, 1 Aug 2008 17:11:26 -0600 (MDT) |
Author: jblum
Date: 2008-08-01 17:11:25 -0600 (Fri, 01 Aug 2008)
New Revision: 9146
Modified:
gnuradio/branches/features/experimental-gui/grc_waterfallsink_test.py
gnuradio/branches/features/experimental-gui/plotter/waterfall_plotter.py
gnuradio/branches/features/experimental-gui/waterfall_window.py
Log:
blitting waterfall
Modified: gnuradio/branches/features/experimental-gui/grc_waterfallsink_test.py
===================================================================
--- gnuradio/branches/features/experimental-gui/grc_waterfallsink_test.py
2008-08-01 21:35:50 UTC (rev 9145)
+++ gnuradio/branches/features/experimental-gui/grc_waterfallsink_test.py
2008-08-01 23:11:25 UTC (rev 9146)
@@ -81,7 +81,7 @@
ref_level=-20,
sample_rate=samp_rate,
fft_size=512,
- frame_rate=30,
+ frame_rate=7,
average=False,
avg_alpha=None,
title="Waterfall Plot",
Modified:
gnuradio/branches/features/experimental-gui/plotter/waterfall_plotter.py
===================================================================
--- gnuradio/branches/features/experimental-gui/plotter/waterfall_plotter.py
2008-08-01 21:35:50 UTC (rev 9145)
+++ gnuradio/branches/features/experimental-gui/plotter/waterfall_plotter.py
2008-08-01 23:11:25 UTC (rev 9146)
@@ -40,12 +40,8 @@
"""
#init
grid_plotter_base.__init__(self, parent, PADDING)
- self._fft_size = None #must be None on init
- self._num_frames = 256
- self._frame_ptr = 0
+ self._num_frames = 128
self._buffer_init = False
- self._waterfall_buffer_top = GLuint(0)
- self._waterfall_buffer_bottom = GLuint(0)
self._data_queue = list()
def _gl_init(self):
@@ -53,8 +49,6 @@
Run gl initialization tasks.
"""
self._grid_compiled_list_id = glGenLists(1)
- glGenBuffers(1, self._waterfall_buffer_top)
- glGenBuffers(1, self._waterfall_buffer_bottom)
self._buffer_init = True
def draw(self):
@@ -62,50 +56,56 @@
Draw the grid and waveforms.
"""
self.semaphore.acquire(True)
- self.clear()
- #store the grid drawing operations
- if self.changed():
- glNewList(self._grid_compiled_list_id, GL_COMPILE)
- self._draw_grid()
- glEndList()
- self.changed(False)
- #draw the grid
- glCallList(self._grid_compiled_list_id)
- #use scissor to prevent drawing outside grid
- glEnable(GL_SCISSOR_TEST)
- glScissor(
- self.padding_left+1,
- self.padding_bottom+1,
- self.width-self.padding_left-self.padding_right-1,
- self.height-self.padding_top-self.padding_bottom-1,
- )
- #draw the waterfall
- self._draw_waterfall()
- glDisable(GL_SCISSOR_TEST)
- #swap buffer into display
- self.SwapBuffers()
+ while self._data_queue:
+ data = self._data_queue.pop(0)
+ self.clear()
+ #store the grid drawing operations
+ if self.changed():
+ glNewList(self._grid_compiled_list_id,
GL_COMPILE)
+ self._draw_grid()
+ glEndList()
+ self.changed(False)
+ #draw the grid
+ glCallList(self._grid_compiled_list_id)
+ #use scissor to prevent drawing outside grid
+ glEnable(GL_SCISSOR_TEST)
+ glScissor(
+ self.padding_left+1,
+ self.padding_bottom+1,
+
self.width-self.padding_left-self.padding_right-1,
+
self.height-self.padding_top-self.padding_bottom-1,
+ )
+ #draw the waterfall
+ self._draw_waterfall(data)
+ glDisable(GL_SCISSOR_TEST)
+ #swap buffer into display
+ self.SwapBuffers()
self.semaphore.release()
- def _draw_waterfall(self):
+ def _draw_waterfall(self, data):
"""!
Draw the waterfall display using pixels from the PBO.
The pixels will be scaled to fit within the grid area.
"""
- self._update_data()
- if self._fft_size is None: return
+ fft_size = len(data)/4
#pixel zoom
- x_zoom =
float(self.width-self.padding_left-self.padding_right)/self._fft_size
+ x_zoom =
float(self.width-self.padding_left-self.padding_right)/fft_size
y_zoom =
float(self.height-self.padding_top-self.padding_bottom+1)/self._num_frames
- glRasterPos2f(self.padding_left+1,
self.padding_top+((self._num_frames-self._frame_ptr)*y_zoom)-1)
- #draw top portion
+ #draw and shift the previous samples
+ glReadBuffer(GL_FRONT)
+ glPixelZoom(1, 1)
+ glRasterPos2f(self.padding_left+1,
self.height-self.padding_bottom-int(y_zoom))
+ glCopyPixels(
+ self.padding_left+1,
+ self.padding_bottom,
+ self.width-self.padding_left-self.padding_right,
+
self.height-self.padding_top-self.padding_bottom-int(y_zoom),
+ GL_COLOR,
+ )
+ #draw a new fft sample
glPixelZoom(x_zoom, y_zoom)
- glBindBuffer(GL_PIXEL_UNPACK_BUFFER_ARB,
self._waterfall_buffer_top)
- glDrawPixels(self._fft_size, self._num_frames-self._frame_ptr,
GL_RGBA, GL_UNSIGNED_BYTE, None)
- #draw bottom portion
- glPixelZoom(x_zoom, -y_zoom)
- glBindBuffer(GL_PIXEL_UNPACK_BUFFER_ARB,
self._waterfall_buffer_bottom)
- glDrawPixels(self._fft_size, self._frame_ptr, GL_RGBA,
GL_UNSIGNED_BYTE, None)
- glBindBuffer(GL_PIXEL_UNPACK_BUFFER_ARB, 0) #unbind
+ glRasterPos2f(self.padding_left+1,
self.height-self.padding_bottom-1)
+ glDrawPixels(fft_size, 1, GL_RGBA, GL_UNSIGNED_BYTE, data)
def _update_data(self):
"""!
Modified: gnuradio/branches/features/experimental-gui/waterfall_window.py
===================================================================
--- gnuradio/branches/features/experimental-gui/waterfall_window.py
2008-08-01 21:35:50 UTC (rev 9145)
+++ gnuradio/branches/features/experimental-gui/waterfall_window.py
2008-08-01 23:11:25 UTC (rev 9146)
@@ -102,10 +102,10 @@
0.5*self.parent.controller[DYNAMIC_RANGE_KEY])
def _on_incr_ref_level(self, event):
self.parent.set_ref_level(
- self.parent.controller[REF_LEVEL_KEY] +
self.parent.controller[Y_PER_DIV_KEY])
+ self.parent.controller[REF_LEVEL_KEY] +
self.parent.controller[DYNAMIC_RANGE_KEY]/10)
def _on_decr_ref_level(self, event):
self.parent.set_ref_level(
- self.parent.controller[REF_LEVEL_KEY] -
self.parent.controller[Y_PER_DIV_KEY])
+ self.parent.controller[REF_LEVEL_KEY] -
self.parent.controller[DYNAMIC_RANGE_KEY]/10)
##################################################
# Waterfall window with plotter and control panel
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r9146 - in gnuradio/branches/features/experimental-gui: . plotter,
jblum <=