Results 1 to 2 of 2

Thread: Webgl Custom Inputs

  1. #1
    Junior Member
    Join Date
    Feb 2011

    Webgl Custom Inputs

    This is just something random I was thinking about. What is the best way to do inputs (buttons, sliders, text input, ...) for a WebGL application. Can you just force html inputs to overlay a canvas? Is it better to create custom Javascript objects? I'm thinking it would probably be less work to use html inputs, but as far as speed and the ability to customize the inputs, which is best? Thanks.

  2. #2
    Senior Member
    Join Date
    May 2010

    Re: Webgl Custom Inputs

    I played with both for my Barfight game ( - and eventually decided that HTML controls were the best. I'm not sure that they are necessarily the fastest - but the ability to theme them with CSS3 and have standard fonts and such won me over.

    I ended up with a much higher quality GUI than I'd otherwise have gone for - and it took only a matter of hours to write.

    I would expect you could maybe get better frame rates by rendering them using a texture-mapped font in WebGL...but with hardware HTML rendering & compositing in the latest wave of browsers, I could be wrong about that too.

    You can use the CSS style element to set a "z-index" property (which is really a "layer" number rather than true Z value) - that's how I get my menu to hover over the 3D scene...then I use the DOM to set the "visibility" property to hide or reveal the HTML object as I need it in-game.

    As a technique, it's very compelling. I'm fairly passionate about doing as little as possible in JavaScript (because it's so slow) - so these kinds of feature of the browser are attractive.

    -- Steve

Similar Threads

  1. Replies: 0
    Last Post: 03-22-2011, 08:27 AM
  2. Multiple Image Inputs to OpenCL Kernel
    By toneburst in forum OpenCL
    Replies: 6
    Last Post: 11-18-2009, 09:46 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Proudly hosted by Digital Ocean