Is it allowed to call glDrawArray inside init method?

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Is it allowed to call glDrawArray inside init method?

HamudHaa
I found a strange phenomenon that sometime display method is called twice . Then I started to consider if it is possible to drawArray inside init method . Because I'm working on a ray tracer but I only need it to be called once . Multiple calls are meaningless and I want to avoid it .  
I have tried to call glDrawArray inside init method , and the result is blackness . However if I move glDrawArray to inside display method then everything is okay .
I think after init method is over and before the beginning of display method , reshape method is called . So I added a line to set glViewport before the calling of glDrawArray , but the result is the same blackness .
So I guess it is probably not permitted to draw primitives inside init method , tho I don't know why .