Movatterモバイル変換


[0]ホーム

URL:


faqs.org

OpenGL Frequently Asked Questions (FAQ) [3/3]

Font:

    Search the FAQ Archives

3 -A -B -C -D -E -F -G -H -I -J -K -L -M
N -O -P -Q -R -S -T -U -V -W -X -Y -Z
faqs.org - Internet FAQ Archives

OpenGL Frequently Asked Questions (FAQ) [3/3]

(Part1 -Part2 - Part3)
[Usenet FAQs |Web FAQs |Documents |RFC Index |Sex offenders ]
faqs.org
Archive-Name: graphics/opengl-faq/part3
Lines: 412
Xref: senator-bedfellow.mit.edu comp.answers:14597 comp.graphics.api.opengl:1184 news.answers:54157

comp.graphics.api.opengl,news.answersPath: senator-bedfellow.mit.edu!bloom-beacon.mit.edu!grapevine.lcs.mit.edu!uhog.mit.edu!news.kei.com!newshost.marcam.com!usc!elroy.jpl.nasa.gov!swrinde!sgigate.sgi.com!fido.asd.sgi.com!sgi!dilow.asd.sgi.com!phoFrom: pho@dilow.asd.sgi.com (Paul Ho)Subject: OpenGL Frequently Asked Questions (FAQ) [3/3]Message-ID: <DFtAp9.Jp5@sgi.sgi.com>Followup-To: posterLast-Modified: 1995 September 8Summary: This contains a list of Frequently Asked Questions about OpenGL (R)Keywords: FAQSender: pho@dilow.asd.sgi.comReply-To:pho@dilow.asd.sgi.comOrganization: Silicon Graphics Inc.Posting-Frequency: twice a monthDate: Mon, 2 Oct 1995 08:10:21 GMTApproved: mailnews@sgi.sgi.comwoo@sgi.com) and Debbie Herrington (debbie@portable.com) >There is a fair amount of work, most of which is in substitutingfor window management or input handling routines, for which the equivalents are not OpenGL, but the local window system, such asthe X Windows System or Windows NT.  To help ease the way, port to "mixed model" right away, mixing theX Window System calls to open and manage windows, cursors, and colormaps and read events of the window system, mouse and keyboard.  You can do that now with IRIS GL, if you are running IRIX 4.0.  In the X Window System, display mode choices (such as single or double buffering, color index or RGBA mode) must be declared before the window is initially opened.  You may also substitute for otherIRIS GL routines, such as using a OSF/Motif menu system, in place ofthe IRIS GL pop-up menus.  You should use glXUseXFont(), whenever you were using the font manager with IRIS GL.OpenGL uses standard, predictable naming conventions, which requiredthat all names have been changed from IRIS GL.  The OpenGLnaming scheme uses unique prefixes, suffixes, and capitalization tohelp prevent potential conflicts among application, system, andlibrary routine names.And all routine names have changed,at least, minimally; for example:  ortho() is now glOrtho(). Tables for states such as lighting or line and polygon stipples will be gone.  Instead of using a def/set or def/bind sequence to load atable, you turn on the state with glEnable() and also declare thecurrent values for that state.Colors are best stored as floating point values, scaled from 0.0 to1.0 (0% to 100%).  Alpha is fully integrated in the RGBA mode andat least source alpha will be available on all OpenGL implementations.OpenGL will not arbitrarily limit the number of bits per color to 8.Clearing the contents of buffers no longer uses the current color, buta special "clearing" color for each buffer (color, depth, stencil, andaccumulation).The transformation matrix has changed.  In OpenGL, there is nosingle matrix mode.  Matrices are now column-major and are post-multiplied,although that does NOT change the calling order of these routines fromIRIS GL to OpenGL.  OpenGL's glRotate*() now allows for a rotationaround an arbitrary axis, not just the x, y, and z axes.  lookat() of IRIS GL is now gluLookAt(), which takes an up vector value, notmerely a twist.  There is no polarview() in OpenGL, but a seriesof glRotate*()s and glTranslate*()s can do the same thing.There are no separate depth cueing routines in OpenGL.  Use linear fog.Feedback and selection (picking) return values, which are differentfrom those found on any IRIS GL implementation.  For selection andpicking, depth values will be returned for each hit.  In OpenGL, feedback and selection will now be standardized on all hardware platforms.------Subject:  Q28:  When using Xlib, how do I create a borderless window?A:  <fromblythe@sgi.com (David Blythe)>Essentially you can create the window with override-redirect (see man xcreatewindow) which is the sledgehammer approach or you can change the _MOTIF_WM_HINTS property to tell the window manager to leave your windows undecorated.<fromalex@eagle.hd.hac.com (Alex Madarasz)>Also of note is that the window manager decorations of any client can beturned off by putting something like the following in the .Xdefaultsfile in your home directory - assuming you aren't overriding them inyour app:4Dwm*ClientAppOrClassName*clientDecoration: none( see the 4Dwm / mwm man pages for a full description of this resource )( you must restart the window manager or logout/login for 4Dwm resourcesto take effect )"none" will remove all of the window manager decorations - border, titlebar etc.------Subject:  Q29:  How do I switch between single buffer and double buffer mode?A:  <frommjk@sgi.com (Mark Kilgard) and blythe@sgi.com (David Blythe)>When using OpenGL with X, switching between a double buffered and single buffered window can be accomplished by creating a "container" X window and creating two subwindows, one with a double buffer visual, the other with a single buffer visual.  Make sure the subwindows are eachthe full size of their parent window.You can then use XRaiseWindow or XLowerWindow to change the stackingorder of the two subwindows to switch between double buffering andsingle buffering.You will need to create a separate context for each of thetwo windows since they have different visual types.  You will needto make the appropriate window/context pair current when you switchmodes.IRIS GL made it easy to switch between double buffering and singlebuffering.  But essentially, IRIS GL implemented the above processinternally.------Subject:  Q30:  On my machine, it appears that glXChooseVisualis only able to match double-buffered visuals.  I want to have morebits of color resolution, so how do I render in single buffer mode?A:  <from mjk@sgi.com (Mark Kilgard)>On mid- to low-end machines with double buffer hardware, you'llprobably find you get twice as much color resolution using a singlebuffer visual.  But if there is no hardware double buffering support,the double buffered and single buffered visuals are generally thesame depth (the back buffer is "carved" out of software).Search again for a double buffered visual.  If you find one,use it instead.  Call glDrawBuffer(GL_FRONT) though to make sureyou are drawing to the front buffer (the default for a doublebuffered visual is to draw into the back buffer).------Subject:  Q31:  I've got a 24-bit machine, but my OpenGL windowsare not using the full color resolution.  What's wrong?  Myprogram looks fine on one machine, but the depth buffer doesn't workon another.  What's wrong?A:  <from mjk@sgi.com (Mark Kilgard) andwoo@sgi.com (Mason Woo)> An unfortunate (but documented) semantic of glXChooseVisual isthat if you don't request GLX_RED_SIZE, GLX_GREEN_SIZE, orGLX_BLUE_SIZE, glXChooseVisual assumes zero for these parameterswhich means pick the visual with the _smallest_ amount of red,green, and blue that matches the other visual attributes.  Makesure you ask for at least 1 bit of GLX_RED_SIZE, GLX_GREEN_SIZE,and GLX_BLUE_SIZE.  If these configuration parameters arenon-zero, it matches the visual with the _largest_ amount of red,green, and blue with at least 1 bit of each (probably what youwant).Similarly, if you don't request GLX_DEPTH_SIZE, you may get avisual with zero bits of depth buffer.  Some systems may have fewvisuals available, and those visuals all have at least 1 bit ofdepth buffer.  On other systems, there may be dozens of visualsavailable, some with zero bits for the depth buffer.  In short,if hidden surface removal appears to fail, check to see if youhave explicitly specified any bits of depth buffer you have requested.Also check to see what visual you have received.------Subject:  Q32:  What information is available about OpenGL extensions?A:  Examples of extensions include vertex arrays (calling several vertexesor related data, such as normals or colors, with a single function call),blending of constant colors, polygon offset (multiple coplanar polygons can be rendered without interaction), Procedure names and tokens for OpenGL extensions are either suffixedwith EXT or a vendor-specific acronym:  such as SGI for Silicon Graphicsmachines, or INGR for Intergraph.  Also note that Silicon Graphics extensions to OpenGL are suffixed to indicate whether they will be available on all machines (SGI), on just a subset of machines (SGIS), or are very experimental and may become unavailable or completelychanged (SGIX).  Vendors are encouraged to add extension information to their documentation.  For Silicon Graphics, extension information is summarized on the glIntro man page.  ------Subject:  Q33:  How do I make shadows in OpenGL?A:  There are no individual routines to control shadows noran OpenGL state for shadows.  However, code can be writtento render shadows.<from woo@sgi.com (Mason Woo)> To project a shadow onto a flat plane (such as in the insectdemo), draw the stippled object, flattened using matrix transformations.The easiest way to flatten an object is to use the scale function.For example, use glScalef(1., 0., 1.) to create from an infinite lightshining straight down the y axis.  A transformation matrix can be used to cast a shadow from an infinite or local light sourcein an arbitrary direction.  See the article:Thant Tessman, "Casting Shadows on Flat Surfaces,"IRIS Universe, Winter, 1989.<fromshreiner@sgi.com (Dave Shreiner)>Check out the fast shadow and projective texture multi-passalgorithms for producing realistic shadows using texture mapping.See the SIGGRAPH paper:Mark Segal, Carl Korobkin, et al."Fast Shadows and Lighting Effects using Texture Mapping"1992 SIGGRAPH Proceedings------Subject:  Q34:  How can I use 16 bit X fonts?A:  <from James A. ("Jim") Miller>Here is some code that will load any font into the server and use glXUseXFontto build the display lists for you (this does work with 16 bit fonts, it hasbeen tested on IBM, DEC and SGI machines at an OpenGL interop testing).Once your display lists are created for each character, you can use the samebasic logic to figure out which characters are valid (using first, last,firstrow and lastrow in the sample code to get :firstchar = 256 * firstrow + firstlastchar = 256 * lastrow + last ) and use glCallList with those characters to print them out.static int LoadFont(char *fontName){    Font id;    int first, last, firstbitmap, i;    GLuint base;    Display *display=0;    int firstrow, lastrow;    int maxchars;    tkGetSystem(TK_X_DISPLAY, &display);    fontInfo = XLoadQueryFont(display, fontName);    if (fontInfo == NULL) {        return 0;    }    id = fontInfo->fid;    /*     * First and Last char in a row of chars     */    first = (int)fontInfo->min_char_or_byte2;    last = (int)fontInfo->max_char_or_byte2;    /*     * First and Last row of chars, important for multibyte charset's     */    firstrow = (int)fontInfo->min_byte1;    lastrow = (int)fontInfo->max_byte1;    /*     * How many chars in the charset     */    maxchars = 256 * lastrow + last;    base = glGenLists(maxchars+1);    if (base == 0) {        return 0;    }    /*     * Get offset to first char in the charset     */    firstbitmap = 256 * firstrow + first;    /*     * for each row of chars, call glXUseXFont to build the bitmaps.     */    for(i=firstrow; i<=lastrow; i++)    {        glXUseXFont(id, firstbitmap, last-first+1, base+firstbitmap);        firstbitmap += 256;    }    return base;}------Subject:  Q35:  What's in the new GLU 1.2 tesselator?A:  <from Mark Kilgard>Our friends at Digital have the answers:http://www.digital.com:80/pub/doc/opengl/opengl_new_glu.html

User Contributions:

Comment about this article, ask questions, or add new information about this topic:


Some parts © 2025 Advameg, Inc.  |  

[8]ページ先頭

©2009-2025 Movatter.jp