PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
I'm converting a simple raytracer I made in php over to c++ and I can't figure out how to convert a certain part. The code below creates a "tile/checkered" pattern that can be put on a plane, I didn't make it up myself, I copied it from a javascript raytracer and just modified the function calls to make it work, so the javascript version of this code was very similar. Anyways, what is the == doing? In c++ it doesn't work at all and when I run it with just setColorRed((square/2)) it doesn't make the correct pattern of every other square being black or white. Any suggestions?
"($square/2) == floor($square/2)" is going to evaluate to true/false (or 1/0 perhaps in this case). It will be true if $square is even and false if it is odd. So to make the squares it is passing RGB 1,1,1 or 0,0,0.