有一些問題與此for循環來繪製同一對象的多個號碼繪製的對象,通過陣列
for (int i = BALL_RED_START; i<BALL_RED_END;i++)
{
glColor3f(1,0,0);
Redball[i].Draw();
}
Redball正在從一個單獨的類叫做,
I get error:2228, left of .Draw must have class/struct/union.
Redball是在Main.cpp的
Ball Redball;
Ball.cpp頂部定義:
include "Ball.h"
include "Vector2f.h"
include "Vector3f.h"
include "Glut/glut.h"
include "GL/gl.h"
include "GL/glu.h"
Ball::Ball(void)
{
Vector3f Temp_position;
position = Temp_position;
Vector3f Temp_velocity;
velocity = Temp_velocity;
}
Ball::~Ball(void)
{
}
void Ball::SetPos(Vector3f New_position)
{
position = New_position;
}
void Ball::Draw()
{
glPushMatrix();
glTranslatef(position.X(), position.Y(), position.Z());
glColor3d(1, 0, 0);
glutSolidSphere(0.3, 50, 50);
glPopMatrix();
}
void Ball::SetVel(Vector3f New_velocity)
{
velocity = New_velocity;
}
Vector3f Ball::GetPos()
{
Vector3f temp;
temp = position;
return temp;
}
只是想畫出這些球8。
你不覺得我們想知道左側的.Draw _is_是什麼嗎?我的朋友是如何宣佈Redball的? – sehe 2011-04-14 17:28:58
我試過了 - >至今沒有運氣! – 2011-04-14 17:52:36
也許當我有更多的信息時,我會對[我的回答]發表評論(http://stackoverflow.com/questions/5667147/drawing-an-object-through-an-array/5667177#5667177)必須經常檢查回來 – sehe 2011-04-14 19:36:06