Results 1 to 4 of 4

Thread: Blend and lighting problems: the blending function doesn't work after rotation...

  1. #1
    Join Date
    Mar 2013
    Posts
    10
    Qt products
    Qt4
    Platforms
    Windows

    Default Blend and lighting problems: the blending function doesn't work after rotation...

    Hi,

    I am working for a 3D surface rendering of a tube. The rendering function works good when the rotation angle rotX(in x direction) and rotY(in y direction)
    is between -90 to 90 degrees, when they are between 90 to180 degrees, the 3D tube can not be blended...

    blended.jpg <== Blended, when rotX and rotY between -90 to 90 degrees.

    nonblended.jpg <== not blended, when rotX or rotY between 90 - 180 degrees.

    the FOV is set as glOrtho(-128, 127,-128, 127, -50, 49);

    The following is the lighting and blending setting in initializeGL();

    void GL_Widget::initializeGL()
    {

    qglClearColor(Qt::black);
    /* ------ Lights ------ */
    //Light Point Source
    GLfloat light0_position[] = {-128.0f, 0.0f, 0.0f, 1.0};
    GLfloat light0_ambient[] = { 0.8f, 0.28f, 0.28f, 1.0f};
    GLfloat light0_diffuse[] = { 0.20f, 0.20f, 0.20f, 1.0f};
    GLfloat light0_specular[] = { 0.8f, 0.8f, 0.8f, 1.0f};

    glLightfv(GL_LIGHT0, GL_POSITION, light0_position);
    glLightfv(GL_LIGHT0, GL_AMBIENT, light0_ambient);
    glLightfv(GL_LIGHT0, GL_DIFFUSE, light0_diffuse);
    glLightfv(GL_LIGHT0, GL_SPECULAR, light0_specular);


    GLfloat light1_position[] = {127.0f, 0.0f, 0.0f, 1.0};
    GLfloat light1_ambient[] = { 0.8f, 0.28f, 0.28f, 1.0f};
    GLfloat light1_diffuse[] = { 0.20f, 0.20f, 0.20f, 1.0f};
    GLfloat light1_specular[] = { 0.8f, 0.8f, 0.8f, 1.0f};

    glLightfv(GL_LIGHT1, GL_POSITION, light1_position);
    glLightfv(GL_LIGHT1, GL_AMBIENT, light1_ambient);
    glLightfv(GL_LIGHT1, GL_DIFFUSE, light1_diffuse);
    glLightfv(GL_LIGHT1, GL_SPECULAR, light1_specular);

    //Material
    glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, 45.0);
    //Shading
    glShadeModel(GL_SMOOTH);
    glEnable(GL_BLEND);
    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
    glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER,GL_FALSE );
    //Enable Lighting
    glEnable(GL_LIGHTING);
    glEnable(GL_LIGHT0);
    glEnable(GL_LIGHT1);
    glEnable(GL_COLOR_MATERIAL);

    glEnable(GL_NORMALIZE);
    glEnable(GL_DEPTH_TEST);
    }

    Is any ideas or advise about this issue? is it a drawing ordering issue or just depending the lighting and blending function? Thank you in advance!

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Blend and lighting problems: the blending function doesn't work after rotation...

    Why are you asking that question here and not on some OpenGL forum?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Mar 2013
    Posts
    10
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Blend and lighting problems: the blending function doesn't work after rotation...

    thanks! I have asked in OpenGL forum too. but I could not post my code there, I am not sure why...

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Blend and lighting problems: the blending function doesn't work after rotation...

    Maybe the forum software is smart enough to determine your problem is unrelated to Qt
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. autoScale doesn't work
    By Braunstein in forum Qwt
    Replies: 4
    Last Post: 12th November 2010, 18:22
  2. macro and syntax high lighting
    By chaoticbob in forum Qt Tools
    Replies: 1
    Last Post: 30th August 2009, 22:52
  3. Privoxy doesn't work with qt 4.5.1
    By doep in forum Qt Programming
    Replies: 2
    Last Post: 21st June 2009, 10:55
  4. QXmlQuery problems - recipe example doesn't work
    By nhelseth in forum Qt Programming
    Replies: 0
    Last Post: 16th January 2009, 21:45
  5. qSort doesn't work with member function
    By ber_44 in forum Qt Programming
    Replies: 10
    Last Post: 2nd June 2007, 12:00

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.