Home Forums Official Announcements Verge3D 2.12 pre2 available!

This topic contains 53 replies, has 13 voices, and was last updated by Avatar jem 1 week, 1 day ago.

Viewing 9 posts - 46 through 54 (of 54 total)
  • Author
    Posts
  • #14236
    Avatar
    scalare
    Newbie

    I think I was doing this wrong, by assuming that I would be able to get the window width, when in fact, the get_attr puzzle is expecting an element ID, and I don’t have an ID for the window. So I changed the approach and used an element that does have an ID, and its width changes along with the browser window, but even so, I get an undefined value in the console. Does the “width” property have to be specified in the HTML markup for it to return a value? And would this work with a div or just specific HTML elements, like canvas, inputs, etc?

    Thank you again!

    #14244
    Yuri Kovelenov
    Yuri Kovelenov
    Developer

    try this one: offsetWidth

    Founder & CEO at Soft8Soft
    LinkedIn | FB | Twitter | VK | 新浪微博

    #14290
    Avatar
    scalare
    Newbie

    Thanks, Yuri. offsetWidth worked perfectly!

    #14425
    elk
    elk
    Licensee

    “render next frame” puzzle

    Great idea! We were thinking about this too. :good:

    I am trying to build this functionality in puzzles myself for now, and I noticed a thing that would help is if there was a “Is Renderer Enabled” kind of puzzle. I am now setting variables to keep a record of when i set and disabled the renderer, and this is pron to errors. Haven’t checked if this is possible in code yet, but having it in puzzles would be a great edition for testing the rendering logic, so I thought i would suggest it anyway.

    #14445
    Yuri Kovelenov
    Yuri Kovelenov
    Developer

    thanks for suggestion! we’ll think about it

    Founder & CEO at Soft8Soft
    LinkedIn | FB | Twitter | VK | 新浪微博

    #14763
    Avatar
    jem
    Licensee

    Hey Elk,
    Were you able to implement your re-render upon going full screen function? I am experiencing the same behavior. If you have solution, would you mind sharing? Many thanks, Jem.

    #14785
    Yuri Kovelenov
    Yuri Kovelenov
    Developer

    Hi Jem,

    you can use the resize event listener to handle entering the full screen mode:

    disable rendering window resize

    Attachments:
    You must be logged in to view attached files.

    Founder & CEO at Soft8Soft
    LinkedIn | FB | Twitter | VK | 新浪微博

    #14791
    elk
    elk
    Licensee

    Hi jem

    I did not test this on the fullscreen, but i have this setup witch should be usable for more things, right now i only use it for enabeling and disabeling the render when i hover over and out on an object, so I can enable and disable highlights on the object while in “diabled renderer mode”.

    Not the prettiest of puzzles code, but here is the basic logic;

    When I hover an object i enable the outline(where you might put fullscreen when clicked insted) and then i run a procedure to check if the renderer is currently enabled, if it is we do nothing(bacause the renderer is already runing so we want no change). If it is not enabled we set a variable (renderNext) to indicate we want to render just one frame, and then we set a variable to keep track of the renderers state (renderingEnabled) to true and then actualy enable the renderer.

    Then in an “every frame” puzzle we run the other procedure to check if we should render the next frame than disable again. So we check if renderNext is true and then set it to false, and our renderEnabled variable to false, and disable the rendering.

    This way the one frame rendering should only be triggered when the renderer is disabled, so we don’t incedentaly also disable it when we just trigger the “when hover” event, or click event in your case.

    This is working quite well for me, but it is not very elegant, and I have only tested this in one project so test it if you like at your own perril :)

    Hope this is sort of what you were looking for.

    Attachments:
    You must be logged in to view attached files.
    #14821
    Avatar
    jem
    Licensee

    Elk and Yuri,
    Those are great explanations. Those techniques fixed my issue. Although my ultimate solution was closer to Yuri’s suggestion, Elk’s “every frame” loop solution has me thinking about other possibilities… Thank you both for sharing!

Viewing 9 posts - 46 through 54 (of 54 total)

You must be logged in to reply to this topic.