|
Post by alexfish on Jan 4, 2017 20:32:47 GMT 1
Thanks Vovchik
Now Added EGL code Some of the Bits so to speak
BR Alex
|
|
|
Post by alexfish on Jan 4, 2017 21:10:30 GMT 1
Hence so
Can form an SVG in natural form + looks good in BaCon GUI
Then pass it to pixloader then extract the gtk_pix_buf
so in meantime can have some fun with things like
USEH #define MkStrs( x ) #x END USEH
LOCAL svg TYPE char*
svg = MkStrs( <svg width="1000" height="1000" > \ <rect x="0" y="0" rx="60" ry="60" width="1000" height="1000" \ style="fill:blue;stroke:yellow;stroke-width:1;opacity:0.5" /> \ <text text-anchor="middle" x="500" y="500" dy= "35" \ font-size="70" fill="yellow" > PI PI PI </text > \ <text text-anchor="middle" x="500" y="70" dy= "35" \ font-family = "1960sHippie" \ font-size="70" stroke="white" fill="none" >GL Meets SVG</text > \ <text text-anchor="middle" x="500" y="930" dy= "35" \ font-family = "1960sHippie" font-size="70" fill="yellow" > (text)</text > \ <line x1="0" y1="500" x2="1000" y2="500" style="stroke:rgb(255,0,0);stroke-width:1" /> \ <line x1="500" y1="0" x2="500" y2="1000" style="stroke:rgb(255,255,0);stroke-width:1" /> \ <circle cx="500" cy="300" r="300" stroke="white" stroke-width="1" fill="none" /> \ <circle cx="500" cy="500" r="500" stroke="white" stroke-width="1" fill="none" /> \ </svg>) PRINT svg
|
|
|
Post by alexfish on Jan 4, 2017 23:52:31 GMT 1
Dear Alex, Thanks. That fixed the sticky highlighting problem nicely on my Pi. With kind regards, vovchik Had to think back. Here we sit some nearly 5 Years on , ARM DEBIAN .. Thinking Thinking , Argh . Found it here. HEREMM! Have Fun with the Raspberry (PI3) perhaps inspired by original-arm-computerthen last in simple demo's for the Raspberry(PI3) A delta wing Widget (main body + 2 wings)been controlled By It's Property , 50 Frames per second BR Alex Attachments:deltawing.bz2 (38.18 KB)
|
|
|
Post by vovchik on Jan 5, 2017 8:59:44 GMT 1
Dear Alex, Works. Very smooth, indeed. With kind regards, vovchik
|
|
|
Post by alexfish on Jan 5, 2017 17:54:41 GMT 1
Hi Vovchik Have managed to get the Something Concrete done Here there is a HUG window with EGL CANVAS when fired up will see the window and a EGL canvas is set with opacity (glClearColor(0.15f, 0.25f, 0.35f, 0.4f)) It should cover the whole screen , when the window closes the EGL canvas should DeInit Can test to see if this works , then Can progress with the rest of the bits, as in drawing .. etc BR Alex Attachments:testgl.bz2 (52.91 KB)
|
|
|
Post by vovchik on Jan 5, 2017 21:08:47 GMT 1
Dear Alex, Yep, it does what you say it will, and when I kill the smaller window, the opacity of the entire screen returns to normal. With kind regards, vovchik
|
|
|
Post by alexfish on Jan 5, 2017 21:32:26 GMT 1
Hi Vovchik
Thank for testing ,
Now Can test and see if can gain access on a second call ,
fire the first window , then fire up a Second window
will have to use two terminals
I be in trouble if can fire another instance
BR Alex
|
|
|
Post by alexfish on Jan 6, 2017 12:06:34 GMT 1
Hi Vovchik & all Putting some of the final bits together For Historical purposes Readers , most and in part , what is happening could not have been achieved without the Help of this Forum & its Members Where did it start HEREAND HEREHad some Fun on That Thread with the Infamous JRS.. BR Alex
|
|
|
Post by alexfish on Jan 6, 2017 21:33:23 GMT 1
Hi Vovchick got a basic Hugrpi put together with some basic Geometry drawing Been Called back to the grinder . So if can not get rest of the bits in I be something to play with in the mean time this will give a basic hug window + access to the EGL as can see Need to Code some of the the bits to BASIC . but here trying to tie in that on the Second Stage BR Alex Some Code to help get started + reporting bugs , Welcome 'bacon testgl.bac
INCLUDE hugrpi.bac HUGOPTIONS ("NOSCALING")
LOCAL rotz = 0 TYPE float
win = WINDOW("Test Win",800,600) CANVAS(10,10,780,580) 'gdk = gdk_window_at_pointer(ADDRESS(MOUSEX),ADDRESS(MOUSEY))
WHILE 1 DO IF KEY() == 65307 THEN bcm_host_deinit() PRINT rotz END ENDIF
LOCAL bc = 0 TYPE float CLS ' Draw BACKGROUND hugView(HGL_2D_ORTHO) glColor4ub(0,27,51,255) RECT(0,0,WIDTH,HEIGHT,1)
glColor4ub(255,0,0,255) hugView(HGL_2D_ORTHO) glTranslateOrtho(400,300) LOCAL bt FOR bt = 1 TO 360 glColor4ub(255,(int)bt,0,255) 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,255) QBEZIER(0,0,200,bc,300,-(bc-400),0.1) NEXT ' 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 Attachments:hugrpi.bac.bz2 (14.34 KB)
|
|
|
Post by vovchik on Jan 7, 2017 0:41:24 GMT 1
Dear Alex, Great work. I now have to look at that hugrpi code and try to get an understanding. Demo works. With kind regards, vovchik
|
|
|
Post by vovchik on Jan 7, 2017 10:47:46 GMT 1
Dear Alex, I did a little mod here because the canvas ws not centred on the window. Have to look at hugrpi.bac later to see why.... With kind regards, vovchik
|
|
|
Post by alexfish on Jan 7, 2017 13:01:38 GMT 1
Hi Vovchik
Not sure , but do have some thoughts
this possible the screen size and how the coords are set
in the hugrpi coords are calculated in the cls
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
I know your resolution ,
The ViewPort YPOS may be fixable Looking At the XPOS not sure
Can You Post The results of these
gtk_window_get_size(win,ADDRESS(WIDTH),ADDRESS(HEIGHT)) gtk_window_get_position(win,ADDRESS(XPOS),ADDRESS(YPOS))
IE PRINT WIDTH PRINT HEIGHT PRINT XPOS PRINT YPOS
need the results of the original demo + the modded version
then can compare what I see from here Here looking at
glViewport(XPOS+1+canvas.x,(((State.screen_height-10)-HEIGHT)-YPOS)-20+canvas.y, canvas.width, HEIGHT-(HEIGHT- canvas.height));
Then can try an omit the HUGOPTIONS ("NOSCALING")
and see what happens.
and post those results as well.
when have got those , then can try the window in full screen
Can I also ask.. in the full screen demo with the text , can y see the all top textbox as in The White Rectangle around text
BR Alex
|
|
|
Post by alexfish on Jan 7, 2017 13:15:50 GMT 1
Hi Vovchik
Forgot to mention
If can put the Window at top left 0,0 . This be from where i need the INFO
BR Alex
|
|
|
Post by alexfish on Jan 7, 2017 13:51:30 GMT 1
Hi Vovchik
Just had a thought
Raspberry PI3 has a scan mode , normal and Over Scan.
on U'r Desktop , Do it show Full Screen or Is the Desktop Smaller than the Monitor Screen.
BR Alex
|
|
|
Post by vovchik on Jan 7, 2017 14:16:48 GMT 1
Dear Alex,
Both of these give an identical result (1200x680):
xdpyinfo | grep 'dimensions:'
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
and the demo, with CLS modded to spit out geometry, gives:
eglGetDisplay OK graphics_get_display_size OK w:h - 800:600 x:y - 0:0 w:h - 800:600 x:y - 200:40
HUGOPTIONS$("NOSCALING") doesn't seem to have any effect. Placing the canvas at 0:0 simply moved the canvas a bit, so it was partly outside the window bounds, as in your original demo. I wonder where we have to fiddle with DPI.
With kind regards, vovchik
|
|