できました。
内容自体はh2so5さんがおっしゃってた通りです。
テクスチャの頂点行列を4つで描画していたので
変な表示になっていました。
あとglDrawArraysの第一引数は
GL_TRIANGLES
ですね。
一応コードをのせておきます。
コード:
// 環境によってはstatic_castについて警告されない場合もあります。
#define COUNT 3// 3つ同じ画像を表示
int vertexcount=6;// 頂点行列は4ではなく3*2の6だった
GLfloat *squareVertices=new GLfloat[vertexcount*2*COUNT];// 頂点6*座標がxyで2*COUNT個の画像を表示
GLubyte *squareColors=new GLubyte[vertexcount*4*COUNT];// 頂点6*rgbaで4*COUNT個の画像を表示
GLfloat *texCoords=new GLfloat[vertexcount*2*COUNT];// 頂点6*表示範囲の座標がxyで2*COUNT個の画像を表示
for (int pari=0; pari<COUNT; pari++) {
// 位置を設定
float place_left=pari*50;
float place_right=place_left+static_cast<GLfloat>(16);// ここの16は画像の幅であるから、適宜変える
float place_top=0;
float place_bottom=place_top+static_cast<GLfloat>(16);// ここの16は画像の幅であるから、適宜変える
//頂点行列に代入していく
squareVertices[vertexcount*2*pari+0]=place_left; squareVertices[vertexcount*2*pari+1]=place_top;
squareVertices[vertexcount*2*pari+2]=place_right; squareVertices[vertexcount*2*pari+3]=place_top;
squareVertices[vertexcount*2*pari+4]=place_left; squareVertices[vertexcount*2*pari+5]=place_bottom;
squareVertices[vertexcount*2*pari+6]=place_right; squareVertices[vertexcount*2*pari+7]=place_top;
squareVertices[vertexcount*2*pari+8]=place_left; squareVertices[vertexcount*2*pari+9]=place_bottom;
squareVertices[vertexcount*2*pari+10]=place_right; squareVertices[vertexcount*2*pari+11]=place_bottom;
//色を設定するが、簡単のためここでは全ての頂点を255に設定している
for (int coli=0; coli<vertexcount*4; coli++) {
squareColors[coli+vertexcount*4*pari]=static_cast<GLubyte>(255);
}
//left=0.0f,right=1.0f,top=0.0f,bottom=1.0fに設定している
texCoords[vertexcount*2*pari+0]=static_cast<GLfloat>(left);texCoords[vertexcount*2*pari+1]=static_cast<GLfloat>(top);
texCoords[vertexcount*2*pari+2]=static_cast<GLfloat>(right);texCoords[vertexcount*2*pari+3]=static_cast<GLfloat>(top);
texCoords[vertexcount*2*pari+4]=static_cast<GLfloat>(left);texCoords[vertexcount*2*pari+5]=static_cast<GLfloat>(bottom);
texCoords[vertexcount*2*pari+6]=static_cast<GLfloat>(right);texCoords[vertexcount*2*pari+7]=static_cast<GLfloat>(top);
texCoords[vertexcount*2*pari+8]=static_cast<GLfloat>(left);texCoords[vertexcount*2*pari+9]=static_cast<GLfloat>(bottom);
texCoords[vertexcount*2*pari+10]=static_cast<GLfloat>(right);texCoords[vertexcount*2*pari+11]=static_cast<GLfloat>(bottom);
}
// パラメータをいれ、描画を開始します。
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, (GLuint型の画像データ));
glVertexPointer(2, GL_FLOAT, 0, squareVertices);
glEnableClientState(GL_VERTEX_ARRAY);
glColorPointer(4, GL_UNSIGNED_BYTE, 0, squareColors);
glEnableClientState(GL_COLOR_ARRAY);
glTexCoordPointer(2, GL_FLOAT, 0, texCoords);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glDrawArrays(GL_TRIANGLES, 0, vertexcount*COUNT);// 第一引数はGL_TRIANGLESであることに注意
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
glDisable(GL_TEXTURE_2D);
まとめると、
同時に描画可能なのは
ポリゴン(色や形は)と
同じ画像(移す範囲はかえられるので、画像自体を一枚にまとめてしまえば別の映像をうつすこともできる)
だということが分かりました。
今気づいたのですが、たぶん上記二つも同時に描画が可能ですね。
別々の画像の描画を1回にまとめるのはできないようです。
directXなんかだと重たい描画処理自体は一度に全部できたような気がしますが(ありましたよね?裏画面に描画・・・みたいなやつ、以前dxlibraryを使っていたときに見た気がします)、
こちらも似たような処理があるのかもしれません。
つたない説明で分かりにくい点や間違った点もあると思いますが、
あとで見る人の参考になればうれしいです。
h2so5さん、soft屋さん
何度もありがとうございました。