Results 1 to 4 of 4

Thread: GL commands using beginnativepating not working

  1. #1
    Join Date
    Mar 2010
    Posts
    63
    Thanks
    6
    Qt products
    Qt4 Qt/Embedded Qt Jambi
    Platforms
    MacOS X Unix/X11 Windows Symbian S60

    Default GL commands using beginnativepating not working

    Hi,
    I am try to run GL commands inn QGraphicsitem in paint event using beginnavitepaining.But its not working.
    when I try GLwidet its work which shows gl support in my system.I need to paint in my graphicsitem.

    Please help

  2. #2
    Join Date
    Aug 2011
    Location
    Seoul, Korea
    Posts
    46
    Thanks
    9
    Thanked 5 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: GL commands using beginnativepating not working

    Quote Originally Posted by moh.gup@gmail.com View Post
    Hi,
    I am try to run GL commands inn QGraphicsitem in paint event using beginnavitepaining.But its not working.
    when I try GLwidet its work which shows gl support in my system.I need to paint in my graphicsitem.

    Please help
    Did you create rendering context by your self within the beginNativePainting()? I guess it's not working because QGraphicsItem does not prepare OpenGL rendering context while QGLWidget does for you.

    If you can describe bit more about what is not working (i.e. no refresh) it might be easier to find out the reason.

    Regards,
    Dong Back Kim

  3. The following user says thank you to Dong Back Kim for this useful post:

    moh.gup@gmail.com (15th August 2011)

  4. #3
    Join Date
    Mar 2010
    Posts
    63
    Thanks
    6
    Qt products
    Qt4 Qt/Embedded Qt Jambi
    Platforms
    MacOS X Unix/X11 Windows Symbian S60

    Default Re: GL commands using beginnativepating not working

    Hi,
    I am trying to paint in item using garphicssitem

    Qt Code:
    1. void item::paint ( QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget)
    2. {
    3.  
    4. painter->fillRect(0, 0, 128, 128, Qt::green);
    5. painter->beginNativePainting();
    6.  
    7. // Set background clearing color to blue
    8. glClearColor(0.0f, 0.0f, 1.0f, 1.0f);
    9. // Clear the window with current clearing color
    10. glClear(GL_COLOR_BUFFER_BIT);
    11. // Set drawing color to red, and draw rectangle at
    12. // current position.
    13. glColor3f(1.0f, 0.0f, 0.0f);
    14. glRectf(128, 128, 200, 200);
    15. //glFlush();
    16.  
    17. painter->endNativePainting();
    18.  
    19. }
    To copy to clipboard, switch view to plain text mode 

  5. #4
    Join Date
    Mar 2010
    Posts
    63
    Thanks
    6
    Qt products
    Qt4 Qt/Embedded Qt Jambi
    Platforms
    MacOS X Unix/X11 Windows Symbian S60

    Default Re: GL commands using beginnativepating not working

    Can any body have idea abt my problem.Its urgent for me

Similar Threads

  1. QExtSerialPort with AT commands
    By Althor in forum Qt Programming
    Replies: 2
    Last Post: 6th September 2011, 18:15
  2. Replies: 1
    Last Post: 29th August 2010, 08:13
  3. Executing AT commands
    By jay in forum Qt Programming
    Replies: 4
    Last Post: 8th December 2009, 09:49
  4. Mac Commands
    By shyam prasad in forum Qt Programming
    Replies: 1
    Last Post: 9th January 2007, 15:30
  5. Replies: 2
    Last Post: 31st January 2006, 14:36

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.