2007/11/12, Jeremy L. Moles <[EMAIL PROTECTED]>: > Some of you may remember a few months back I started working on a > project I'm calling "osgHUD" which aims to solve the issue of doing > simple-to-moderately-complex 2D UI's in OSG without subbing work out to > external libraries. I haven't had much opportunity to work on this > lately, but I'm back at it now and have come across another thing I'd > like an opinion from the target audience of the software. :) > > As you know, GUI's require having some notion of a "scrollable" > region--that is, being able to display only a subset of the window or > rectangular region in question. I've been thinking about this all > weekend and the only things I can come up with to achieve the effect > are: > > 1. Render the "scrolled window" into an off-screen texture and use > only > the portion I need. However, this approach would almost certainly > require a re-working of the rest of the architecture, but I'm willing to > do it if necessary.
Camera might be the most right thing, but it introduce texture related artifacts such as aliasing. If your GUI is only 2D and texture is one-to-one size it might be non problem. But there is also performance questions, e.g. when you need to resize your scrolling window you need also resize texture; you always need two passes to render scrolling window. > 2. Use a shader to define an "active region" of each window; if the > pixel in question falls within this arbitrarily defined region, render > it--otherwise skip. I'd hate to impose a GLSL restriction without a > fallback, but maybe it's the best way. With GLSL you need to emulate all the fixed function pipe-line. For simple GUIs it might be non hard, but if you want to experiment with lights, textures etc. you need hard-code them into shader. Also you need to add 4 conditions into fragment shader and some old cards are slow at conditions. > 3. Somehow introduce the use of GL_SCISSOR into my NodeKit, though I'm > not entirely sure what it is or what it does. Cursory research tends to > indicate it would allow me to render only a portion of a 2D quad, but > also alludes to performance issues and flickering. AFAIK with scissor you need to fill separate scissor buffer (fill rate problem). Also you loose OSG culling with pixel level approaches (scissor or GLSL) As four method (I didn't tried it) you can create simple framebuffer camera (non RTT) for your scrolled window and specify its viewport to your scrolled window. Not sure that glViewport clips pixels so you may also need to use osg::ClipNode with four clip planes to make hardware clip pixels for you. With this approach you don't loose OSG culling for invisible elements and don't need any additional texture. _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

