PDA

View Full Version : About glArrayElement and glDrawElements



zhangjunyue
09-22-2001, 06:52 PM
Hi,

In glDrawElements method, every vertex has a color which defined in glColorArray, but I would like draw each element in single color, what I should do? I must use glArrayElement?

Thanks in advance.

ffish
09-22-2001, 07:17 PM
glColor3f(r, g, b);
glDrawElements(...);

Is that what you mean, that all vertices have the same colour? I hope I understood correctly.

Hope that helps.

zhangjunyue
09-23-2001, 03:19 PM
Sorry for my poor english.

For example, I have two triangles, one is red, another is green, but I don't know how to arrange color index, it seems glColorPointer is just for each vertex, so what can I do?

Thanks in advance.

ffish
09-23-2001, 04:09 PM
Oh, OK. Unfortunately, you will have to duplicate vertices, like you would with vertices with more than 1 texcoord.

Hope that helps.

zhangjunyue
09-27-2001, 10:12 PM
Nice to your reply, Thanks.

Here is another question.

I have a lot of trangles and quads, which is plot by using Gl_Begin and Gl_End, while the number is increasing, the performance is so bad, do you have any ideas to solve problem?

Thanks in advance.




[This message has been edited by zhangjunyue (edited 09-28-2001).]

Korval
09-27-2001, 10:50 PM
Use glDrawElements to render them. It can render an entire list of independent quads or triangles with only one function call.

I'm kinda wondering why you asked, since you started this discussion talking about glDrawElements.