Permalink
Browse files

modified: OpenVGApp.lua

	modified:   bcm_host.lua
	renamed:    interface/common.lua -> common.lua
	renamed:    interface/connection.lua -> connection.lua
	renamed:    freetype.lua -> experimental/freetype.lua
	modified:   media/desktop.ppm
	renamed:    interface/message.lua -> message.lua
	deleted:    test_bcm_host.lua
	modified:   test_snapshot.lua
	new file:   tests/snapper.lua
	renamed:    test_dispmanx.lua -> tests/test_dispmanx.lua
	renamed:    test_egl.lua -> tests/test_egl.lua
	renamed:    test_egl_vg_window.lua -> tests/test_egl_vg_window.lua
	renamed:    test_egl_window.lua -> tests/test_egl_window.lua
	renamed:    test_egles_basic.lua -> tests/test_egles_basic.lua
	renamed:    test_enumdispman.lua -> tests/test_enumdispman.lua
	renamed:    test_picast.lua -> tests/test_picast.lua
	renamed:    test_tiger.lua -> tests/test_tiger.lua
	renamed:    test_triangle.lua -> tests/test_triangle.lua
	renamed:    test_window_basic.lua -> tests/test_window_basic.lua
	renamed:    tiger.lua -> tests/tiger.lua
	renamed:    interface/vc_cec.lua -> vc_cec.lua
	renamed:    interface/vc_cecservice.lua -> vc_cecservice.lua
	renamed:    interface/vc_display_types.lua -> vc_display_types.lua
	renamed:    interface/vc_dispmanx.lua -> vc_dispmanx.lua
	renamed:    interface/vc_dispmanx_types.lua -> vc_dispmanx_types.lua
	renamed:    interface/vc_dispservice_x_defs.lua -> vc_dispservice_x_defs.lua
	renamed:    interface/vc_hdmi.lua -> vc_hdmi.lua
	renamed:    interface/vc_hdmi_property.lua -> vc_hdmi_property.lua
	renamed:    interface/vc_image_types.lua -> vc_image_types.lua
	renamed:    interface/vc_sdtv.lua -> vc_sdtv.lua
	renamed:    interface/vc_tvservice.lua -> vc_tvservice.lua
	renamed:    interface/vc_tvservice_defs.lua -> vc_tvservice_defs.lua
	renamed:    interface/vcgencmd.lua -> vcgencmd.lua
	renamed:    interface/vchi.lua -> vchi.lua
	renamed:    interface/vchi_cfg.lua -> vchi_cfg.lua
	renamed:    interface/vchi_cfg_internal.lua -> vchi_cfg_internal.lua
	renamed:    interface/vchi_common.lua -> vchi_common.lua
	renamed:    interface/vchi_mh.lua -> vchi_mh.lua
	renamed:    interface/vcos.lua -> vcos.lua
	renamed:    interface/vcos_assert.lua -> vcos_assert.lua
	renamed:    interface/vcos_init.lua -> vcos_init.lua
	renamed:    interface/vcos_platform.lua -> vcos_platform.lua
	renamed:    interface/vcos_platform_types.lua -> vcos_platform_types.lua
	renamed:    interface/vcos_semaphore.lua -> vcos_semaphore.lua
	renamed:    interface/vcos_types.lua -> vcos_types.lua
  • Loading branch information...
Wiladams committed Nov 9, 2012
1 parent 8d5e90d commit 68b0eb4a1aad99a9d498672549dd8664e974726c
Showing with 68 additions and 66 deletions.
  1. +3 −49 OpenVGApp.lua
  2. +3 −4 bcm_host.lua
  3. 0 {interface → }/common.lua
  4. 0 {interface → }/connection.lua
  5. 0 { → experimental}/freetype.lua
  6. BIN media/desktop.ppm
  7. 0 {interface → }/message.lua
  8. +0 −12 test_bcm_host.lua
  9. +1 −1 test_snapshot.lua
  10. +60 −0 tests/snapper.lua
  11. 0 { → tests}/test_dispmanx.lua
  12. 0 { → tests}/test_egl.lua
  13. 0 { → tests}/test_egl_vg_window.lua
  14. 0 { → tests}/test_egl_window.lua
  15. 0 { → tests}/test_egles_basic.lua
  16. 0 { → tests}/test_enumdispman.lua
  17. 0 { → tests}/test_picast.lua
  18. +1 −0 { → tests}/test_tiger.lua
  19. 0 { → tests}/test_triangle.lua
  20. 0 { → tests}/test_window_basic.lua
  21. 0 { → tests}/tiger.lua
  22. 0 {interface → }/vc_cec.lua
  23. 0 {interface → }/vc_cecservice.lua
  24. 0 {interface → }/vc_display_types.lua
  25. 0 {interface → }/vc_dispmanx.lua
  26. 0 {interface → }/vc_dispmanx_types.lua
  27. 0 {interface → }/vc_dispservice_x_defs.lua
  28. 0 {interface → }/vc_hdmi.lua
  29. 0 {interface → }/vc_hdmi_property.lua
  30. 0 {interface → }/vc_image_types.lua
  31. 0 {interface → }/vc_sdtv.lua
  32. 0 {interface → }/vc_tvservice.lua
  33. 0 {interface → }/vc_tvservice_defs.lua
  34. 0 {interface → }/vcgencmd.lua
  35. 0 {interface → }/vchi.lua
  36. 0 {interface → }/vchi_cfg.lua
  37. 0 {interface → }/vchi_cfg_internal.lua
  38. 0 {interface → }/vchi_common.lua
  39. 0 {interface → }/vchi_mh.lua
  40. 0 {interface → }/vcos.lua
  41. 0 {interface → }/vcos_assert.lua
  42. 0 {interface → }/vcos_init.lua
  43. 0 {interface → }/vcos_platform.lua
  44. 0 {interface → }/vcos_platform_types.lua
  45. 0 {interface → }/vcos_semaphore.lua
  46. 0 {interface → }/vcos_types.lua
