線上訂房服務-台灣趴趴狗聯合訂房中心
發文 回覆 瀏覽次數:1562
推到 Plurk!
推到 Facebook!

OPENGL的網格

缺席
5515531
一般會員


發表:19
回覆:44
積分:12
註冊:2008-04-16

發送簡訊給我
#1 引用回覆 回覆 發表時間:2008-08-30 23:23:21 IP:220.228.xxx.xxx 訂閱
我是用BCB的OPENGL所寫出來的程式
但是很奇怪~~我跑是可以跑~~但是卻不能變成網格
只能是一個曲面而已
所以想請各位幫我看一下應該怎麼改

void __fastcall TForm1::GLPanel1Setup(TObject *Sender)
{
glShadeModel(GL_SMOOTH);
glClearColor(0.0f, 0.0f, 0.0f, 0.5f);
glClearDepth(1.0f);
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LEQUAL);
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
}
//---------------------------------------------------------------------------
void __fastcall TForm1::GLPanel1Resize(TObject *Sender)
{
int height=GLPanel1->Height, width=GLPanel1->Width;
glViewport(0, 0, width, height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(45.0f,(GLfloat)width/(GLfloat)height,0.1f,500.0f);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::GLPanel1Render(TObject *Sender)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glLoadIdentity();
glTranslatef(0.0f,0.0f,13.0f);
glColor4f(1.0,0.0,0.0,0.5);
glBegin(GL_POLYGON);
glVertex3f(-1.7f,-1.6f,-19.0f);
glVertex3f(-1.9f,-1.2f,-21.0f);
glVertex3f(-3.3f,-1.3f,-35.0f);
glVertex3f(-2.6f,-0.9f,-38.0f);
glVertex3f(-1.2f,-1.1f,-25.0f);
glVertex3f(-0.9f,-1.6f,-19.0f);
glVertex3f(-1.1f,-1.3f,-17.0f);
glEnd();
//=====================
if(ok)
{
switch(draw_mode)
{
case dFill: glPolygonMode(GL_BACK,GL_FILL); glBegin( GL_QUADS ); break;
case dGird: glPolygonMode(GL_BACK,GL_LINE); glBegin( GL_QUADS ); break;
default: glPolygonMode(GL_BACK,GL_FILL); glBegin( GL_QUADS ); break;
}
}
//=====================
GLPanel1->SwapBuffers();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::RadioGroup1Click(TObject *Sender)
{
switch(RadioGroup1->ItemIndex)
{
case 0: draw_mode=dFill; break;
case 1: draw_mode=dGird; break;
default: draw_mode=dFill; break;
}
GLPanel1->Repaint();
}
編輯記錄
taishyang 重新編輯於 2008-09-01 09:55:20, 註解 無‧
taishyang 重新編輯於 2008-09-01 09:55:20, 註解 無‧
5515531 重新編輯於 2008-09-01 14:07:05, 註解 無‧
系統時間:2024-11-22 19:18:47
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!