Think about Loose Coupling | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
This is an interesting question. It's been a very long time since I wanted to have an OpenGL widget within a standard user interface, and back then I was using Delphi. I don't really have an answer for your specific question, but just some general thoughts you might find helpful.
GLUT is a very old attempt at making a cross-platform API for writing purely OpenGL applications. GLUT has a lot of limitations, and there is a sort of spiritual successor called GLFW that you should probably look at first before doing GLUT (and yes it has a perl module ). However, this spiritual successor also focuses on being a top-level-window standalone type of environment, so it might not meet your needs either. If you happened to be running on X11 (or wayland with the compatibility layer) and don't care about cross-platform, I think my X11::GLX::DWIM module should have everything you need. Just create your X11 window with Tk and then use that as the target for creating the OpenGL context. If you are running Windows and don't care about cross-platform, I think you can just change the parent of the OpenGL window after it is created and hopefully make TK aware of that change. I would guess that GLUT or GLFW wouldn't mind if their window is suddenly the child of another window. I have no idea what is involved on Mac to do this. Once you have a working OpenGL context, you might find my OpenGL::Sandbox module useful. It has GL 1.4 support in OpenGL::Sandbox::V1, and font support in OpenGL::Sandbox::V1::FTGLFont. If you want to do modern shader stuff, it has really handy wrappers for Programs, Shaders, and uniforms. To see how it all fits together, there is a commandline implementation of shadertoy.com. It can be a bit of work to get these modules working, especially if you are on Windows and need to round up various DLLs. Sorry about that. (patches welcome :-) especially build documentation for platforms other than my own) In reply to Re: Graphics: OpenGL in Perl/Tk ... with GLUT
by NERDVANA
|
|