Re: Perl Opengl Question
by jethro (Monsignor) on Jul 12, 2008 at 15:10 UTC
|
| [reply] |
Re: Perl Opengl Question
by syphilis (Archbishop) on Jul 12, 2008 at 22:23 UTC
|
I tried to use PDL modules but I could not get PGPLOT or TriD to work
How about PDL's GD capabilities (PDL::IO::GD). Can it produce the graphics you want ?
Cheers, Rob | [reply] |
|
|
I looked at the module you mentioned it is only 2d. I also now looked at PGPLOT, I now see that it is also for only 2 dimensions. So all I am left to is either learn perl opengl, get PDL:TriD working somehow or do it with matlab and just distribute that part as a code to those who own a copy of matlab.
| [reply] |
|
|
Anyone with opengl knowledge to answer this question? I hope the answer is easy... If there is no one I assume I will have to seek opengl forums
| [reply] |
|
|
I personally believe that a (perlishly) OT solution may be given in terms of Scilab since the latter is "free enough" - if your concern is to only have to restrict to people holding a regular MATLAB license. In fact, I don't even know Scilab, but for the fact that it's similar in functionality to MATLAB, and its syntax is largely based on that of the latter, although the two are known not to be completely compatible. However "there is a converter included in Scilab for MATLAB=>Scilab Conversions." Thus that may be an option.
| [reply] [d/l] |
|
|
I found a wrong statement in my message
''And also I want to deform the coordinates of sphere so that I can transform them into sphere'' would be ellipsoid at the very end.
As for the replies, I have tried PDL but was not able to get it working for TriD or PGPLOT (findows plays a role here I assume). I havent heard of the other module you mentioned, but I will try it as soon as possible thanks
| [reply] |
Re: Perl Opengl Question
by Anonymous Monk on Jul 15, 2008 at 14:40 UTC
|
I think you're on the right track with POGL. It's the most actively maintained of the Perl-OpenGL bindings. Check out the examples directory that comes with the distribution.
If you're starting from zero with OpenGL, I can tell you that it's just a simple state machine. You tell it where things are in the universe, and it draws them while you're telling it to. Whatever the current drawing color, lighting settings, model-view matrix, etc., it just does what you tell it to according to its current state.
Using the glu* commands to draw shapes is very easy. Just remember to set up things first (color, light, etc.) before calling them.
Couple quick tips:
- Always draw in double-buffered mode. This means that you have 2 buffers: one that's being shown in the window, and the other that you're drawing on. When you're done drawing, you swap the buffers and what you just drew shows up on the screen.
- The Perl binding to OpenGL is very similar to OpenGL's C API. This means you can read OpenGL docs and tutorials, and very easily convert the code samples to work in your Perl programs.
| [reply] |
|
|
Almost forgot: you probably want to use glut to do your windowing and to capture any user input you're interested in (keystrokes and mouse clicks). It's very simple to learn, cross-platform, standard, and has a free implemenation (freeglut).
| [reply] |
|
|
| [reply] |
|
|
| [reply] |