I am wondering how to write down code to display a 3D object on a PyGame window.I am using the 3.3 version of OpenGL.I decide to start by addingglEnable(GL_DEPTH_TEST) and write a cube object as a 8x6 matrix:
cube = (0.0,0.0,0.0,1.0,1.0,1.0,
0.5,0.0,0.0,1.0,1.0,1.0,
0.0,0.5,0.0,1.0,1.0,1.0,
0.0,0.0,0.5,1.0,1.0,1.0,
0.5,0.5,0.0,1.0,1.0,1.0,
0.5,0.0,0.5,1.0,1.0,1.0,
0.0,0.5,0.5,1.0,1.0,1.0,
0.5,0.5,0.5,1.0,1.0,1.0
)
then call glDrawArrays(GL_IMAGE_CUBE,0,8) or glDrawArrays(GL_SAMPLER_CUBE)but it didnt work.I have come up with some ideas:
I suspect that when I initialize the PyGame window I need to change the second argument from:
pg.display.set_mode(display,DOUBLEBUF|OPENGL) or that I need to write a shader for the fragment depth.
But after searching it up in the Internet I found that glDrawArrays() sets up its own fragment shader when $z \ne 0$.What should I do?