This is my code:
block_VAO=0
draw=False
block_EBO_buffer_len=0
def print_blocks(x:int,y:int,z:int):
global draw,block_VAO,block_EBO_buffer_len
if not draw:
block_point_buffer=[]
block_color_buffer=[]
block_EBO_buffer=[]
block_point_buffer+=[x-0.5,y+0.5,z-0.5,#V0
x+0.5,y+0.5,z-0.5,#V1
x+0.5,y-0.5,z-0.5,#V2
x-0.5,y-0.5,z-0.5,#V3
x-0.5,y+0.5,z+0.5,#V4
x+0.5,y+0.5,z+0.5,#V5
x+0.5,y-0.5,z+0.5,#V6
x-0.5,y-0.5,z+0.5]#V7
block_EBO_buffer+=[0,1,5,4,
3,2,6,7,
0,3,7,4,
1,2,6,5,
0,1,2,3,
4,5,6,7]
#ADD
block_color_buffer+=[1.0,0.0,1.0,1.0]*24
color_EBO_buffer+=[0]*24
#ADD END
block_VBO=glGenBuffers(1)
glBindBuffer(GL_ARRAY_BUFFER,block_VBO)
a=numpy.array(block_point_buffer,dtype='float32')
glBufferData(GL_ARRAY_BUFFER,sys.getsizeof(a),a,GL_STATIC_DRAW)
block_EBO=glGenBuffers(1)
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER,block_EBO)
a=numpy.array(block_EBO_buffer,dtype='uint32')
glBufferData(GL_ELEMENT_ARRAY_BUFFER,sys.getsizeof(a),a,GL_STATIC_DRAW)
block_EBO_buffer_len=len(a)
#ADD
color_VBO=glGenBuffers(1)
glBindBuffer(GL_ARRAY_BUFFER,color_VBO)
a=numpy.array(block_color_buffer,dtype='uint32')
glBufferData(GL_ARRAY_BUFFER,sys.getsizeof(a),a,GL_STATIC_DRAW)
color_EBO=glGenBuffers(1)
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER,color_EBO)
a=numpy.array(color_EBO_buffer,dtype='uint32')
glBufferData(GL_ELEMENT_ARRAY_BUFFER,sys.getsizeof(a),a,GL_STATIC_DRAW)
#ADD END
block_VAO=glGenVertexArrays(1)
glBindVertexArray(block_VAO)
glBindBuffer(GL_ARRAY_BUFFER,block_VBO)
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER,block_EBO)
glVertexPointer(3,GL_FLOAT,0,None)
glEnableClientState(GL_VERTEX_ARRAY)
#ADD
glBindBuffer(GL_ARRAY_BUFFER,color_VBO)
glColorPointer(4,GL_FLOAT,0,None)
glEnableClientState(GL_COLOR_ARRAY)
#ADD END
glBindVertexArray(0)
draw=True
glBindVertexArray(block_VAO)
glDrawElements(GL_QUADS,block_EBO_buffer_len,GL_UNSIGNED_INT,None)
glBindVertexArray(0)
function print_blocks is in the mainloop. If I don't bind color to VAO(I mean run without new add code), it can be drawn normally.But after I bind, no graphics will appear.How can I do to make it draw normally? I really have no thing to say now.Please!Please!Please!Please!Please!Please!