資源簡介
OpenGL填充等值線(MFC)源代碼
由于邊界要求是矩形,對不規(guī)則邊界還需進一步完善
代碼片段和文件信息
void?CzwIsolineBuild::FillAreaWithOpenGL(CDC?*pDCHGLRC?m_hGLRC)
{////等值線填充(按OpenGL方式)
?////
wglMakeCurrent(pDC->m_hDCm_hGLRC);//將繪圖上下文(RC)綁定到設備上下文(DC)上,一個線程只能使用一個當前的RC,一個RC在同一時刻只能被綁定到一個DC上
displayOpenGL();
wglMakeCurrent(pDC->m_hDCNULL);//釋放繪圖描述表
SwapBuffers(pDC->m_hDC); //交換緩沖區(qū)
//DrawIsoline(pDC);
DrawLegend(pDC);
}
void?CzwIsolineBuild::displayOpenGL()
{
initOpenGL();
//glColor3f(0.0f0.0f1.0f); //設置繪圖顏色
float?colorScal[4];
float?colorR[4]colorG[4]colorB[4];
float?maxMinInterval;
float?scalXscalY;
double?x1dy1dx2dy2d;
float?x1fy1fx2fy2f;
int?x1iy1ix2iy2i;
maxMinInterval=m_maxz-m_minz;
scalX=(m_sr-m_sl+10)/2.0;
scalY=(m_sb-m_st+90)/2.0;
FILE?*fp;
//fp=fopen(“openGLGrid.txt““w“);
glClear(GL_COLOR_BUFFER_BIT);
for(in
評論
共有 條評論