500 Balls hitting a static box(OpenGL and ODE)

Enter “Balls from heaven”! This is an improvement to the bouncing ball application I posted before, I left it as the way I found the code snippets from multiple sample projects and tutorials, now that I’ve got the hang of it more stuff can be done. The source includes links to some sites that I’ve found important for ODE and OpenGL.

The source is in standard C++, and uses (Open)GL, GLUT and GLU. To compile on Windows with MSVC++ you’d need to edit, but for MingW you’d not need to edit(linking might be hard, I haven’t done it though). On any Linux you can compile with the following commands IF you have ODE(in the repos by the name libode), OpenGL(usually comes by default, but if you are running with prop drivers make sure the linker sees that libGL.so) GLU and GLUT make sure you’ve installed those, commands that are used to install those are in the previous post.

g++ -o balls ogl2.cc -DdDOUBLE -lGL -lGLU -lglut -lode
Advertisements

Ball Collision with ODE and OpenGL


This is a ball colliding with an unseen surface, using ODE and OpenGL. Took a lot of time to get my head around ODE because there are no good tutorials or simpler sources to learn from.

Download Source

You need to install the following(Ubuntu)

sudo apt-get install freeglut3-dev
sudo apt-get install libode-dev

For other OSs install ODE by source, I’d recommend you to keep on to gcc.

g++ -o ball ogl.cc -DdDOUBLE -lGL -lGLU -lglut -lode

Fix ibus unprocessed keys bug on 11.10

All Oneiric users are having an ibus bug that does not let them to use any plug-in for ibus to work properly(unprocessed keys such as spaces get added to the text before the converted text). Seems it was introduced with Unity, but it is not just Unity. I am not using Unity(Kubuntu+gnome-shell), but I was affected by this bug as long as I had 11.10 installed! Now finally a fix has arrived but its not in the repositories yet(or I failed to find any). You’ll have to compile from source, hurray!

http://github.com/fujiwarat/ibus

You don’t need to git clone, you can download it in zip format. And happy compile time!

Compile notes

1. It’ll ask for gtk-doc, which I did not find in the repos. This one is a documentation generation tool but the package that’s in Ubuntu repo is just documentation about gtk+; no use in that just download the source and compile it.

2. I was not able to run ibus-setup after installing, it crashed giving a stack trace! Well I don’t like to patch around problems but hey I just want to type some Sinhala, so I just patched it with,

try:
<problematic code>
except:
    pass

Make sure you have the indentation correct using tabs.

More information is available on the bug reports,

ibus@googlecode-bugreport1

ibus@googlecode-bugreport2

ibus@launchpad-bugreport1

Xtreme hack

The answer to problem X, in IEEEXtreme 5.0 and I didn’t even read it properly in the competition trying to do other problems, and without a fresh mind to think it through this one slipped out too. Anyways, did it now and C++ really boosts your development time. I don’t care what others say, I’ve used Java and C enough to make a comparison between these languages. For C the hard work is awarded with performance, for Java you get a knowledge in Java API which would also change from Java version to version and drop dead slow applications. This is not a rant, but a conclusion. And here’s the answer!

Xtreme collisions

This is the answer for problem H of IEEEXtreme 5.0, I did not attempt this one on the competition and now feel bad about it! Nevertheless it can have defects still. If you find any please let me know. I haven’t completely finished it as a submission, so please make sure of these before you use the source.

1. Make sure you make a “ball” object for every ball.

2. Make sure you push_back those balls on to the list in a sorted manner from South most(position=0) ball to the North most ball; it only checks the nearest balls for collisions.

PS: All of the balls’ positions are updated even though the question asks for only a specified ball’s position.

Xtreme cable ways

This answer is for the question C in IEEEXtreme 5.0, is based partially on my answer at the actual competition(still don’t feel like giving up on this one, it kept on getting errors back then). It features a timer too, I need you to run it(by compiling the original version by me, ofcause) and get it hanged or get it to run for more than 5 seconds and send me the input!

Note: The time is displayed in micro-seconds for your inconvenience.

Xtreme resistors

This is my answer to problem J of IEEEXtreme 5.0(problem set), I was there too but this problem slipped my team. And I was thinking of it after the competition, and found out on designing that for circuits like unbalanced(when there is a current flowing in the central resistor) Wheatstone Bridge, sequential and parallel systems of simplifying resistor circuits are some what hard to apply in an automated manner(I personally failed to even find any automated solution other than solving the equations themselves!).

Then I saw it! The problem says itself that it’ll only check resistor systems that are parallel or sequential. So here’s the code. It might be the slowest way to get it done, but it gets it done.