|
Post by alexfish on Jan 3, 2017 16:08:33 GMT 1
Hi All
Decided to create new thread for the Raspberry PI 3
I did find some problems on getting the Bacon GUI working , IE the Cursor Routine doe not work in the Raspberry
For Now here is the Hack a Day to get started
Installing Bacon
download the Latest Source Package
in the Downloads , Right Click on the Tar Package . select
Before Commencing here is the How to Hack it
Open up the bacongui.bac with Leafpad Use the Leafpad search for "SUB Create_Page" will have to find Line 1827 and comment the line 'g_signal_connect_data(view, "button-release-event", Cursor_Changed, 0, 0, 0)'
' Setup buffer and viewer using BaCon as language buffer = gtk_source_buffer_new_with_language(lang) g_signal_connect_data(buffer, "changed", Set_Changed, 0, 0, 0) gtk_source_buffer_set_highlight_matching_brackets(buffer, 1) view = gtk_source_view_new_with_buffer(buffer) g_signal_connect_data(view, "key-release-event", Cursor_Changed, 0, 0, 0) 'g_signal_connect_data(view, "button-release-event", Cursor_Changed, 0, 0, 0) g_signal_connect_data(view, "move-cursor", Cursor_Changed, 0, 0, 0) g_signal_connect_data(view, "focus-out-event", Hide_Context, 0, 0, 0)
From the terminal
cd to the folder on my system user is pi , if different user swap it at '/pi/'
cd /home/pi/Downloads/bacon-3.5.1 Can now compile
./configure
make
make install
updating of bacon help may indicate a fail , yet the intial bits are there reboot and start the gui then update will work
in the /home/pi/.bacon settings.cfg
set the terminal to
shell lxterminal --geometry=80x20 --command="/bin/bash -c 'time @; read'"
BR Alex
PS . the other Bits as mentioned will be Posted Here
|
|
|
Post by vovchik on Jan 3, 2017 17:11:32 GMT 1
Dear Alex, Thanks. That fixed the sticky highlighting problem nicely on my Pi. With kind regards, vovchik
|
|
|
Post by alexfish on Jan 3, 2017 18:18:26 GMT 1
Hi Vovchik
Not sure if could be applied in general , but this does cure the problem on the Raspberry ?
Next:
When the gui is opened and as one can do ..Click Save file , OOp's nothing Written , click Cancel
Then the GUI can crash , with this message
Suppose Peter Can test this one
BR Alex
|
|
|
Post by Pjot on Jan 3, 2017 18:47:20 GMT 1
Hi Alex,
Save As... and then Cancel works for me, no error occurring.
Did you remove a file in the target directory while BaConGUI was running?
Best regards Peter
|
|
|
Post by alexfish on Jan 3, 2017 19:34:25 GMT 1
Hi Peter
There is No file loaded , hence there is no target directory
IE: launch the GUI , do not type anything , Just Click "Save", then Cancel on the file dialog ... The same will happen if compile is clicked , IE the file dialog will show , and if click Cancel .
The Above = speaking from a novice aspect.
Can confirm that the "Save AS" , is fine
BR Alex
|
|
|
Post by Pjot on Jan 3, 2017 20:55:52 GMT 1
Thanks for catching this Alex, It is fixed it in 3.5.2 beta (fossil repo). Best regards Peter
|
|
|
Post by alexfish on Jan 4, 2017 9:42:21 GMT 1
Hi Peter
have checked the beta in the fossil
both SAVE and SAVE AS are fine .
THE Compile button will crash if there is nothing typed into the page
BR Alex
|
|
|
Post by alexfish on Jan 4, 2017 15:18:44 GMT 1
Hi Vovchik
Have started converting the OGL interface , here need to test the init stages first
This code snippet should reveal the screen width and height
If it inits can U post the results of the test + Ur actual monitor resolution
BR Alex
' INCLUDES PRAGMA INCLUDE <EGL/egl.h> PRAGMA INCLUDE <EGL/eglext.h> PRAGMA INCLUDE <GLES2/gl2.h> PRAGMA INCLUDE <GLES/gl.h>
'COMPILER FLAGS PRAGMA OPTIONS -I/usr/lib/arm-linux-gnueabihf/ -I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux -lGLESv2 -lEGL -lm -lbcm_host -L/opt/vc/lib -lbacon -L /usr/local/lib -ldl -lm
PRAGMA LDFLAGS -I/usr/lib/arm-linux-gnueabihf/ -I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux -lGLESv2 -lEGL -lm -lbcm_host -L/opt/vc/lib -lbacon -L /usr/local/lib -ldl -lm OPTION PARSE FALSE
' TESTING BACON RECORD as replacement for type struct & poinert to struct RECORD State LOCAL screen_width TYPE uint32_t LOCAL screen_height TYPE uint32_t LOCAL dispman_display TYPE DISPMANX_DISPLAY_HANDLE_T LOCAL dispman_element TYPE DISPMANX_ELEMENT_HANDLE_T LOCAL display TYPE EGLDisplay LOCAL surface TYPE EGLSurface LOCAL context TYPE EGLContext END RECORD '============================================ SUB init_ogl()
LOCAL success = 0 TYPE int32_t LOCAL result TYPE EGLBoolean LOCAL num_config TYPE EGLint
LOCAL nativewindow TYPE static EGL_DISPMANX_WINDOW_T
LOCAL dispman_update TYPE DISPMANX_UPDATE_HANDLE_T LOCAL dst_rect TYPE VC_RECT_T LOCAL src_rect TYPE VC_RECT_T
LOCAL attribute_list[] ={ \ EGL_RED_SIZE, 8, \ EGL_GREEN_SIZE, 8, \ EGL_BLUE_SIZE, 8, \ EGL_ALPHA_SIZE, 8, \ EGL_SURFACE_TYPE, EGL_WINDOW_BIT, \ EGL_NONE \ } TYPE const EGLint
LOCAL config TYPE EGLConfig State.display = eglGetDisplay(EGL_DEFAULT_DISPLAY) 'assert(state->display!=EGL_NO_DISPLAY); IF (State.display) THEN PRINT "eglGetDisplay OK" ELSE PRINT "eglGetDisplay fail" END END IF result = eglInitialize(State.display, NULL, NULL) result = eglChooseConfig(State.display, attribute_list, &config, 1, &num_config) ' create an EGL rendering context State.context = eglCreateContext(State.display, config, EGL_NO_CONTEXT, NULL) ' create an EGL window surface success = graphics_get_display_size(0 /* LCD */, & State.screen_width, & State.screen_height)
END SUB '============================================
SUB InitOgl() bcm_host_init() init_ogl()
ENDSUB '============================================
PRINT "Hello World" InitOgl PRINT "Screen width : " ,(int)State.screen_width ,"\nScreen height : " ,(int)State.screen_height bcm_host_deinit()
|
|
|
Post by vovchik on Jan 4, 2017 15:33:52 GMT 1
Dear Alex,
Your snippet works nicely:
Hello World eglGetDisplay OK Screen width : 1280 Screen height : 720
With kind regards, vovchik
|
|
|
Post by alexfish on Jan 4, 2017 15:46:00 GMT 1
Hi Vovchik
Thanks for the reply
Now Know can set up the rest of the configs
as a matter of consequence , also know reason for the 3demo on PI2 thread failed, where by U had to switch the Raspberry off at the Mains
BR Alex
|
|
|
Post by alexfish on Jan 4, 2017 17:16:38 GMT 1
Hi Vovchik
Have a OGL set up to test . the screen should go black and then return to normal after 1 Second
If OK then add the Gtk Bits
BR Alex
' INCLUDES PRAGMA INCLUDE <EGL/egl.h> PRAGMA INCLUDE <EGL/eglext.h> PRAGMA INCLUDE <GLES2/gl2.h> PRAGMA INCLUDE <GLES/gl.h>
'COMPILER FLAGS PRAGMA OPTIONS -I/usr/lib/arm-linux-gnueabihf/ -I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux -lGLESv2 -lEGL -lm -lbcm_host -L/opt/vc/lib -lbacon -L /usr/local/lib -ldl -lm
PRAGMA LDFLAGS -I/usr/lib/arm-linux-gnueabihf/ -I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux -lGLESv2 -lEGL -lm -lbcm_host -L/opt/vc/lib -lbacon -L /usr/local/lib -ldl -lm OPTION PARSE FALSE
' TESTING BACON RECORD as replacement for type struct & pointer to struct RECORD State LOCAL screen_width TYPE uint32_t LOCAL screen_height TYPE uint32_t LOCAL dispman_display TYPE DISPMANX_DISPLAY_HANDLE_T LOCAL dispman_element TYPE DISPMANX_ELEMENT_HANDLE_T LOCAL display TYPE EGLDisplay LOCAL surface TYPE EGLSurface LOCAL context TYPE EGLContext END RECORD
SUB init_ogl()
LOCAL success = 0 TYPE int32_t LOCAL result TYPE EGLBoolean LOCAL num_config TYPE EGLint
LOCAL nativewindow TYPE static EGL_DISPMANX_WINDOW_T
LOCAL dispman_update TYPE DISPMANX_UPDATE_HANDLE_T LOCAL dst_rect TYPE VC_RECT_T LOCAL src_rect TYPE VC_RECT_T
LOCAL attribute_list[] ={ \ EGL_RED_SIZE, 8, \ EGL_GREEN_SIZE, 8, \ EGL_BLUE_SIZE, 8, \ EGL_ALPHA_SIZE, 8, \ EGL_SURFACE_TYPE, EGL_WINDOW_BIT, \ EGL_NONE \ } TYPE const EGLint
LOCAL config TYPE EGLConfig State.display = eglGetDisplay(EGL_DEFAULT_DISPLAY)
IF (State.display) THEN PRINT "eglGetDisplay OK" ELSE PRINT "eglGetDisplay fail" END END IF result = eglInitialize(State.display, NULL, NULL) result = eglChooseConfig(State.display, attribute_list, &config, 1, &num_config) ' create an EGL rendering context State.context = eglCreateContext(State.display, config, EGL_NO_CONTEXT, NULL) ' create an EGL window surface success = graphics_get_display_size(0 /* LCD */, & State.screen_width, & State.screen_height) IF (success) THEN PRINT "graphics_get_display_size OK" ELSE PRINT "graphics_get_display_size fail" ENDIF
dst_rect.x = 0 dst_rect.y = 0 dst_rect.width = State.screen_width dst_rect.height = State.screen_height-40
src_rect.x = 0 src_rect.y = 0 src_rect.width = State.screen_width << 16 src_rect.height = State.screen_height << 16
State.dispman_display = vc_dispmanx_display_open( 0 /* LCD */) dispman_update = vc_dispmanx_update_start( 0 )
State.dispman_element = vc_dispmanx_element_add ( dispman_update, State.dispman_display,0, &dst_rect, 0,&src_rect, DISPMANX_PROTECTION_NONE, 0 , 0,(DISPMANX_TRANSFORM_T) 0) nativewindow.element = State.dispman_element nativewindow.width = State.screen_width nativewindow.height = State.screen_height vc_dispmanx_update_submit_sync( dispman_update )
State.surface = eglCreateWindowSurface(State.display, config, &nativewindow, NULL ) result = eglMakeCurrent(State.display, State.surface, State.surface, State.context) IF NOT(result) THEN PRINT "eglMakeCurrent Fail" END END IF ' Set background color and clear buffers glClearColor(0.15f, 0.25f, 0.35f, 0.0f);
' Enable back face culling. glEnable(GL_CULL_FACE);
glMatrixMode(GL_MODELVIEW)
END SUB
SUB InitOgl() bcm_host_init() init_ogl()
ENDSUB
PRINT "Hello World" InitOgl PRINT "Screen width : " ,(int)State.screen_width ,"\nScreen height : " ,(int)State.screen_height
'Test Swap
eglSwapBuffers(State.display, State.surface)
SLEEP 1000 bcm_host_deinit()
Can play with thes bits and will get a picture of what be going on
dst_rect.x = 0 dst_rect.y = 40 dst_rect.width = State.screen_width; dst_rect.height = State.screen_height-40 src_rect.x = 0 src_rect.y = 0 src_rect.width = State.screen_width << 16 src_rect.height = State.screen_height-40 << 16
BR Alex
|
|
|
Post by alexfish on Jan 4, 2017 18:20:55 GMT 1
Hi Vovchik
If getting message Screen Fail , have applied wrong LOGIC if statement ..
Here
IF (success) THEN PRINT "graphics_get_display_size OK" ELSE PRINT "graphics_get_display_size fail" ENDIF
could be
IF NOT(success) THEN PRINT "graphics_get_display_size OK" ELSE PRINT "graphics_get_display_size fail" ENDIF
Reason here been : If BCM Host fails it will kill the connection on Raspberry PI . Now if get a fail on(graphics_get_display_size), which never as yet has not happened . so can not tell what the fail value is
IE in BCM/EGL Spec the assert is used
EXAMPLE
// create an EGL window surface success = graphics_get_display_size(0 /* LCD */, &state->screen_width, &state->screen_height); assert( success >= 0 );
Anyway Assuming here the screen goes black
therefor assuming if Success Then screen may not go black.
so my logic is if the screen width and height are returned then that = Success . could be proved wrong.
BR Alex
|
|
|
Post by vovchik on Jan 4, 2017 18:53:44 GMT 1
Dear Alex, I get: Hello World eglGetDisplay OK graphics_get_display_size OK Screen width : 800 Screen height : 720
after applying your NOT(sucess) mod, and have managed to change sizes of the black square. Thanks. With kind regards, vovchik
|
|
|
Post by alexfish on Jan 4, 2017 19:44:01 GMT 1
Hi Vovchik
Thank for testing
Now in the process of putting the gtk bits to gether
Here note I put in a request to peter how could I implement a DEF FN MkStr
Where can make a string that is not inside Quotes
IE
LOCAL stringt TYPE char* stringt =MkStrs( "OK*" test this)
and a print to the terminal looks like
"OK*" test this
So can test this
#define MkStrs( x ) #x Save as "mkstr.h"
and a bit of code for testing
PRAGMA INCLUDE mkstr.h
PROTO MkStrs
LOCAL stringt TYPE char* stringt =MkStrs( "OK*" test this)
PRINT stringt
Can test this further since need Port Demos without mods
BR Alex
|
|
|
Post by vovchik on Jan 4, 2017 20:12:32 GMT 1
Dear Alex,
It works, as does this:
USEH #define MkStrs( x ) #x END USEH
within a *.bac,
With kind regards, vovchik
|
|