sketchucation logo sketchucation
    • Login
    Oops, your profile's looking a bit empty! To help us tailor your experience, please fill in key details like your SketchUp version, skill level, operating system, and more. Update and save your info on your profile page today!
    ⚠️ Update | Sketchucation Tools 5.0.8 released with licensing improvements and bugfixes Download

    [Question] Is it possible to set the face.normal?

    Scheduled Pinned Locked Moved Developers' Forum
    23 Posts 5 Posters 3.8k Views 5 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Q
      qpik
      last edited by

      During my research for improving raytesting plugin for SU
      (http://forums.sketchucation.com/viewtopic.php?f=323&t=21077&st=0&sk=t&sd=a)
      I've found out that Ruby supports OpenGL.

      I mixed an example and library from Ruby installation.
      You can run this example in SU (unzip 4 files to Plugins folder).


      Example of Ruby-OpenGL with library.

      1 Reply Last reply
      Reply Quote 0
      • thomthomT
        thomthom
        last edited by

        and you managed to use that within SU?

        Thomas Thomassen β€” SketchUp Monkey & Coding addict
        List of my plugins and link to the CookieWare fund

        1 Reply Last reply
        Reply Quote 0
        • Q
          qpik
          last edited by

          So far I managed to run the example above. Give me some time πŸ˜„

          1 Reply Last reply
          Reply Quote 0
          • J
            Jim
            last edited by

            I don't really know, but OpenGL must have hooks, or act as a server because of the existence of software such as 3D Printscreenwhich is able to capture the 3d Sketchup model and export it to some 3dxml format.

            So if the OpenGL data can be "hooked" into, then does the possibility exist to use more OpenGL features not native to SU?

            404 Not Found

            favicon

            (forums.sketchucation.com)

            Hi

            1 Reply Last reply
            Reply Quote 0
            • thomthomT
              thomthom
              last edited by

              Isn't that what Adam B does with LightUp? Hook into the SU's OpenGL? All though, from C and not from Ruby.

              Thomas Thomassen β€” SketchUp Monkey & Coding addict
              List of my plugins and link to the CookieWare fund

              1 Reply Last reply
              Reply Quote 0
              • Q
                qpik
                last edited by

                These are the libraries included in Ruby Windows installer:
                http://ruby-opengl.rubyforge.org/.

                1 Reply Last reply
                Reply Quote 0
                • Chris FullmerC
                  Chris Fullmer
                  last edited by

                  But I'd still like to understand if you are getting this to interact with SketchUP somehow? Can you change what and how SU renders with this?

                  Chris

                  Lately you've been tan, suspicious for the winter.
                  All my Plugins I've written

                  1 Reply Last reply
                  Reply Quote 0
                  • thomthomT
                    thomthom
                    last edited by

                    Is this Windows and OSX compatible?

                    Thomas Thomassen β€” SketchUp Monkey & Coding addict
                    List of my plugins and link to the CookieWare fund

                    1 Reply Last reply
                    Reply Quote 0
                    • Q
                      qpik
                      last edited by

                      Yes you can! πŸ˜„
                      I've just found the first thing that changed the view of the model.
                      I typed in the Ruby console glDisable(GL_DEPTH_TEST).
                      To see result try turning the model around.
                      Bear in mind that I'm just starting to learn OpenGL πŸ˜’ .

                      ps. You need to run SU with the files from the zip above in Plugins, except the example.

                      1 Reply Last reply
                      Reply Quote 0
                      • PixeroP
                        Pixero
                        last edited by

                        SU keep asking for glut32.dll. It's not in the zip you provided?

                        1 Reply Last reply
                        Reply Quote 0
                        • Q
                          qpik
                          last edited by

                          @pixero said:

                          SU keep asking for glut32.dll. It's not in the zip you provided?

                          It didn't ask me. Maybe because I have it in my Ruby installation.

                          1 Reply Last reply
                          Reply Quote 0
                          • Q
                            qpik
                            last edited by

                            I suppose so, try it on Mac.

                            Below is not however, only Windows. This seems to freeze SketchUp OpenGL.

                            FindWindow = Win32API.new("user32.dll", "FindWindow", ['P','P'], 'N')
                            GetDC = Win32API.new("user32.dll", "GetDC", ['N'], 'N')
                            GetCurrentContext = Win32API.new("opengl32.dll", "wglGetCurrentContext", ['V'], 'N')
                            CreateContext = Win32API.new("opengl32.dll", "wglCreateContext", ['N'], 'N')
                            MakeCurrent = Win32API.new("opengl32.dll", "wglMakeCurrent", ['N','N'], 'V')
                            DeleteContext = Win32API.new("opengl32.dll", "wglDeleteContext", ['N'], 'V')
                            
                            
                            hwnd = FindWindow.call(0, "Untitled - SketchUp")
                            hdc = GetDC.call(hwnd)
                            hglrc = GetCurrentContext.call()
                            DeleteContext.call(hglrc)
                            

                            I wonder if this is good direction?

                            1 Reply Last reply
                            Reply Quote 0
                            • PixeroP
                              Pixero
                              last edited by

                              So where can I get a Ruby install that has it?

                              1 Reply Last reply
                              Reply Quote 0
                              • Q
                                qpik
                                last edited by

                                One-click windows installer has it. Here: http://rubyinstaller.org/

                                1 Reply Last reply
                                Reply Quote 0
                                • PixeroP
                                  Pixero
                                  last edited by

                                  Anyone getting more than one line to work?

                                  1 Reply Last reply
                                  Reply Quote 0
                                  • Q
                                    qpik
                                    last edited by

                                    I only got to change some OpenGL Server variables like GL_COLOR_MATERIAL or GL_DEPTH_TEST.
                                    I don't know the way to hack into drawing context. I wonder how it is done in LightUp (supposing it is done similar way), maybe a window is layered on top of native SketchUp viewport.

                                    1 Reply Last reply
                                    Reply Quote 0
                                    • Chris FullmerC
                                      Chris Fullmer
                                      last edited by

                                      I don't think Lightup does this. I think it renders materials and bakes them into faces in SU. At least that is my (severely limited and naive) understanding.

                                      Lately you've been tan, suspicious for the winter.
                                      All my Plugins I've written

                                      1 Reply Last reply
                                      Reply Quote 0

                                      Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                                      Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                                      With your input, this post could be even better πŸ’—

                                      Register Login
                                      • 1
                                      • 2
                                      • 2 / 2
                                      • First post
                                        Last post
                                      Buy SketchPlus
                                      Buy SUbD
                                      Buy WrapR
                                      Buy eBook
                                      Buy Modelur
                                      Buy Vertex Tools
                                      Buy SketchCuisine
                                      Buy FormFonts

                                      Advertisement