Click here to Skip to main content
15,880,469 members

Comments by Graham Breach (Top 92 by date)

Graham Breach 31-Dec-14 15:41pm View    
The compiler can reorder instructions for optimization. I can't seem to find a decent reference that says that, but the /O0 and /O1 flags to FXC disable instruction reordering: http://msdn.microsoft.com/en-us/library/windows/desktop/bb509709.aspx
Graham Breach 31-Dec-14 13:10pm View    
I'll add my guesswork: It looks like dist2 might not always be set to a value, so your code might be failing at the imgcolor.g assignment. Since shader code doesn't necessarily execute in the order that it is written, that might be preventing the imgcolor.r assignment too.

There are a lot of "might"s in that, but I hope it helps. You could also try using clamp() instead of min(max()) too.
Graham Breach 22-Dec-14 4:06am View    
Using "\r\n" as a delimiter you can split it into lines - I've updated my answer with the extra line of code.
Graham Breach 20-Dec-14 9:09am View    
You could use file_get_contents() to read in the whole file as a string, then split the string into lines using preg_split() or explode().
Graham Breach 29-Jul-14 7:29am View    
I'm sure you're right about it being a size_t in the end, but the header file has it returning a size_type member typedef. I was trying to keep my answer simple, my thinking being that "declare i and j as vector<int>::size_type instead of int" could have caused even more confusion!