My first 3D C++ OpenGL Program
For a 3rd Year Course I'm doing via Unisa called Advanced Computer Graphics I'm busy learning how to manipulate matrices in a 3D space so that you have the ability to generate objects in a 3D environment and view them.
We were given an assignment that had to have the following :
1x Farm (Cube and Prism roof)
1x Barn (Cube and Prism roof)
1x Water Tower (Cylinder)
3x Trees (Cylinder and Cone)
Wall around the plot.
Please note that I was not allowed to use any form of GLUT addon libraries.. I.e. cylinders, prisms and cones had to be created from scratch.
Now for those who are about to view this demo and think... O, but you can do this in 3D max quick quick..
My answer to that is : Yes.. but you are using 3D max.. I'm creating everything from scratch.
I've also had to relearn everything seeing as I barely work with c++.
That all being said..
It has all been very interesting and once I've gotten my lighting and shaders done, I'll be uploading a new version..(not any time soon, other assignments to complete [like Killing the Lich King])
But for now, you can download the complete version straight from : www.ultralord.za.net/3DFarm.exe
O FYI :
Use R to rotate
Use S to change rotation
Up and Down to zoom in and out
Left Mouse Down and drag to get a track ball type effect on the z-axis on the Y vector
Some stats :
Total Lines of Code : 570
Total amount of hours spent : Too many (took me 1 week exactly)
Total amount of complaints from wife about spending too much time in front of PC :
![]()
All in all.. I've really enjoyed this and will be looking into doing something less lame and more in line with game programming once I've got a spare moment (and completed my Java game)
Best World Cup ad to date..
Love this ad.. (well I love the Rooney bit.. Brilliantly done)
Enjoy :
Lost Questions Unanswered….
To be honest, I haven't even started watching Lost season 6, not due to any reason but the fact that my wife just keeps saying "Not yet!"
No reason, no explanation.. just "Not Yet" or "Not Now".. FML
Anyways, I watched the first minute of this video till a spoiler popped up.
Very good questions all around.. Enjoy (Don't watch unless you have seen the entire Lost)
RED-i CGI shots (Peeps I work for)
Our 3D guys are creating some awesome work over @ RED-i
Check out the latest 3D landscapes generated over @ our RED-i flickr account.
My favourite renders are :
Excellent cartoon on what Google could become. *You have been warned*
Great little tongue-in-cheek attack on Google and the privacy issues that surround it.
Project Euler : Problem 11 Solved
Problem 11 of Project Euler is a strange cat.
The Problem is as follows :
When I first attempted to solve this, I thought to myself :
Gah.. Brute force?? Who would be so fail to brute force this such a wonderful example of AI?
Answer : ME
See at first I thought brute forcing this would be rather disrespecting to the challenge, but then it dawned on me that "brute-forcing" was the most sufficient way of solving this one.
But you must be smart in the way you check your products..
Tips :
- Don't count what has already been counted *cough*up,left*cough*
- Don't forget that a diagonal goes 45° and 135°
- Math.max() FTW!
Project Euler Stats :
Total Research Time : 0 Days
Total Coding Time : 20mins
Total Code Execution Time : 0ms
Sindragosa is DOWN!
WoW, finally got the biatch down!
Spent last 2 week attempting this dragon and we finally got it down.
Gratz to all the Crows involved!

Sindragosa is DOWN!
Project Euler : Problem 13 Solved
Problem 13 of Project Euler is quite interesting.
The Problem is as follows :
Work out the first ten digits of the sum of the following one-hundred 50-digit numbers.
(numbers omitted)
Tips :
- Look @ Problem 8
- BigInteger
- It is 100 SEPARATE 50 digit numbers they want you to add.
- Don't miss copy the number and miss the last line "53503534226472524250874054075591789781264330331690" and spam Project Euler with a solution you are 100% works
Project Euler Stats :
Total Research Time : 0 Days
Total Coding Time : 10mins
Total Code Execution Time : 0ms
Project Euler : Problem 14 Solved ( Collatz Problem )
Problem 14 of Project Euler is quite interesting.
The reason I say this is because you think it will be simple (and in fact it really is simple).
But doing it in Java has a certain snag to it.
Notice the hint they give you :
NOTE: Once the chain starts the terms are allowed to go above one million.
Then remember that wonderful BigInteger class in java that is so retardedly un-user friendly..
That is all I have to say.. It seems other languages have the edge on Java on this one. Users are reporting 0.81 secs execution time where as I'm only managing to get it done in 10secs (not my finest moment). Will attempt to get this number down, but I doubt it.
The Problem is as follows :
The following iterative sequence is defined for the set of positive integers:
n n/2 (n is even)
n 3n + 1 (n is odd)Using the rule above and starting with 13, we generate the following sequence:
13 -> 40 -> 20 -> 10 -> 5 -> 16 -> 8 -> 4 -> 2 -> 1
It can be seen that this sequence (starting at 13 and finishing at 1) contains 10 terms. Although it has not been proved yet (Collatz Problem), it is thought that all starting numbers finish at 1.Which starting number, under one million, produces the longest chain?
Tips :
- Read the tip
- BigInteger
Project Euler Stats :
Total Research Time : 0 Days
Total Coding Time : 20mins
Total Code Execution Time : 9922ms
Project Euler : Problem 20 Solved
If you did Problem 16 of Project Euler just before this, then Problem 20 is quite the joke.
I did decide to change the way I get the sum of digits a little bit though. ( as per suggestion by Tim )
I changed the following code from Problem 16
String smallerNumber = removeChar(bigNumber, '0');
char[] chars = smallerNumber.toCharArray();
for (char aChar : chars)
{
answer+= Character.digit( aChar,10 );
}
to the following in Problem 20
BigInteger total = new BigInteger("0");
BigInteger ten = new BigInteger( "10" );
while (!number.equals( new BigInteger("0")))
{
BigInteger mod = number.mod( ten );
total = total.add( mod );
number = number.divide( ten );
}
No string conversion ftw! (FYI : The reason I use BigInteger is because I doubt I'll ever need to add up digits of a long or an Integer
)
The Problem is as follows :
"Find the sum of the digits in the number 100!"
Tips :
Project Euler Stats :
Total Research Time : 0 Days
Total Coding Time : 15mins
Total Code Execution Time : 0ms


