View Full Version : GL commands using beginnativepating not working
moh.gup@gmail.com
4th August 2011, 18:37
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
Dong Back Kim
5th August 2011, 01:07
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
moh.gup@gmail.com
15th August 2011, 18:53
Hi,
I am trying to paint in item using garphicssitem
void item::paint ( QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget)
{
painter->fillRect(0, 0, 128, 128, Qt::green);
painter->beginNativePainting();
// Set background clearing color to blue
glClearColor(0.0f, 0.0f, 1.0f, 1.0f);
// Clear the window with current clearing color
glClear(GL_COLOR_BUFFER_BIT);
// Set drawing color to red, and draw rectangle at
// current position.
glColor3f(1.0f, 0.0f, 0.0f);
glRectf(128, 128, 200, 200);
//glFlush();
painter->endNativePainting();
}
moh.gup@gmail.com
16th August 2011, 17:54
Can any body have idea abt my problem.Its urgent for me
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.