<div>I apologize for not waiting for a response, but I thought you wizards might be able to help me easier with a peek at the code.  I saw a lenghthy code posting on here yesterday so I'm posting the openglgraphics code for the gui below.  Can anyone tell me how to get it working inconjunction with osgViewer?</div>  <div> </div>  <div>About the only thing I see to improve this code is to push and set the viewport in _beginDraw(), then pop it in _endDraw(), but this is irrevelant in my test code since the OsgViewer's viewport (setUpViewerAsEmbeddedInWindow<FONT color=#c0c0c0 size=1></FONT>) and the gui's viewport are both set to the entire screen.</div>  <div>-----------------------------</div>  <div>openglgraphics.cpp:</div>  <div> </div>  <div>#include "guichan/opengl/openglgraphics.hpp"</div>  <div> </div>  <div>#if defined (_WIN32)<BR>#define WIN32_LEAN_AND_MEAN<BR>#include <windows.h><BR>#endif</div> 
 <div> </div>  <div>#if defined (__amigaos4__)<BR>#include <mgl/gl.h><BR>#define glVertex3i glVertex3f<BR>#elif defined(__APPLE__)<BR>#include <OpenGL/gl.h><BR>#else<BR>#include <GL/gl.h><BR>#endif</div>  <div> </div>  <div>#include "guichan/exception.hpp"<BR>#include "guichan/image.hpp"<BR>#include "guichan/opengl/openglimage.hpp"</div>  <div> </div>  <div>namespace gcn<BR>{<BR>    OpenGLGraphics::OpenGLGraphics()<BR>    {<BR>        setTargetPlane(640, 480);<BR>        mAlpha = false;<BR>    }</div>  <div>    OpenGLGraphics::OpenGLGraphics(int width, int height)<BR>    {<BR>        setTargetPlane(width, height);<BR>    }</div>  <div>    OpenGLGraphics::~OpenGLGraphics()<BR>    {</div>  <div>    }</div> 
 <div>    void OpenGLGraphics::_beginDraw()<BR>    {<BR>        glPushAttrib(<BR>            GL_COLOR_BUFFER_BIT |<BR>            GL_CURRENT_BIT |<BR>            GL_DEPTH_BUFFER_BIT |<BR>            GL_ENABLE_BIT |<BR>            GL_FOG_BIT |<BR>            GL_LIGHTING_BIT |<BR>            GL_LINE_BIT |<BR>            GL_POINT_BIT |<BR>            GL_POLYGON_BIT
 |<BR>            GL_SCISSOR_BIT |<BR>            GL_STENCIL_BUFFER_BIT |<BR>            GL_TEXTURE_BIT |<BR>            GL_TRANSFORM_BIT |<BR>            GL_POINT_BIT |<BR>            GL_LINE_BIT<BR>            );</div>  <div>        glMatrixMode(GL_MODELVIEW);<BR>        glPushMatrix();<BR>        glLoadIdentity();</div>  <div>        glMatrixMode(GL_TEXTURE);<BR>       
 glPushMatrix();<BR>        glLoadIdentity();</div>  <div>        glMatrixMode(GL_PROJECTION);<BR>        glPushMatrix();<BR>        glLoadIdentity();<BR>        <BR>        glOrtho(0.0,<BR>                (double)mWidth,<BR>                (double)mHeight,<BR>                0.0,<BR>                -1.0,<BR>                1.0);</div>  <div>       
 glDisable(GL_LIGHTING);<BR>        glDisable(GL_CULL_FACE);<BR>        glDisable(GL_DEPTH_TEST);<BR>        glDisable(GL_TEXTURE_2D);</div>  <div>        glEnable(GL_SCISSOR_TEST);<BR>        glPointSize(1.0);<BR>        glLineWidth(1.0);</div>  <div>        glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);</div>  <div>        glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);</div>  <div>        pushClipArea(Rectangle(0, 0, mWidth, mHeight));<BR>    }</div>  <div>    void OpenGLGraphics::_endDraw()<BR>    {<BR>       
 glMatrixMode(GL_MODELVIEW);<BR>        glPopMatrix();</div>  <div>        glMatrixMode(GL_TEXTURE);<BR>        glPopMatrix();</div>  <div>        glMatrixMode(GL_PROJECTION);<BR>        glPopMatrix();</div>  <div>        glPopAttrib();</div>  <div>        popClipArea();<BR>    }</div>  <div>    bool OpenGLGraphics::pushClipArea(Rectangle area)<BR>    {<BR>        bool result = Graphics::pushClipArea(area);</div>  <div>        glScissor(mClipStack.top().x,<BR>                  mHeight - mClipStack.top().y -
 mClipStack.top().height,<BR>                  mClipStack.top().width,<BR>                  mClipStack.top().height);</div>  <div>        return result;<BR>    }</div>  <div>    void OpenGLGraphics::popClipArea()<BR>    {<BR>        Graphics::popClipArea();</div>  <div>        if (mClipStack.empty())<BR>        {<BR>            return;<BR>        }</div>  <div>        glScissor(mClipStack.top().x,<BR>                 
 mHeight - mClipStack.top().y - mClipStack.top().height,<BR>                  mClipStack.top().width,<BR>                  mClipStack.top().height);<BR>    }</div>  <div>    void OpenGLGraphics::setTargetPlane(int width, int height)<BR>    {<BR>        mWidth = width;<BR>        mHeight = height;<BR>    }</div>  <div>    void OpenGLGraphics::drawImage(const Image* image,<BR>                                   int
 srcX,<BR>                                   int srcY,<BR>                                   int dstX,<BR>                                   int dstY,<BR>                                   int
 width,<BR>                                   int height)<BR>    {<BR>  const OpenGLImage* srcImage = dynamic_cast<const OpenGLImage*>(image);</div>  <div>        if (srcImage == NULL)<BR>        {<BR>            throw GCN_EXCEPTION("Trying to draw an image of unknown format, must be an OpenGLImage.");<BR>        }</div>  <div>        if (mClipStack.empty())<BR>        {<BR>            throw GCN_EXCEPTION("Clip stack is empty, perhaps you called a draw funtion outside of _beginDraw() and
 _endDraw()?");<BR>        }</div>  <div>        const ClipRectangle& top = mClipStack.top();</div>  <div>        dstX += top.xOffset;<BR>        dstY += top.yOffset;</div>  <div>        // Find OpenGL texture coordinates<BR>        float texX1 = srcX / (float)srcImage->getTextureWidth();<BR>        float texY1 = srcY / (float)srcImage->getTextureHeight();<BR>        float texX2 = (srcX+width) / (float)srcImage->getTextureWidth();<BR>        float texY2 = (srcY+height) / (float)srcImage->getTextureHeight();</div>  <div>        glBindTexture(GL_TEXTURE_2D, srcImage->getTextureHandle());</div> 
 <div>        glEnable(GL_TEXTURE_2D);</div>  <div>        // Check if blending already is enabled<BR>        if (!mAlpha)<BR>        {<BR>            glEnable(GL_BLEND);<BR>        }</div>  <div>        // Draw a textured quad -- the image<BR>        glBegin(GL_QUADS);<BR>        glTexCoord2f(texX1, texY1);<BR>        glVertex3i(dstX, dstY, 0);</div>  <div>        glTexCoord2f(texX1, texY2);<BR>        glVertex3i(dstX, dstY + height, 0);</div>  <div>        glTexCoord2f(texX2,
 texY2);<BR>        glVertex3i(dstX + width, dstY + height, 0);</div>  <div>        glTexCoord2f(texX2, texY1);<BR>        glVertex3i(dstX + width, dstY, 0);<BR>        glEnd();<BR>        glDisable(GL_TEXTURE_2D);</div>  <div>        // Don't disable blending if the color has alpha<BR>        if (!mAlpha)<BR>        {<BR>            glDisable(GL_BLEND);<BR>        }<BR>    }</div>  <div>    void OpenGLGraphics::drawPoint(int x, int y)<BR>    {<BR>        if (mClipStack.empty())<BR>       
 {<BR>            throw GCN_EXCEPTION("Clip stack is empty, perhaps you called a draw funtion outside of _beginDraw() and _endDraw()?");<BR>        }</div>  <div>        const ClipRectangle& top = mClipStack.top();</div>  <div>        x += top.xOffset;<BR>        y += top.yOffset;</div>  <div>        glBegin(GL_POINTS);<BR>        glVertex2i(x, y);<BR>        glEnd();<BR>    }</div>  <div>    void OpenGLGraphics::drawLine(int x1, int y1, int x2, int y2)<BR>    {<BR>        if (mClipStack.empty())<BR>       
 {<BR>            throw GCN_EXCEPTION("Clip stack is empty, perhaps you called a draw funtion outside of _beginDraw() and _endDraw()?");<BR>        }</div>  <div>        const ClipRectangle& top = mClipStack.top();</div>  <div>        x1 += top.xOffset;<BR>        y1 += top.yOffset;<BR>        x2 += top.xOffset;<BR>        y2 += top.yOffset;</div>  <div>        glBegin(GL_LINES);<BR>        glVertex2f(x1 + 0.375f,<BR>                   y1 + 0.375f);<BR>        glVertex2f(x2 + 1.0f -
 0.375f,<BR>                   y2 + 1.0f - 0.375f);<BR>        glEnd();</div>  <div>        glBegin(GL_POINTS);<BR>        glVertex2f(x2 + 1.0f - 0.375f,<BR>                   y2 + 1.0f - 0.375f);<BR>        glEnd();</div>  <div>        glBegin(GL_POINTS);<BR>        glVertex2f(x1 + 0.375f,<BR>                   y1 + 0.375f);<BR>        glEnd();</div>  <div>        <BR>    }</div>  <div>    void
 OpenGLGraphics::drawRectangle(const Rectangle& rectangle)<BR>    {<BR>        if (mClipStack.empty())<BR>        {<BR>            throw GCN_EXCEPTION("Clip stack is empty, perhaps you called a draw funtion outside of _beginDraw() and _endDraw()?");<BR>        }</div>  <div>        const ClipRectangle& top = mClipStack.top();<BR>        <BR>        glBegin(GL_LINE_LOOP);<BR>        glVertex2f(rectangle.x + top.xOffset,<BR>                   rectangle.y + top.yOffset);<BR>        glVertex2f(rectangle.x + rectangle.width + top.xOffset -
 1.0f,<BR>                   rectangle.y + top.yOffset + 0.375f);<BR>        glVertex2f(rectangle.x + rectangle.width + top.xOffset - 1.0f,<BR>                   rectangle.y + rectangle.height + top.yOffset);<BR>        glVertex2f(rectangle.x + top.xOffset,<BR>                   rectangle.y + rectangle.height + top.yOffset);<BR>        glEnd();<BR>    }</div>  <div>    void OpenGLGraphics::fillRectangle(const Rectangle& rectangle)<BR>    {<BR>        if (mClipStack.empty())<BR>       
 {<BR>            throw GCN_EXCEPTION("Clip stack is empty, perhaps you called a draw funtion outside of _beginDraw() and _endDraw()?");<BR>        }</div>  <div>        const ClipRectangle& top = mClipStack.top();</div>  <div>        glBegin(GL_QUADS);<BR>        glVertex2i(rectangle.x + top.xOffset,<BR>                   rectangle.y + top.yOffset);<BR>        glVertex2i(rectangle.x + rectangle.width + top.xOffset,<BR>                   rectangle.y + top.yOffset);<BR>        glVertex2i(rectangle.x + rectangle.width +
 top.xOffset,<BR>                   rectangle.y + rectangle.height + top.yOffset);<BR>        glVertex2i(rectangle.x + top.xOffset,<BR>                   rectangle.y + rectangle.height + top.yOffset);<BR>        glEnd();<BR>    }</div>  <div>    void OpenGLGraphics::setColor(const Color& color)<BR>    {<BR>        mColor = color;<BR>        glColor4ub(color.r, color.g, color.b, color.a);</div>  <div>        mAlpha = color.a != 255;</div>  <div>        if (mAlpha)<BR>       
 {<BR>            glEnable(GL_BLEND);<BR>        }<BR>    }</div>  <div>    const Color& OpenGLGraphics::getColor() const<BR>    {<BR>        return mColor;<BR>    }<BR>}<BR></div>  <div> </div>  <div>I'd really appreciate some help with this...</div>  <div>Thank you,</div>  <div>Gerald (<A href="mailto:geraldlindsly@yahoo.com">geraldlindsly@yahoo.com</A>)</div>  <div> </div><p>
      <hr size=1> <a href="http://us.rd.yahoo.com/evt=51201/*http://autos.yahoo.com/new_cars.html;_ylc=X3oDMTE5NWVzZGVyBF9TAzk3MTA3MDc2BHNlYwNtYWlsdGFncwRzbGsDYXV0b3MtbmV3Y2Fy
">Check out </a> the hottest 2008 models today at Yahoo! Autos.