renderOpenGL() and repaint() function

Is it correct to call the repaint method inside of renderOpenGL()? The data is valid less than half of the time since renderOpenGL() is called more often then my frame rate.  I then use g.drawimage inside of the paint(Graphics) function.  The one issue I can see with this is that there is no guarantee when paint() will be called. 

Pseudo Code snippet:

void VideoWindow::renderOpenGL(){

  bool valid = getNewdata(dat);


       change bitmap data in image




Is there a better way to do this?

It's not ideal to call it in paint().. In practice it'll probably work but I can't guarantee it won't break at some point in the future.


Are you saying that it is not ideal to call g.drawimage inside of the paint() function?  If so, how/where should I render the image?

no.. your question was about calling repaint() in a paint callback, that's what I was talking about.

The issue is that renderOpenGL() is called often (60 times per second), but paint(), except initially, is never called again.  This is why I was forcing the repaint() in renderOpenGL() so that my drawimage( which is in the paint() function) gets called.   I saw in an older thread that you mentioned about getting the next frame of data in the renderOpenGL() function and doing the drawing in paint.  I see no other way to trigger the paint() without calling repaint().  Should I just be drawing the image (a juce image) in the renderOpenGL() using "GL" methods?  

If you need continuous repainting, the best place to call repaint() would be from a timer, not the paint method.