Beefy Boxes and Bandwidth Generously Provided by pair Networks
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
in thread Graphics: OpenGL in Perl/Tk ... with GLUT by haj

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (6)
As of 2024-03-28 08:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found