I have come across a problem when I am loading a single texture onto a single quad, and this problem persisted during the planning phases of my project, before starting my development phase. I am confused on the order of operations required to load a texture.
Why am I confused? I used the order listed below and rewrote the project over and over again, and the results vary. As in, one project would load and display the texture correctly, while the other projects can't display the texture, but loads the texture just fine. Due to this, I am conflicted.
Here is the rundown on the order of operations required for me to load a texture and show it onto the screen using OpenGL 2.0.
- Create window.
- Set up game loop.
- Create OpenGL 2.0 context.
- Initialize objects and load necessary files and data. (Textures, bitmaps, etc.)
- Set up vertex data. (In this case, a quad.)
- Create vertex shader code.
- Create fragment shader code.
- Compile the codes. (Checking included.)
- Create program.
- Attach shaders to program.
- Obtain attribute and uniform locations.
- Set up viewport.
- Create projection matrix, be it perspective or orthogonal.
- Create view matrix and initialize matrix state.
- Set vertex attribute pointer.
- Enable vertex array buffer.
- Use view matrix as model matrix. Push/pop/transform when necessary.
- Clear screen.
Are these correct in chronological order? Are there anything else I am missing? I am just stuck on the planning phase, and wanted to get the chronological order done right.