View Full Version : problems with a custom function
10-06-2008, 02:39 PM
I want to draw a sphere using a custom sphere() fn.When Im using the function in display() function.Its working.When i use it in the main() its not working??Please some one help me.Even though when im using glutPostRedisplay().The function sphere() is not working when written in main().
10-06-2008, 04:47 PM
When you call the sphere function, you must have a valid GL context otherwise drawing call have no effect. Your problem remind me that I had experienced the same kind of trouble. I was using Qt for a project and drawing call was only effective inside the paintGL function. So drawing call made inside mouse and keyboard function had no effect at all even if I called updateGL. So I used a singleton class that permit me to add new drawing object (singleton->addPrimitive(...)) in user input function. Inside my paintGL function I simply call singleton->draw().
So my advice here is to make only OpenGL drawing call inside the function defined by glutDisplayFunc(). I don't know if glut documentation forbid explicitly drawing call outside the function defined by glutDisplayFunc() but it seem wise to do so.
10-06-2008, 04:55 PM
Thank you Now its working.
Powered by vBulletin® Version 4.2.3 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.