View
@@ -18,55 +18,6 @@ local OpenVG = rpiui.OpenVG;
local egl = require "egl"
local VG = EGL.Lib;
-local PS = require "PSLoader";
-
-
-
-local screenWidth = 640;
-local screenHeight = 480;
-local rotateN = 0.0;
-local rotateFactor = 1;
-
-
-
-
-
---[[
- Render
---]]
-local function renderbegin(scene, w, h)
- local clearColor = ffi.new("VGfloat[4]", 1,1,1,1);
- VG.vgSetfv(ffi.C.VG_CLEAR_COLOR, 4, clearColor);
- VG.vgClear(0, 0, w, h);
-
- VG.vgLoadIdentity();
-end
-
-local function renderend(scene, w, h)
- mainWindow:SwapBuffers(); -- force EGL to recognize resize
-end
-
-local function render(scene, w, h)
- local scale = w / (tigerModel.MaxX - tigerModel.MinX);
-
- renderbegin(scene, w, h);
-
-
- VG.vgTranslate(w * 0.5, h * 0.5);
- VG.vgRotate(rotateN);
- VG.vgTranslate(-w * 0.5, -h * 0.5);
-
- VG.vgScale(scale, scale);
- VG.vgTranslate(-tigerModel.MinX, -tigerModel.MinY + 0.5 * (h / scale - (tigerModel.MaxY - tigerModel.MinY)));
-
- scene:render();
- --assert(tonumber(VG.vgGetError()) == tonumber(ffi.C.VG_NO_ERROR));
-
- renderend(scene, w, h);
-end
-
-
-
OpenVGApp = {}
@@ -75,13 +26,16 @@ OpenVGApp.init = function(width, height)
width = width or 640;
height = height or 480;
+ -- Setup the event loop stuff
OpenVGApp.Loop = EventLoop.new(15);
OpenVGApp.Keyboard = Keyboard.new();
OpenVGApp.Loop:AddObservable(OpenVGApp.Keyboard);
OpenVGApp.Loop.OnIdle = OpenVGApp.Idle;
OpenVGApp.Keyboard.OnKeyUp = OpenVGApp.KeyUp;
+
+ -- Create the Main Window
OpenVGApp.Window = EGL.Window.new(width, height, nil, EGL.EGL_OPENVG_API);
return OpenVGApp;
View
@@ -1,4 +1,3 @@
-package.path = package.path..";interface/?.lua"
local ffi = require "ffi"
@@ -11,9 +10,9 @@ int32_t graphics_get_display_size( const uint16_t display_number, uint32_t *widt
require "libc"
-require "interface/vc_dispmanx"
-require "interface/vc_tvservice"
-require "interface/vcgencmd"
+require "vc_dispmanx"
+require "vc_tvservice"
+require "vcgencmd"
--[[
File renamed without changes.
File renamed without changes.
File renamed without changes.
View
Binary file not shown.
File renamed without changes.
View
@@ -1,12 +0,0 @@
---package.path = package.path..";../?.lua"
-
-local ffi = require "ffi"
-
-
-local bcm = require "BcmHost"
-
-
-print(bcm.GetDisplaySize());
-
-
-
View
@@ -52,7 +52,7 @@ displayView:Show();
local pixeldata, err = displayView.Resource:ReadPixelData();
if pixeldata then
-- Write the data out
- local filename = "desktop.ppm"
+ local filename = "~/desktop.ppm"
print("Writing: ", filename);
WritePPM(filename, pixeldata);
View
@@ -0,0 +1,60 @@
+
+local ffi = require "ffi"
+local DMX = require "DisplayManX"
+
+local Display = DMXDisplay();
+Display:SetBackground(0,0,0);
+
+local screenWidth, screenHeight = Display:GetSize();
+local ratio = screenWidth / screenHeight;
+
+local displayHeight = screenHeight;
+local displayWidth = screenWidth;
+--local displayHeight = 320;
+--local displayWidth = 640;
+--local displayHeight = 70;
+--local displayWidth = displayHeight * ratio;
+
+
+-- Create the view that will display the snapshot
+local displayView = Display:CreateView(
+ displayWidth, displayHeight,
+ 0, screenHeight-displayHeight-1,
+ 0, ffi.C.VC_IMAGE_RGB888)
+
+
+local function WritePPM(filename, pixbuff)
+ local r, c, val;
+
+ local fp = io.open(filename, "wb")
+ if not fp then
+ return false
+ end
+
+ local header = string.format("P6\n%d %d\n255\n", pixbuff.Width, pixbuff.Height)
+ fp:write(header);
+
+ for row=0,pixbuff.Height-1 do
+ local dataPtr = ffi.cast("char *",pixbuff.Data) + pixbuff.Pitch*row
+ local data = ffi.string(dataPtr, pixbuff.Width*3);
+ fp:write(data);
+ end
+
+ fp:close();
+end
+
+
+-- Do the snapshot
+Display:Snapshot(displayView.Resource);
+
+
+local pixeldata, err = displayView.Resource:ReadPixelData();
+if pixeldata then
+ -- Write the data out
+ local filename = "media/desktop.ppm"
+-- print("Writing: ", filename);
+
+ WritePPM(filename, pixeldata);
+end
+
+
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -1,3 +1,4 @@
+package.path = package.path..";../?.lua"
local ffi = require "ffi"
local C = ffi.C;
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 68b0eb4

Please sign in to comment.