Well, I have been learning openGL with this tutorial: opengl-tutorial.org.
That tutorial do not explain how do the shaders works. I mean, is the vertex shader readed before the fragment shader?
Ok talking about the question, I want to create two objects for practice, one box (3D Square with a texture) and a pyramid (3D Triangle with a texture), I don’t know how to do it, I know how to draw it with C++/OpenGl but talking about the GLSL…. Do I need to create another program? How can I do that?
(OpenGL 3.3)
OpenGL does not maintain “objects” in such a way as you seem to assume (the term object is used to refer to “something” internal that OpenGL uses and that you can refer to via an identifier. A vertex buffer, a texture, or a shader are all examples of “objects”). OpenGL is not a scenegraph.
You need to create the vertex data for each of your objects in your application (or load that data from a file) and to provide OpenGL with that by feeding a buffer object with that data.
Then you tell OpenGL to draw a number of vertices from that buffer. OpenGL does not care what that data is or how to draw it. It will only do exactly what you tell it to do. If you tell it “take this block of data that contains vertex coordinates, and now draw 5 triangles”, then it will just do that.