This one concerns friends who have to do away with Graphics. We had our Graphics, some of us liked it while the others "Really" liked it ! :p . The main reason for such "real" liking were the painstaking assignments. Yes!, The assignments, which can be great fun for some, are tremendously boring for others.
Writing long C++ codes to get triangles form rectangle and circles, is like calculating the sum of first n Fibonacci numbers with pen and paper!. Many a times people are not comfortable with stack manipulation of Instruction Pointer, and they are asked to manipulate stack of matrices.
The main problem arises when triangles have to aligned to look like robots and dogs. Also the texture of the triangles have to be so adjusted that the triangle skeleton indeed looks like a Dog!. Write a file, compile it, run it, change values, compile it, run it, change values, compile it, run it,...and so on.
But all this can be avoided :D. To your rescue is Python, a language which requires minimum amount of code. I would like to draw your attention to PyFLTK ( Python Fast Light Tool Kit ). It will certainly make your life easy.
No need to write codes !. Just design your window on an interactive shell :). Type a statement and see the results. No need to compile, no need to re-execute the previous steps, no need to bang your head against the wall. Here's an example.
> python
>>> from fltk import *
>>> window = Fl_Window(300,300)
>>> window.end()
>>> window.show()
# Window pops up here
>>> window.label("My new title")
# Window label changes immediately
>>> window.color(FL_RED)
>>> window.redraw()
# Window color changes to red immediately. TADA !
Short, rather much shorter codes.
from fltk import * ;
window = Fl_Window(300,300) ;
window.end();
Fl.run();
Thats it, just 4 lines to create a window. Probably you will still be including libraries and header files in your C++ code.
Show/Hide Functions
Still bothered about your submission in C++ ?
You can put your OpenGl code inside the python file by wrapping it with gl_start() and gl_finish()
gl_start()
... put your OpenGL code here ...
gl_finish()
Voila ! Party TIme :P
To install PyFLTK, and enjoy Graphics ;) go here.
You can find more about PyFLTK here
No comments:
Post a Comment