Go to advanced search

by paddyg
Sun Jun 24, 2018 4:24 pm
Forum: Other programming languages
Topic: .NET Core - Raspbian or Win10IoT?
Replies: 132
Views: 6353

Re: .NET Core - Raspbian or Win10IoT?

but there are symbolic math libraries that cope with this kind of (notational finesse) thing fine, but at cost of processing time. There will be one for javascript if you want to have a play but to see what they do try typing (1/3 + 1/3 + 1/3) == 1 or sqrt(2) * sqrt(2) into wolfram alpha PS I was ve...
by paddyg
Sat Jun 23, 2018 1:01 pm
Forum: Other programming languages
Topic: .NET Core - Raspbian or Win10IoT?
Replies: 132
Views: 6353

Re: .NET Core - Raspbian or Win10IoT?

@jahboater, yes, looking at the LLVM object code it has rather bizarrely converted one rotl() to rol but not the other! Comparing with the gcc version is a bit difficult but it does look to have possibly reduced the number of mov instructions, by doing things in a different order. In the tightest lo...
by paddyg
Fri Jun 22, 2018 9:25 pm
Forum: Graphics programming
Topic: 3d graphics libraries that run on the Pi 2 that aren't slow?
Replies: 17
Views: 439

Re: 3d graphics libraries that run on the Pi 2 that aren't slow?

Partly for my own entertainment/enlightenment I've been transcribing the pi3d python module to pi3d_rust for which I have used sdl2 with the raspbian experimental OpenGL driver. I've needed surprisingly few changes in the opengl and gles stuff. I still need to add comments to the code to point out w...
by paddyg
Fri Jun 22, 2018 3:00 pm
Forum: Other programming languages
Topic: .NET Core - Raspbian or Win10IoT?
Replies: 132
Views: 6353

Re: .NET Core - Raspbian or Win10IoT?

Yes, that fixes it: 36s with C v. 45s Rust. gcc v g++ doesn't make any difference. Rust does have a fn rotate_left() but it it's basically identical code and the compiler automatically seems to optimize so #[inline] on rotl() has no effect. Also rotate_left() takes u32 argument so my usize was wrong...
by paddyg
Thu Jun 21, 2018 11:06 pm
Forum: Other programming languages
Topic: .NET Core - Raspbian or Win10IoT?
Replies: 132
Views: 6353

Re: .NET Core - Raspbian or Win10IoT?

Just to throw some more random info not releated to .NET Core or Win10IoT... I wondered what cython might make of the random number generator test. And then I thought it might be more interesting to see how rust coped. So copy pasting the code from p2. I got $ g++ -O3 -o test5 test5.c $ time ./test5...
by paddyg
Tue Jun 05, 2018 7:26 am
Forum: Other programming languages
Topic: rust version of pi3d (python graphics & 3D)
Replies: 2
Views: 301

Re: rust version of pi3d (python graphics & 3D)

good point. It depends, of course on where the bottlenecks are. Which is probably my next step (ie profiling). After a superficial test (varying polygons, pixels and number of objects to draw) The slow part on the RPI, at any rate, seems to be inside the new GL driver so building SDL to use the broa...
by paddyg
Mon Jun 04, 2018 7:03 pm
Forum: Other programming languages
Topic: rust version of pi3d (python graphics & 3D)
Replies: 2
Views: 301

rust version of pi3d (python graphics & 3D)

Anyone curious about rust (maybe after seeing the significant increase in speed with firefox quantum, or hearing that it will be the replacement for C/C++...!)? As an experiment I've started converting the python module pi3d to rust. I'm trying to keep the structure of the code as much in step as po...
by paddyg
Thu May 24, 2018 7:51 am
Forum: OpenGLES
Topic: getting a square-pixels pi3d Display
Replies: 3
Views: 416

Re: getting a square-pixels pi3d Display

Just for completeness. The further discussion here https://github.com/tipam/pi3d/issues/224 hopefully solved the problem for the OP
by paddyg
Tue May 15, 2018 11:36 pm
Forum: Python
Topic: Streaming a Pygame window
Replies: 2
Views: 159

Re: Streaming a Pygame window

Don't know if it's any use but I've used realvnc with the experimental video setting to remotely view the full graphics from the RPi remotely (doesn't have to have x11 server running unless you want to do file transfer and other things.) (Also it doesn't seem to be happy with the GL driver enabled)
by paddyg
Tue May 15, 2018 11:32 pm
Forum: Python
Topic: Passing Variables as Arguments to Timer Objects and other Functions
Replies: 2
Views: 174

Re: Passing Variables as Arguments to Timer Objects and other Functions

I wouldn't use the * expansion - it can be rather confusing. It basically expands a list or tuple into separate arguments for passing to a function, which is why python complains when you use it as you call the function. I would pass the list like this, which is easier to understand until you become...
by paddyg
Tue May 15, 2018 11:17 pm
Forum: Python
Topic: Pi3D
Replies: 241
Views: 25776

Re: Pi3D

Jim, sorry not to reply to your previous post. Lots of good ideas there - I was partly diverted because of some thoughts I had about making pi3d easier to set up on Windows and OSX by using an openGL wrapper such as SDL2. The main reason for not going down that route has been the speed impact on the...
by paddyg
Fri May 11, 2018 7:43 am
Forum: Python
Topic: Using Python to look for a difference in response to HTML request from a website's API
Replies: 14
Views: 467

Re: Using Python to look for a difference in response to HTML request from a website's API

That kind of thing can be easy with python using urllib request. I've just done it for this page using this code import urllib.request import time URL = 'https://www.raspberrypi.org/forums/viewtopic.php?f=32&t=213259' old_txt = None while True: with urllib.request.urlopen(URL) as response: new_txt =...
by paddyg
Thu May 10, 2018 10:58 pm
Forum: Python
Topic: button stop
Replies: 1
Views: 133

Re: button stop

Some of your indentation looks wrong, possibly you've mixed tabs and spaces. If you tidy that up it will be easier to help but if your elif goes with your if and you set prev_input equal to input at the end each loop then I would expect something more like elif prev_input and not input: The way you ...
by paddyg
Thu May 10, 2018 7:02 pm
Forum: Python
Topic: Pi3D
Replies: 241
Views: 25776

Re: Pi3D

That sounds bad. There's lots of scope for unsafe operations patching pointers and untyped python variables into gl functions. What python are you running and is it 64 or 32 bits? This laptop is also i5 8Gb with windows 10 - but it's in as small a partition as I thought I could get away with and it ...
by paddyg
Tue May 08, 2018 2:58 pm
Forum: Python
Topic: Pi3D
Replies: 241
Views: 25776

Re: Pi3D

Hmm, there is a ShadowCaster class and shader that works ok for shadows cast onto the ground or other objects (see CastShadows and TigerShadow demos) but I can't get it to work for your rings (and I can't really remember how it works) I will have a look later.
by paddyg
Tue May 08, 2018 9:31 am
Forum: Python
Topic: Timezone Clock - Can this code be better?
Replies: 4
Views: 270

