First i want to say that i use evaldraw almost everyday, at home and at work , this program is very very usefull for me. no need of a compiler no need of libraries , i just lauch evaldraw and 5 min after i get first results.
recently i have notice that evaldraw make windows destkop blinking in a strange way ... some other applications (like winamp plugins) seems suffering from this also. not only it make some some windows 2d region blinking but when it happened it also slow down the whole computer (because evaldraw force these regions to be repainted???). I have notice this on various workstations (all running XP). where does it comes from ?? directx stuff? bad programming practice?? also sometimes the mouse get locked (on the whole computer) (after switching from evaldraw to another app) and the only way to unlock it is to switch back to evaldraw (with alt tab)... ken can you fix this???
also having sliders (some kind of UI trackbar) that are linked with global vars (an array) would be very nice (eg : i have done a kick ass 2d effect and want to change the params to directly see the results...
Edited by redfaction at
Awesoken at
Re: Evaldraw: some bugs and suggestions
I have noticed issues with flicker and the mouse cursor as well. Prior attempts at fixing this have failed. Today I decided to test with various old versions of WINMAIN.CPP - and to my surprise I found something that changed between 10/25/2007 and 01/13/2008 that looks like the problem. Apparently, writing "gncmdshow", the first statement in "case WM_SIZE", is evil. I'm not sure why that line is there. Anyway, removing it makes things much happier. I put up a new version of EVALDRAW. Let me know if it works better. If so, I should update all of the winmain-based demos on my site, as they are all affected by this bug.
I have an idea for the sliders, but like most things, have not had a chance to implement it.
redfaction at
wow :o very fast reply - new evaldraw version, i'm impressed!
seems changes have fixed blinking issues.... (i'm very happy) (i just test it one machine, i need more test to say its completly fixed).
many thx for this.
a last question : about evaldraw parser, do u plan any source code release???? (maybe just a small part, not the whole stuff) or at least a webpage or paper that briefly describe how it this done?? i think it could be very usefull for people who want to write their own parser from scratch and dont know from where to start ... evaldraw is implemented with a recursive descent parser no???? (i did one recently (which works quite well), but i dont know how to do for code optimization). in evaldraw seems some pseudo code optimization is done (unused vars are not included, some constant are merged...) - very impressive. i'm wondering how it this done. do u create a tree (that start with final vars (eg : r g b), in order to remove unused things ) then try to simplify it ???? i'm curious...
EDIT : oops seems desktop is not more flickering , but other app like winamp or messenger are still flickering , (only when evaldraw window is active (i mean have focus))
Edited by redfaction at
Awesoken at
I have no plans to release the code. It was never meant to be pretty, and it isn't. I wrote the parser from scratch, without having studied any of the literature, so I cannot say what kind of parser it is. The first stage converts the C-like code to pseudo-asm code. It scans the function forwards using a state machine. For example, if it finds and 'i', with and 'f' after it, I then have special code to search for the rest of the parts, such as '(', ')', '{', '}', 'else', '{', '}. Each section is then evaluated recursively. I have special code for each kind of statement. It's not pretty. To view this pseudo-asm code, select View..Debug..Pseudo in EVALDRAW. The optimizer has various blocks of code, such as:
Evaluate expressions based purely on constants
Simplify math expressions, such as x^2, x*1, etc..
Combine registers when result of calculation is used only once
Combine duplicate constants
Compact unused registers
Remove unused constants
Remove dead code
It runs through all blocks. If something was simplified during the pass, it runs through them all again. It keeps repeating the process until nothing was simplified during a pass. No tree. No recursion. Pure brute force. Long functions can be especially slow to optimize, because I'm not using a linked list to hold the instructions. I might fix that at some point.
Zelex at
Just started up eval draw for the first time. Very cool! :)
jnosof at
Hi, I'im using evaldraw for a while now, (say... about tow years) and I check for new updates periodicaly. btw, thanks a lot for this awsome tool. I just want to point out a little problem with the last release: it doesn't seem to work directly on XP. one have to run it in compatibility mode (either Win95.. Win2000).
ConsistentCallsign at
Evildraw [sic] is awesome! :o
Awesoken at
with the last release: it doesn't seem to work directly on XP.
Would you care to be more specific? Crash dialog info? CPU type? EVALDRAW.EXE date? I'm using XP SP2 and it runs fine.
jnosof at
sorry, I tried to run it on anoter PC with XP and it worked fine. Anyway, here are some infos :
------------------ System Information ------------------ Operating System: Windows XP Professional (5.1, Build 2600) Service Pack 2 (2600.xpsp_sp2_gdr.050301-1519) Processor: Intel(R) Pentium(R) 4 CPU 3.00GHz (2 CPUs) Memory: 512MB RAM DirectX Version: DirectX 9.0c (4.09.0000.0904) Card name: NVIDIA GeForce 6600 LE Display Memory: 256.0 MB Current Mode: 1024 x 768 (32 bit) (85Hz) Description: Realtek AC97 Audio
[Edited by Ken: I have removed the 50 pages of irrelevant hw info]
evaldraw is not awsome it's awesome... thanks.
Edited by Awesoken at
jnosof at
Oh yes! The program launches, the window appears, then it hangs without any message. the cursor turns to "hourglass". It doesn't crash the system.
Awesoken at
This sounds like the deadlock bug that I never fixed due to its difficulty of reproducing. In EVALDRAW.INI, try setting "usenumcpu=1". Also try loading a program on startup - bypassing the default program. If the default program is the trigger, you can change it in EVALDRAW.INI (see initcode=...)
jnosof at
It launches now but there are still some problems. Now some demos don't work properly: - In (x,y)...etc modes: The value of the function under the cursor is not displayed. - ceilfloor and driftbox (I've attached some screen captures): I think the problem is with the rounding trick (round(x)->(x+3*2^55-3*2^55)?) that does not work. It just returns x. btw, I'm wondering how this trick works and why the optimizer doesn't simplify the formula. The "slow" versions work fine. http://www.membres.lycos.fr/jnosof/ceilfloor2_fast.PNG http://www.membres.lycos.fr/jnosof/ceilfloor2_slow.PNG http://www.membres.lycos.fr/jnosof/driftbox_fast.PNG http://www.membres.lycos.fr/jnosof/driftbox_slow.PNG - lab3d: Blank screen. The problem seem to be with the pic() function. It seems it returns the color of the pixels that are around the middle of the picture.
When I run evaldraw in compatibility mode nothing goes wrong but I have noticed a curious thing while playing with "usenumcpu": when i set it to n from 0 and 9 I get HT:{n} (at the bottom right angle of the window). if n goes from 10 to 69 I get HT:{round(n/10)}. if n>69 I get HT:6. When I press two times F5 I get HT:2 (then the corresponding value in the .ini file is updated). I've forgotten (one more time :o) to say that previous releases work without big problems (I don't care about flickering :P)
Edited by jnosof at
jnosof at
I've changed (x+3*2^55-3*2^55) to (x+3*2^62-3*2^62). this works but is very slow. fpu exceptions? Is the fpu's control word initialized? Perhaps my OS initializes it to a different value.
Awesoken at
In (x,y)...etc modes: The value of the function under the cursor is not displayed.
The value will not display if it does not finish within 1 millisecond. I'm not getting slowdowns, so I can't reproduce this.
(I've attached some screen captures)
For some reason, I don't see attachments on these forums. Perhaps I am not priviledged enough : P
how this trick works and why the optimizer doesn't simlify the formula.
To understand the trick, you must understand IEEE floating point format. When you add a big number, the 53-bit base loses precision, which is like rounding. As for the optimizer, I think I avoided that case specifically to support this rounding trick - I don't remember. FYI: putting parenthesis around the 2 constants will optimize it and break the rounding trick.
lab3d: Blank screen .. pic() function.
I have fixed this and you'll have it in the next version.
curious thing while playing with "usenumcpu":
I have fixed this and you'll have it in the next version. The internal logic was right. The display was being cut off. The maximum number of threads supported by WaitForMultipleObjects is 64 - so I limit it to 64. Pressing F5 cycles between 1 and the autodetected number of cores. I only bound it when you press F5, so if it autodetects wrong, you can still test any value by editing the INI file.
fpu exceptions? Is the fpu's control word initialized? Perhaps my OS initializes it to a different value.
Your theory may be correct. I set the FPU in the main thread, but I never touch it in any of my spawned threads. Scripts are all executed in spawned threads. This is how I spawn threads:
My main thread's FPU state is set to 53-bit, round nearest/even. Perhaps you would like to investigate?
jnosof at
The Screen captures are now correctly attached (I hope) Forgive me, I'm new to this forum ;D
Perhaps you would like to investigate?
I don't think i could :'( I'm not smart enought.
Anyway thanks for the explanations.
Awesoken at
An Error Has Occurred! It seems that you are not allowed to download or view attachments on this board.
What I meant to say is: "Global Moderator" is insufficient to view your attachments. I think a forum setting may be incorrect.
jnosof at
I only can see the attached pictures when I am logged in. I have put links to another site.
Could I suggest a KC scripts repository? Here is my humble contribution ;D:
//Adapted from keenan Crane's quaternion julia GPU raytracer //Idea of raytracing borrowed somewhere in Jonof's forum (x,y,&r,&g,&b) { static theta=1.570796,phi=0,Dist=3,focal=4; static qtheta=1.570796,qphi=0,qr=-0.5,qim=-0.7; static O[3],vi[3],vj[3],vk[3],vt[3],O2=0; static bradius=3; static juliac[4]; static esc_r=10,max_iter=10; static frm=-1; static mx,my,mz; eps=1e-4; //Should not be static with hyper threading //static p0,p1,p2,p3; //static v0,v1,v2; //static tmp0,tmp1,tmp2,tmp3; //static gr0,gr1,gr2,gr3;
if (numframes>frm) {
if (keystat(0x36)){ //Right Shift readmouse(mx,my,mz); theta+=mx*0.01; phi-=my*0.01; Dist+=mz*0.001; } else if (keystat(0x2a)){ // left Shift readmouse(mx,my,mz); qr +=mx*0.002; qim+=my*0.002;
Another (silly) suggestion: a plugin system for those who want to add stuff.
Awesoken at
The screenshots work now - thanks. Very interesting.
Your script is realtime with 4 threads on a Quad core, and running at 2x2 pixel resolution. It is similar to a script once sent to me by Inigo Quilez, which is a Julia fractal in voxel mode:
(x,y,z,&r,&g,&b) { x *= 1.5; x2 = x*x; y *= 1.5; y2 = y*y; z *= 1.5; z2 = z*z; d = 1e32; d2 = 1e32; i = 9; do { y *= x; z *= x; x = x2-y2-z2-.7; x2 = x*x; y = y*2+.2; y2 = y*y; z = z*2-.5; z2 = z*z; if (x2+y2+z2 > 4) return(0); d = min(d,x2); i--; } while (i > 0); d = sqrt(d)*2.0; d2 = sqrt((x-.5)^2+(y-.3)^2+(z-.2)^2)*0.3; r = 112 + 145*d - 20*d2; g = 112 + 163*d - 20*d2; b = 92 + 163*d - 30*d2; return(1); }
A repository is a nice idea. I don't have the time to learn how to set one up myself. However, if somebody here wanted to do it, I would be happy to provide a link from the EVALDRAW page. Until then, you can look here. Dennis, Peter, and Robert have EVALDRAW scripts on their sites. Tom has written a lot too, but has yet to make his work public.
A plugin system is a nice idea too. Actually, I've thought about it before. I had several ideas: the ability to call other .KC scripts, and the ability to write your own user functions in a DLL. Don't expect this stuff to be added soon though.
jnosof at
I though that julia in voxel mode takes forever to achieve :-\... I'll never make this kind of assumption in the future (I hope) Thaks for the links. I Hope that the idea of repository will "make its path" (Im not sure if this is in english).
Awesoken at
EVALDRAW has just been updated with a few fixes, including the FPU settings in spawned threads, the recent issues with pic("image.png",x,y), and the HT display bug.
jnosof at
It's Perfect now, thanks a lot!
Alex at
EVALDRAW
Ken,
Is it possible to load a ready KV6/KVX/VOX file in 3D mode in EVALDRAW?
... It scans the function forwards using a state machine. ...
By "state machine" do you mean "Finite-state machine" (http://en.wikipedia.org/wiki/Finite-state_machine)?
Awesoken at
Re: EVALDRAW
Yes, that would be a nice feature. If I add it, it would probably work like the pic() function for 2d textures. In the meantime, here is a hack solution: Convert CACO.KVX to CACO.VOX (use SLAB6) and use this low-level code to read the voxels from the file directly:
(x,y,z,&r,&g,&b) { xsiz = 85; ysiz = 72; zsiz = 68; if (fil("caco.vox",int((x+1)*xsiz/2)*ysiz*zsiz + int((y+1)*xsiz/2)*zsiz + int((z+1)*xsiz/2)) == 255) return(0); r = 128; g = 128; b = 128; return(1); }
Awesoken at
Re: Evaldraw: some bugs and suggestions
Sorry, that is a poor description. The parser scans 1 byte at a time, from beginning to end, and determines what to do based on the character value. For example, if the next character is a number, it uses the strtod() function to get the rest of the number. It's really quite brute force.
Alex at
Re: EVALDRAW
Wow, thank you, Ken!
I will be using this low-level code as well as a new feature to read voxel models from file, that is just great!
redfaction at
Re: Evaldraw: some bugs and suggestions
Hello Ken,
Here is two things that doesnt work well on evaldraw and that (i think) should be fixed (when you will have some free time of course) :
1)
Evaldraw crash very easily on windows 7. Just try the following : start evaldraw, switch to another windows (ex : firefox) then switch back to evaldraw : the window is completely frozen (no more redraw), only thing to do is to kill the process or click on close (then windows will ask kill it for you). this is very annoying because this make evaldraw unusable on windows 7 (which is the today standard....)
I have seen this problem on different computers all with win 7. Aero was enabled everytime (maybe its the problem). also : on other machines (xp for eg) starting evaldraw sometimes make everything behind blinking (ex: the icons of the desktop), maybe it is linked to the same problem.
2)
When script compiler crash (which happened yesterday), there is a message saying you should send script to your friend Rodgers. but, since it crashed, there is no way of getting back the script (except if you save it every time you type a character).
i think you should give an option to directly mail send the script (like firefox does) from this error message box or (if implementing such a stuff is too complex) just add a button that will dump a txt file on evaldraw folder (then the user will manually send it later and wont loose its precious script)
Everything was tested on lastest version of evaldraw
Awesoken at
I've been using Windows 7 since November and haven't noticed any problems with Evaldraw and Alt+Tab. I do not use Aero. Recently, I've been looking at a different freeze, which occurs only in the 1D & 2D modes while editing, and the mouse cursor is in the render area. I have found the following settings: "timeoutonkey=0", "showgrid=0", and "usenumcpu=1" reduce (or possibly eliminate) the chances of this freeze, but I'm still not sure why it's happening. Hopefully I will figure it out soon. I couldn't say whether this is related to the Alt+Tab thing or not.
To fix the flicker in XP, set "drawprimary=1" in EVALDRAW.INI. I chose a misleading name since drawing directly to the primary buffer is the reason it flickers, yet you must provide a value of 1 to disable the flicker! I no longer care about a negligible speedup on older machines. As a result, I will change the name of the setting to "drawoffscreen" in the next version, and have it default to no flicker.
When the compiler crashes, you should still be able to edit the text. This has been true since the 03/21/2010 version, when I added custom exception handling (__try&__except). Are you sure you're using the latest version, or did you get it to crash so bad that my exception handling is of little use?