Results 1 to 2 of 2

Thread: Wrong geometry positioning with QWidget & OpenGL ES(Vincent's 3D Rendering library)

  1. #1
    Join Date
    Nov 2009
    Posts
    1
    Qt products
    Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Wrong geometry positioning with QWidget & OpenGL ES(Vincent's 3D Rendering library)

    Hi,


    I try to use OpenGL|ES in QWidget.
    All is fine, when i compile and run for Win32 configuration for the PC.
    But when i compile&run the same code for WM5.0 PocketPC, geometry displaying shifted.

    All GLES initialization works. Nothing wrong with projection and modelview matrixes.

    Here the code fragment:

    Initialization GL/GLES:

    CreateContext(); // platform specific initialization
    glMatrixMode ( GL_PROJECTION );
    glLoadIdentity ();
    glOrthof(-100, 100, 100, -100, -1, 1); // glOrtho for Win32
    glMatrixMode ( GL_MODELVIEW );
    glLoadIdentity ();

    Resizing:
    glViewport(0, 0, (GLint)width(), (GLint)height());
    Draw:
    SetCurrentContext(); // platform specific
    glClearColor(0.2f, 0.2f, 0.2f, 1.0f);
    glClear(GL_COLOR_BUFFER_BIT);

    GLfloat vertexes[] = { -100.0f, -100.0f, 0.0f, 100.0f, -100.0f, 0.0f, 100.0f, 100.0f, 0.0f, -100.0f, 100.0f, 0.0f};
    GLushort indexes [] = { 2,1,0,2,0,3};

    glDisable(GL_LIGHTING);
    glDisable(GL_DEPTH_TEST);

    glEnableClientState (GL_VERTEX_ARRAY);
    glDisableClientState(GL_NORMAL_ARRAY);
    glDisableClientState(GL_COLOR_ARRAY);
    glDisableClientState(GL_TEXTURE_COORD_ARRAY);

    glColor4f(0.0f, 0.0f, 1.0f, 1.0f);

    glVertexPointer (3, GL_FLOAT, 0, vertexes);
    glDrawElements (GL_TRIANGLES, 3, GL_UNSIGNED_SHORT, indexes);

    glColor4f(0.0f, 1.0f, 0.0f, 1.0f);
    glDrawElements (GL_TRIANGLES, 3, GL_UNSIGNED_SHORT, indexes+3);

    SwapContextBuffers();


    The QT painting(QPainter) is well at correct place. GLES painting is shifted up on nealer 24 pixels.

    What's wrong?

    Thanks

  2. #2
    Join Date
    Sep 2009
    Posts
    3
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Windows

    Default Re: Wrong geometry positioning with QWidget & OpenGL ES(Vincent's 3D Rendering librar

    Hi,

    Did you managed to solved this problem ? I'm facing the same problem.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.