开放框架:绘制函数被多次调用

Open Frameworks : draw function being recalled multiple times

本文关键字:调用 函数 绘制 框架      更新时间:2023-10-16

我在C++上使用Openframeworks。我试图使用 openweathermap.org 的 api 在图形上绘制一些点。函数plotAxes()和plotGraph()被称为多时间。谁能建议我?

void ofApp::draw()
{
 ofDrawBitmapString("Current Temperature Graph (openweathermap.org)", 600,50);
 ofDrawBitmapString ("X-axis : Temperature in Kelvin-- One division =100K",600,600);
 ofDrawBitmapString ("Y-axis : Cities-- One division =100K",600,650);
 plotAxes();
 plotGraph();
}

在OpenFrameworks draw()方法函数中调用每一帧。如果你想调用函数plotAxes()和plotGraph(),你可以把这些函数放在setup()方法中。例:

void ofApp::setup(){
 plotAxes();
 plotGraph();
}