Results 1 to 2 of 2

Thread: WxGLCanvas errors after Update

  1. #1
    Junior Member Newbie
    Join Date
    Sep 2010
    Posts
    3

    WxGLCanvas errors after Update

    Hi Community,
    heres my Problem.

    I'm using a wxGLCanvas Window for OpenGl rendering. Everything worked fine but after updating my Linux Distribution from 10.04 to Ubuntu 10.10 some Problems occured.

    First of all SwapBuffers threw a runtime Error saying something like "Bad Drawable" and xWindow Error.

    I commented SwapBuffers and it worked but the Box I drew had totally wrong walls, which seem to dissappear randomly depending on the viewing edge. If the Viewing-point is inside the Box, everything looks fine.

    Here the most important Source Code.As i dont use Lightning the box is drawn by some modified Code from freeGlut.

    CGL_MAP::render()
    <div class="ubbcode-block"><div class="ubbcode-header">Click to reveal.. <input type="button" class="form-button" value="Show me!" onclick="toggle_spoiler(this, 'Yikes, my eyes!', 'Show me!')" />]<div style="display: none;">


    void CGL_MAP::render()
    {

    SetCurrent();
    wxPaintDC(this);
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    glEnable(GL_DEPTH_TEST); // activate Z-Buffer

    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();

    glPushMatrix(); //Just setting "Cameras Position"
    glRotatef (rotx, 1,0,0);
    glRotatef (roty, 0,1,0);
    glRotatef (rotz, 0,0,1);
    glTranslatef (-mx,-my,-mz);

    glPushMatrix();
    glScalef(lx,ly,lz);
    double size = 1;
    # define V(a,b,c) glVertex3d( a size, b size, c size );
    # define N(a,b,c) glNormal3d( a, b, c );
    glBegin( GL_QUADS );
    N( 1.0, 0.0, 0.0);
    glColor3f(1,0,0);
    V(+,-,+);
    V(+,-,-);
    V(+,+,-);
    V(+,+,+);
    N( 0.0, 1.0, 0.0);
    glColor3f(0,1,0);
    V(+,+,+);
    V(+,+,-);
    V(-,+,-);
    V(-,+,+);
    N( 0.0, 0.0, 1.0);
    glColor3f(0,0,1);
    V(+,+,+);
    V(-,+,+);
    V(-,-,+);
    V(+,-,+);
    N(-1.0, 0.0, 0.0);
    glColor3f(1,0,1);
    V(-,-,+);
    V(-,+,+);
    V(-,+,-);
    V(-,-,-);
    N( 0.0,-1.0, 0.0);
    glColor3f(0,1,1);
    V(-,-,+);
    V(-,-,-);
    V(+,-,-);
    V(+,-,+);
    N( 0.0, 0.0,-1.0);
    glColor3f(1,0,1);
    V(-,-,-);
    V(-,+,-);
    V(+,+,-);
    V(+,-,-);
    glEnd();
    # undef V
    # undef N
    glPopMatrix();


    glPopMatrix();


    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    projection( 25, 1, 5, 30000);

    glViewport(0, 0, (GLint)GetSize().x, (GLint)GetSize().y);

    glFlush();
    //glFinish();
    //SwapBuffers();
    }

    [/QUOTE]</div>




    GL_CAM:rojection
    <div class="ubbcode-block"><div class="ubbcode-header">Click to reveal.. <input type="button" class="form-button" value="Show me!" onclick="toggle_spoiler(this, 'Yikes, my eyes!', 'Show me!')" />]<div style="display: none;">


    void GL_CAM:rojection(double fovy, double aspect, double zNear, double zFar) const
    {
    double xmin,xmax,ymin,ymax;
    ymax = zNear*tan(fovy *PI_D); //PI/360
    ymin = -ymax;
    xmin = ymin*aspect;
    xmax = ymax*aspect;
    glFrustum(xmin,xmax,ymin,ymax,zNear,zFar);
    }

    [/QUOTE]</div>



    Can anyone see any Mistakes? I'm grateful for any advices, concerning code as well as the basic design.

    Maby someone already had similar Troubles.
    Maby there is a better way for Coloring the Sides of the boxes (Does not have to look beautiful, just for orientation)

    Thanks for any help

    Greets Yoda

  2. #2
    Super Moderator OpenGL Lord
    Join Date
    Dec 2003
    Location
    Grenoble - France
    Posts
    5,574

    Re: WxGLCanvas errors after Update

    Do you ask for a double buffered GL window ? You should do that and use swapbuffers.
    Otherwise, check your drivers, because probably when updating your disrib version, you may well have changed from a proprietary to an opensource driver, or vice-versa.

Similar Threads

  1. vbo update
    By ale211734 in forum OpenGL: Advanced Coding
    Replies: 1
    Last Post: 03-03-2015, 09:08 AM
  2. Image Update
    By navand in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 02-21-2008, 06:56 AM
  3. Replies: 0
    Last Post: 11-09-2005, 10:24 PM
  4. Update
    By sofsoldier in forum OpenGL: User Software
    Replies: 0
    Last Post: 07-15-2003, 05:00 PM
  5. Can't update Dx9
    By in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 07-05-2003, 02:01 PM

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