|
Post by alexfish on Jan 8, 2017 12:03:03 GMT 1
Hi Vovchik
Well . without reading back
that looks like the diff I was looking for , as in regards to the Initial hugrpi demo where the x offset for You the canvas = 53 . taken as 53-10 = 43 . When Your original overscan left = -8
Can test the original code again as is . then if not correct
Post a modded version , where the canvas is at xpos ypos 10,10 , Obvious , in the original config there is a math error . so 0,0 will not be correct I think says he.
BR Alex
|
|
|
Post by vovchik on Jan 8, 2017 12:22:38 GMT 1
Dear Alex,
Using the original CLS(), it is OK when I use the old canvas offsets:
CANVAS(53, -5, 780, 580)
in spite of the changed in CONFIG.TXT (and after a reboot). I am a bit puzzled, but with those offsets everything looks properly centred (canvas in window)
With kind regards, vovchik
|
|
|
Post by alexfish on Jan 8, 2017 12:50:20 GMT 1
Hi Vovchik Dear Alex, I have it enabled and have 40, 40, 21, 21. Nothing is cut off and I have no black frame, so I guess it is correct for the resolution. With kind regards, vovchik PS. Before running the prog, I had -8, -8, 29, 27. What do the fonts look like in the bacongui. BR Alex
|
|
|
Post by vovchik on Jan 8, 2017 13:11:21 GMT 1
Dear Alex, The fonts look OK - here is a screenshot.... With kind regards, vovchik Attachments:
|
|
|
Post by alexfish on Jan 8, 2017 15:26:47 GMT 1
Hi Vovchik
fonts look same as here
Now can test this It be out of the original demo , but have added Your Cursor Routine to get rid of the window cursor an the only cursor will be the EGL
You can see what is going on if do not get rid of the cursor when using opacity in EGL
BR Alex
Here We Go
the cls , back to original , including the math bug , left it in for a reason
and comments welcome
The CLS for the hugrpi.bac
SUB CLS() LOCAL gdk gdk = gdk_window_at_pointer(ADDRESS(MOUSEX),ADDRESS(MOUSEY)) gtk_window_get_size(win,ADDRESS(WIDTH),ADDRESS(HEIGHT)) gtk_window_get_position(win,ADDRESS(XPOS),ADDRESS(YPOS)) glClear ( GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT ) glViewport(XPOS+1+canvas.x,(((State.screen_height-10)-HEIGHT)-YPOS)-20+canvas.y, canvas.width, HEIGHT-(HEIGHT- canvas.height)); END SUB
and the test code
INCLUDE hugrpi.bac HUGOPTIONS ("NOSCALING") ' lib names gtk$ = HUGLIB$("gtk") gdk$ = HUGLIB$("gdk") ' *********************** ' IMPORTS ' ***********************
' gdk IMPORT "gdk_cursor_new(int)" FROM gdk$ TYPE long IMPORT "gdk_window_set_cursor(long,long)" FROM gdk$ TYPE void ' gtk IMPORT "gtk_widget_get_parent_window(long)" FROM gtk$ TYPE long IMPORT "gtk_widget_get_window(long)" FROM gtk$ TYPE long IMPORT "gtk_fixed_move(long,long,int,int)" FROM gtk$ TYPE void
' ------------------ SUB SET_CURSOR(NUMBER widget, int cursor_num) ' ------------------ LOCAL topwidget topwidget = gtk_widget_get_window(widget) cursor = gdk_cursor_new(cursor_num) gdk_window_set_cursor(topwidget, cursor) END SUB
'=============================================== ' Main LOCAL rotz = 0 TYPE float
win = WINDOW("Test Win",800,600) CANVAS(10,10,780,580) layer = hug_widget_attach(STR$(win)) SET_CURSOR(layer, -2)
'===============================================
WHILE 1 DO IF KEY() == 65307 THEN bcm_host_deinit() PRINT rotz END ENDIF
LOCAL bc = 0 TYPE float
CLS ' Draw BACKGROUND with opacity / Alpha hugView(HGL_2D_ORTHO) glColor4ub(0,27,51,180) RECT(0,0,WIDTH,HEIGHT,1) ' PRINT YPOS
LOCAL bt ' Draw crosshair at mouse IF (MOUSEX >= 0) THEN hugView(HGL_CURSOR) glColor4ub(255,255,255,255) hugView(HGL_2D_ORTHO) glTranslateOrtho(MOUSEX,MOUSEY) POLY(12,1,2,0) glRotatef(90,0,0,1) POLY(12,1,2,0) END IF
INCR rotz ,1 INCR bc ,3 IF bc >= 600 THEN bc = 0 END IF SYNC
eglSwapBuffers(State.display, State.surface) WEND
PRINT "done"
|
|
|
Post by vovchik on Jan 8, 2017 16:37:54 GMT 1
Dear Alex, That is a good way to "silence" the X cursor when using alpha. Works. With kind regards, vovchik
|
|
|
Post by alexfish on Jan 14, 2017 20:30:54 GMT 1
Hi Vovchik Think have resolved the full screen, as in Drawing in fullscreen mode archive = updated hugrpi , including the original math bug , and the code for testing = same QBEZIER demo , in fullscreen , hence , this is drawing a lot of pixels = good stress test if the bg and the spiro's are central that be fine if Not , can confirm where it be , + the two cursors. may give a clue. BR Alex The code INCLUDE hugrpi.bac HUGOPTIONS ("NOSCALING")
LOCAL rotz = 0 TYPE float win = WINDOW("Test Win", 800, 600) SET(win,1) CANVAS(0, 0, 780, 580) 'gdk = gdk_window_at_pointer(ADDRESS(MOUSEX),ADDRESS(MOUSEY))
WHILE TRUE DO IF KEY() == 65307 THEN bcm_host_deinit() PRINT rotz END END IF LOCAL bc = 0 TYPE float CLS ' Draw BACKGROUND hugView(HGL_2D_ORTHO) glColor4ub(33,22,6,250) RECT(0,0,WIDTH,HEIGHT,1) glColor4ub(255,0,0,205) hugView(HGL_2D_ORTHO) glTranslateOrtho(WIDTH/2,HEIGHT/2) LOCAL bt FOR bt = 1 TO 360 SYNC glColor4ub(245,(int)(bt/2) + 60,0,(int)(bt/2) + 60) glRotatef(rotz,0,0,1) glTranslateOrtho(bt,0) QBEZIER(0,0,200,bc,300,-(bc-400),0.1) glRotatef(rotz,0,0,1) glColor4ub(255,0,0,(int)(bt/2) + 60) QBEZIER(0,0,200,bc,300,-(bc-400),0.1) NEXT bt ' Draw crosshair at mouse IF (MOUSEX >= 0) THEN hugView(HGL_CURSOR) glColor4ub(255,255,255,205) hugView(HGL_2D_ORTHO) glTranslateOrtho(MOUSEX,MOUSEY) POLY(12,1,2,0) glRotatef(90,0,0,1) POLY(12,1,2,0) END IF INCR rotz ,1 INCR bc ,3 IF bc >= 600 THEN bc = 0 END IF eglSwapBuffers(State.display, State.surface) WEND
Attachments:hugrpi.bac.bz2 (14.41 KB)
|
|
|
Post by vovchik on Jan 14, 2017 21:13:36 GMT 1
Dear Alex, Thanks. I still have my weird offests, meaning the drawing takes place on the full screen, minus my task bar at the top (22 px, I think), and a white right margin. The terminal reports 1280x720 when the prog runs, whereas screensize reports 1200x678. Apart from those things, it is full screen, since we are requesting a canvas size of 800x600. And it works smoothly. With kind regards, vovchik
|
|
|
Post by alexfish on Jan 14, 2017 21:29:06 GMT 1
is it possible we be looking at,
1280 - 1200 = 80 : /2 = 40 in the x
and
720 - 678 = 42 : / 2 = 21 in the y
Need to Look back at Your Over Scan Settings
Note , there could be a 1Px diff Here , if so. I know what it Be BR Alex
|
|
|
Post by alexfish on Jan 15, 2017 3:33:00 GMT 1
Hi Vovchik just checked, RE : Overscan BR Alex Added: here with EGL CPU usage = 4% to 9% also checked Chromium Browser back ends , whoo , it be using it's own EGL.so's Chromium + hugrpi demo's = same cpu usage , suppose can forgive the memory usage a leeway here
|
|
|
Post by alexfish on Jan 15, 2017 11:07:36 GMT 1
Hi Vovchik
which variables are you using to PRINT the screen size info
BR Alex
|
|
|
Post by vovchik on Jan 15, 2017 11:44:31 GMT 1
Dear Alex, Playing around with your latest hugpi and test prog. The vars for screesize I see are vp[2] and vp[3], in Init0gl, which differ from what I get using CLI utilities. Positively, when I press ESC once during the test, I do get full screen - covering the task bar - which is great. The weird offsets are still there, but at least I get full screen. And CPU use, as you noted, is extremely modest. With kind regards, vovchik
|
|
|
Post by alexfish on Jan 15, 2017 12:59:00 GMT 1
Hi Vovchik
For Further Clarity
= vp[2] & vp[3] Also assuming PRINT State.screen_width = 1280 PRINT State.screen_height = 720
and that
vp[0]= 0 vp[1]= 0 |--------------------------------------------------
whereas screensize reports 1200x678 is from the CLI commands
can U post the CLI commands used.
If Above Not Correct . Correct me
BR Alex
|
|
|
Post by vovchik on Jan 15, 2017 14:26:34 GMT 1
Dear Alex,
I used:
xdpyinfo | grep 'dimensions:'
and
TRAP LOCAL CATCH GOTO PRINT_ERROR CONST Gtk$ = "libgtk-x11-2.0.so.0" CONST Gdk$ = "libgdk-x11-2.0.so.0" DECLARE MyScreen$ TYPE STRING IMPORT "gtk_init(int*,void*)" FROM Gtk$ TYPE void IMPORT "gtk_exit(int)" FROM Gtk$ TYPE void IMPORT "gtk_window_get_size(long,int*,int*)" FROM Gtk$ TYPE void IMPORT "gdk_screen_get_default" FROM Gdk$ TYPE long IMPORT "gdk_screen_get_width(long)" FROM Gdk$ TYPE int IMPORT "gdk_screen_height(long)" FROM Gdk$ TYPE int
' ------------------ FUNCTION SCREENSIZE$(NUMBER mode) ' ------------------ ' mode = 0 returns x (width) ' mode = 1 returns y (height) ' mode = 2 returns space-delimited x (width) and y (height) ' otherwise function returns error message LOCAL x, y TYPE int LOCAL myresult$ TYPE STRING y = gdk_screen_height(gdk_screen_get_default()) x = gdk_screen_get_width(gdk_screen_get_default()) SELECT mode CASE 0 myresult$ = STR$(x) CASE 1 myresult$ = STR$(y) CASE 2 myresult$ = CONCAT$(STR$(x), " ", STR$(y)) DEFAULT myresult$ = CONCAT$("Error: SCREENSIZE(", STR$(mode), ") mode is bad: 0 = w, 1 = h and 2 = h and w.") END SELECT RETURN CHOP$(myresult$) END FUNCTION
gtk_init(0, 0) MyScreen$ = SCREENSIZE$(0) PRINT MyScreen$ MyScreen$ = SCREENSIZE$(1) PRINT MyScreen$ MyScreen$ = SCREENSIZE$(2) PRINT MyScreen$ MyScreen$ = SCREENSIZE$(3) PRINT MyScreen$ gtk_exit(0) END
LABEL PRINT_ERROR PRINT "GTK library ", Gtk$, " is not available on this platform!" END
The give the same result.
With kind regards, vovchik
|
|
|
Post by alexfish on Jan 15, 2017 17:05:31 GMT 1
Hi Vovchik
have been playing around with these scan modes , think there be enough info in the hugrpi to do the necessary.
Can replicate what is happening ,
have set my offsets to 40,40,20,20
the print out of my bits are
EGL Screen Sizes 1920 1080 X Screen Sizes 1840 1040 ************************
the xdpi xdpyinfo | grep 'dimensions:' dimensions: 1840x1040 pixels (487x275 millimeters)
looking at what U got , not sure if the configs are correct , since I have slightly fuzzy text on the xwin reason
also although can use the on the fly
set_overscan.sh one will not get full details of where things are until a reboot , IE first attemts = the spiro center of screen the reboot = everything offset. I think says he
so can test the QBEZIER ,and post the results
INCLUDE hugrpi.bac HUGOPTIONS ("NOSCALING")
LOCAL rotz = 0 TYPE float win = WINDOW("Test Win", 800, 600) SET(win,1) CANVAS(0, 0, 780, 580) 'gdk = gdk_window_at_pointer(ADDRESS(MOUSEX),ADDRESS(MOUSEY))
WHILE TRUE DO IF KEY() == 65307 THEN bcm_host_deinit() PRINT rotz END END IF
PRINT "EGL Screen Sizes" PRINT State.screen_width PRINT State.screen_height PRINT "X Screen Sizes" PRINT WIDTH PRINT HEIGHT PRINT "************************" LOCAL bc = 0 TYPE float CLS ' Draw BACKGROUND hugView(HGL_2D_ORTHO) glColor4ub(0,0,255,190) RECT(0,0,WIDTH,HEIGHT,1) glColor4ub(255,0,0,205) hugView(HGL_2D_ORTHO) glTranslateOrtho(WIDTH/2,HEIGHT/2) LOCAL bt FOR bt = 1 TO 360 SYNC glColor4ub(245,(int)(bt/2) + 60,0,(int)(bt/2) + 60) glRotatef(rotz,0,0,1) glTranslateOrtho(bt,0) QBEZIER(0,0,200,bc,300,-(bc-400),0.1) glRotatef(rotz,0,0,1) glColor4ub(255,0,0,(int)(bt/2) + 60) QBEZIER(0,0,200,bc,300,-(bc-400),0.1) NEXT bt ' Draw crosshair at mouse IF (MOUSEX >= 0) THEN hugView(HGL_CURSOR) glColor4ub(255,255,255,205) hugView(HGL_2D_ORTHO) glTranslateOrtho(MOUSEX,MOUSEY) POLY(12,1,2,0) glRotatef(90,0,0,1) POLY(12,1,2,0) END IF INCR rotz ,1 INCR bc ,3 IF bc >= 600 THEN bc = 0 END IF eglSwapBuffers(State.display, State.surface) WEND
in this case need to know if the "egl cross-hair cursor" is left or right of the xcursor and if in the y, is it above or below the xcursor
BR Alex
|
|