Re: Timezone Clock - Can this code be better?

google DRY v WET coding. This kind of thing (not tested at all so possibly full of typos etc.) #!/usr/bin/python import time import datetime import pytz from Adafruit_LED_Backpack import SevenSegment brightness = 15 # =========================================================================== # Cloc...
by paddyg
Tue May 08, 2018 8:15 am
Forum: Python
Topic: Using Hall Effect Sensor to measure wheel speed
Replies: 2
Views: 172

Re: Using Hall Effect Sensor to measure wheel speed

Hard to give much help without knowing what problems you've had, what sensor you're using and how you've wired it up and configured your software. But this is from a recent exercise bike project with all the extraneous bits deleted (hopefully I've not deleted anything vital!) I suggest you switch to...
by paddyg
Sun May 06, 2018 7:28 am
Forum: Python
Topic: Pi3D
Replies: 241
Views: 25776

Re: Pi3D

Checked the Starfield.py demo on windows and noticed that Diplay.create() has the samples argument . This improves antialiassing for white lines on a black background, unfortunately it doesn't seem to have been implemented in the ANGLE software (maybe I should checkout the latest source code and rec...
by paddyg
Sat May 05, 2018 8:42 am
Forum: Python
Topic: Pi3D
Replies: 241
Views: 25776

Re: Pi3D

This kind of thing. The default size of a Triangle is side length 1 so sometimes you need to specify the corners or set_alpha(0.0) to hide them. ... saturnimg = pi3d.Texture("textures/Saturn_1024x512.jpg") empty0 = pi3d.Triangle(z=100.0) # displaced empty1 = pi3d.Triangle(rx=85.0) # no displacement ...
by paddyg
Fri May 04, 2018 10:24 pm
Forum: Python
Topic: Pi3D
Replies: 241
Views: 25776

Re: Pi3D

Jim, I'll run this in the morning and show you what to do but basically the best way of doing things like this is using the parent-child system (The gun and turret of the TigerTank demo uses this, and probably others) So what you want is probably for both Saturn and its rings to be children of a 'em...
by paddyg
Sun Apr 29, 2018 8:15 am
Forum: Python
Topic: "pip uninstall" won't
Replies: 11
Views: 560

Re: "pip uninstall" won't

Did the example code have "import PIL" explicitly, and that's what caused the error or was the error subsequent when you tried to do something with PIL giving something such as "module 'PIL' has no attribute Image"? I think the old PIL did used to import PIL but new PIL (pillow) needs to do "from PI...
by paddyg
Sat Apr 28, 2018 9:45 am
Forum: Python
Topic: Installing Program requiring Python 2.7 when default is 3.x
Replies: 17
Views: 655

Re: Installing Program requiring Python 2.7 when default is 3.x

Hopefully the powers behind the scenes (Ted?) *do* have a plan and are rushing to get rid of any python2 dependencies so that nothing breaks when python becomes python3 (next year). In the mean time, each week that goes by adds to the problem as people start to learn how to program unaware that pyth...
by paddyg
Sat Apr 28, 2018 8:44 am
Forum: Python
Topic: Installing Program requiring Python 2.7 when default is 3.x
Replies: 17
Views: 655

Re: Installing Program requiring Python 2.7 when default is 3.x

@B.Goode, yes you're right generally but weewx seems to have simplified installing and running http://weewx.com/docs/debian.htm [I was looking at the wrong page before!! :oops: It needs python-configobj, python-cheetah and python-imaging. I think all those have py3 versions now but it's a long-winde...
by paddyg
Sat Apr 28, 2018 6:59 am
Forum: Python
Topic: Installing Program requiring Python 2.7 when default is 3.x
Replies: 17
Views: 655

Re: Installing Program requiring Python 2.7 when default is 3.x

I would side with @pfletch101 on this. In my opinion raspbian should have switched to defaulting to py3 months ago. In only 'a few months' support is going to be dropped for py2. I've not looked in detail at the source for weewx but I doubt very much that it needs to be py2 only - marshmallow-sqlalc...
by paddyg
Fri Apr 27, 2018 11:11 pm
Forum: Python
Topic: Pi3D
Replies: 241
Views: 25776

Re: Pi3D

Jim, I think the area covered by the HYG-database is fairly local in galactic terms. Flying around the StarField.py demo makes you realize how gigantic the universe. To fly though the stars so they stream past sci-fi like you need to press w enough times to get up to a step size per frame of about 3...

Go to advanced search