Hi Rob,
I have two tips for you:
- move tbgl_resetKeyState before while loop
- use TBGL_GetWindowKeyOnce instead of TBGL_GetWindowKeyState
Let me know,
Petr
Hi Petr, (or any one else who knows)
Because of the complex view and a clearer look in 2D, I tried to make a switch via the space-bar.
Seems only a very short touch works (the keystate is reset in the loop - program a delay ?? ).
(program uses the arrow keys for rotations, and PgUp/Dn for changing the parameters)
Thanks in advance
Rob
Last edited by RobbeK; 09-10-2013 at 16:22.
Hi Rob,
I have two tips for you:
- move tbgl_resetKeyState before while loop
- use TBGL_GetWindowKeyOnce instead of TBGL_GetWindowKeyState
Let me know,
Petr
Learn 3D graphics with ThinBASIC, learn TBGL!
Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB
And one more tip - I noticed you add to the variables like:
Coding this way in while cycle will result in different speed on different PCs.If TBGL_GetWindowKeyState(hWnd, %VK_LEFT) Then rx=rx-3
The basic way around this is to think - how much I want the value to change over 1 second?
Let's say we want the rotation to be 360 degress per second. All you need to do is to scale the addition relatively to current framerate:
This will make your graph rotate at the same speed on PCs with different performance.If TBGL_GetWindowKeyState(hWnd, %VK_LEFT) Then rx=rx-360/FrameRate ' -- Alternative If TBGL_GetWindowKeyState(hWnd, %VK_LEFT) Then rx -= 360/FrameRate
Petr
P.S. The script producess really impressive visualization, very nice!
Last edited by Petr Schreiber; 09-10-2013 at 20:38.
Learn 3D graphics with ThinBASIC, learn TBGL!
Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB
Thanks Petr,
TBGL...once works ! (with ..reset.. outside the loop).
Framerate : thanks, I will remember .. but on my old 'puter I take all the speed I can get (at least for these kind of programs).
There's something else , this programs uses the same method both for 2D and 3D - only the z=0 for 2D. The matrix contains exactly the same number of coordinates, yet rotations seem to go faster in the pseudo-2D - seems some filtering is done (at pixel level) - is that a TBGL or an (open)GL mechanism ??
It doesn't matter much here, it's a dynamic model any way - but for static objects (without "inbetween" calculations), I intended to write some algorithms filtering duplicate data - but if TB/Open GL already does so, there's no need.
These quadratic mappings are rather tricky , a certain point (x,y) may have several z values ... and even worse , points can start generating closed curves and repeating themselves - (at pixel level)
Thanks again, Rob
Hi Rob,
that is interesting observation you have, it makes me suspicious regarding your OpenGL drivers.
Could you please check this thread:
TBGL Troubleshooting
and download & run the OpenGL_GetInfo.tBasic from there, and post the results please?
Petr
Learn 3D graphics with ThinBASIC, learn TBGL!
Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB
Hi Petr,
Software emulation :-( .. started when installing Win7, also used the recovery partition for a Linux distribution.
(it's an old recycled computer, on the one I have for the job, everything runs much smoother ).
best
Rob
Okay - that means you use Microsoft OpenGL implementation, all computed on CPU.
Try to find out the name of your graphic card/accelerator - you will see that after installing the proper driver, which I will help you to find, the speed will boost up significantly, even if you have Intel GPU.
Petr
Learn 3D graphics with ThinBASIC, learn TBGL!
Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB
Dobri Den ! (IIRC - been a while since been in CZ republic - for a while I have been working for a Russian chemical Cy)
Thanks again ( I think I'm some Urquell's in debt now ;-)
I used a nice little program to investigate the architecture of the computer (I attached it , it can be at use for you when digging into computers).
Went to the Intel site, but no drivers above XP available.
After some googling, found other people with a similar problem - and it seems someone made a hack for Win7.
Works perfectly (though, I had to change some settings before Win7 wanted to run it).
All sunshine now .. Your program outputs .. OpenGL correct installed ;-)
No slow-downs ani more, everything runs at a constant speed (though 64 Mb is nothing compared against what is exhibited here -- never mind, forces me into smart programming ;-)
(btw : do not know you have a mathematical background -- but in case of the twin primes , after some thinking about them, I found their sum is always (except the first one) a multiple of 12 (or 12) - this knowledge speeds up calculations 6x. The proof is very easy, but one has to look for such things ... )
thanks again Rob
Last edited by RobbeK; 12-10-2013 at 12:33.
Dobrư večer! ,
thank you for good news, I am happy OpenGL now runs as designed! 64 MB is actually lot of memory, I remember beautiful game called Giants: Citizen Kabuto used just 16MB, if I am not mistaken, and yet it looked amazing.
I didn't knew the feature of primes you mention, interesting indeed. When I need prime numbers in range, I usually go the dirty way - going in the range and testing with IsPrime, but that is the approach of the lazy one
Petr
Last edited by Petr Schreiber; 13-10-2013 at 00:41.
Learn 3D graphics with ThinBASIC, learn TBGL!
Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB
Hi Petr,
The speed-up comes from the fact that when the sum of two twin primes is a multiple of 12, the "parent" (the number between them) is a multiple of 6, and you only have to test these.
n + (n+2) = k.12
2(n + 1) = k.12
n+1 = k.6
The difference in speed can be tested with the attached program.
The speed of TB is good, after all one pixel-width represents 1000 numbers.
best Rob
Bookmarks