|
Post by alexfish on Nov 27, 2015 23:52:28 GMT 1
Hi Vovchik think the two files are the same? so can't test the png's I be getting lines showing in the tests ? in the vertical + one horizontal ? other than that the render speed is fine BR Alex See U updated the post all tests on the Raspy show these lines in the same place, ? BR Alex Attachments:
|
|
|
Post by vovchik on Nov 27, 2015 23:58:52 GMT 1
Dear Alex,
Can you post a screen shot with the problem? I updated both the SVG and PNG archives recently, so grab the latest for testing. The progs work on my machine. I wonder how they show on other systems. I wonder how they work on Peter's system(s).
With kind regards, vovchik
|
|
|
Post by vovchik on Nov 28, 2015 8:50:04 GMT 1
Dear Alex, I see what you mean. Programmatically, the pixels are gone through one by one and drawn, and it works on my machine, so I think the problem may be in one of the the gdk function bits (is rowstride is returning an incorrect value?) on PI. Weird. Are the SVGs also showing the lines? If not, then it might be the inline reading function. With kind regards, vovchik
|
|
|
Post by alexfish on Nov 28, 2015 12:40:36 GMT 1
Hi Vovchik think only can test by like for like , so done a run on the rgba this is the results of the rgba at 12X128 and the scale a 1 and the printout of gdk get BR Alex Attachments:buf1.bz2 (34.09 KB)
|
|
|
Post by vovchik on Nov 28, 2015 12:58:12 GMT 1
Dear All, Here is a routine that displays inline svg strings, inline data and file images. It reads and writes directly to GL canvas buffer. Images can be placed using x,y and scaled. Have fun... With kind regards, vovchik
|
|
|
Post by alexfish on Nov 28, 2015 13:07:39 GMT 1
Hi Vovchik
Great work . got no image faults..
all need is 4 x Seven Year itch buffers , with callback ... then cigar is lit.
BR Alex
|
|
|
Post by vovchik on Nov 28, 2015 14:13:16 GMT 1
Dear Alex, Back by popular demand - Marilyn Revisited. Many ways of doing this - and we could think of using sprite strips and viewports later - but this works - and reuses the pixbufs. Another way of doing it would be to create GL canvas clones and to update the canvas with them, so as not to use the gdk pixels -> GL pixels routine with every display of frames. That is on the drawing board. I hope this works for you. With kind regards, vovchik Attachments:
marilyn01.bac.tar.gz (169.05 KB)
|
|
|
Post by alexfish on Nov 28, 2015 14:24:14 GMT 1
Hi Vovchik
Works as good as ever
No delays there
Also Noted a big difference on cpu usage , normally get 35% on glut drawing the basic square circle routines here using only 5 to 10 %
BR Alex
|
|
|
Post by Pjot on Nov 28, 2015 21:23:19 GMT 1
Hi vovchik,
On my system the marilyn demo crashes at line 93/94 with an invalid write of 4 bytes:
image[(CANVAS.ysize - j - y_offset) * CANVAS.xsize + i + x_offset] = \ ((a & 0x0ff) << 24) | ((b & 0x0ff) << 16) | ((g & 0x0ff) << 8) | (r & 0x0ff)
I guess the offset in the image array is out of bounds somewhere?
When I add a '-1' as follows it all works:
image[(CANVAS.ysize - 1 - j - y_offset) * CANVAS.xsize + i + x_offset] = \ ((a & 0x0ff) << 24) | ((b & 0x0ff) << 16) | ((g & 0x0ff) << 8) | (r & 0x0ff)
Not sure if this really is correct, but something is going wrong with array values - an array of ysize pixels varies from 0 to ysize-1, such crashes always are caused by something similar to this.
If you run your demo on your machine using 'valgrind', you'll probably see the same issue...
BR Peter
|
|
|
Post by vovchik on Nov 28, 2015 22:08:27 GMT 1
Dear Peter, Thanks for the fix. That was the problem, I think. I think Spinning Dancer will also work. It uses a sprite strip and, after loading into a pixbuf, it is processed frame by frame. I hope it works for you and Alex. With kind regards, vovchik PS. I updated the marilyn01 and canvas-pixbuf-svg-png archives with that fix, too. Attachments:dancer01.bac.tar.gz (154.55 KB)
|
|
|
Post by vovchik on Nov 28, 2015 22:55:48 GMT 1
Dear all, This is a little canvas fading routine that also writes directly to the GL pixel array. Seems to work. With kind regards, vovchik
|
|
|
Post by vovchik on Nov 28, 2015 23:25:46 GMT 1
Dear all, And here is a little wooden gears animation. With kind regards, vovchik Attachments:wooden-gears.bac.tar.gz (168.09 KB)
|
|
|
Post by Pjot on Nov 29, 2015 8:56:43 GMT 1
Thanks for the demonstrations vovchik! All work as advertised Best regards Peter
|
|
|
Post by vovchik on Nov 29, 2015 10:59:12 GMT 1
Dear All (and Peter), And, also, back by popular demand, Alien Walk. With kind regards, vovchik Attachments:alien-walk.bac.tar.gz (262.25 KB)
|
|
|
Post by Pjot on Nov 29, 2015 11:53:51 GMT 1
Thanks vovchik, The concept of loading images into a GL canvas is very nice. OpenGL does not provide any facility by itself to load images. Therefore, such functionality has a dependency to an external library (unless we would like to reinvent the wheel ourselves ). Your implementation makes use of the gdk_pixbuf library and needs some fiddling with arrays to get things right (works fine). So, I was wondering if things could be done in a more easy way, using a 3rd party package which is GPL and available everywhere. I stumbled into a collection of helper function in Public Domain called "stb". We can add the 'stb_image.h' file without license issues and load a picture. Below a proof of concept loading your Marilyn Monroe "0000.jpg" image. BR Peter PRAGMA INCLUDE stb-master/stb_image.h : ' Include the stb_image header file PRAGMA OPTIONS -DSTB_IMAGE_IMPLEMENTATION : ' Enable graphical functions
PROTO stbi_set_flip_vertically_on_load : ' We must flip image
INCLUDE canvas.bac
DECLARE x, y, n TYPE int DECLARE data TYPE unsigned char*
stbi_set_flip_vertically_on_load(TRUE) : ' Enable image flipping data = stbi_load("0000.jpg", &x, &y, &n, 4) : ' Load the actual image
'-----------------------------------------
WINDOW("Marilyn Monroe", x, y)
glDrawPixels(x, y, GL_RGBA, GL_UNSIGNED_BYTE, data)
WAITKEY
|
|