dchammond/Euchre — pull request #1 by jzhu98 (2014-10-02 01:20:49+00:00)
Title: Fix ALL the things

There's so much going on here that you seem to have a misconception about.

I think a big part of it was detangling the dependencies you had in your head:

- Shaders are NOT A DEPENDENCY in textures (removed a few parameters)
- Shader compilation can happen **way** before anything else happens
- Shaders need only be **used** (i.e. `glUseProgram`) when actually rendering
- VAOs can have multiple VBOs attached to the same one (you just have to specify the layout and location of data ... still have to change `std::vector` to `GLuint`
- Textures must be **bound** when they are being rendered
- That `texNum` parameter? You only need it if you're rendering with more than one texture in a single draw call (i.e. two textures meshed in the same triangles). You're only using one texture at a time here, so you only need `GL_TEXTURE0` to be honest.
- The `glUniform1i` is to be used only in the above case of multiple textures per draw call. If you just call `glBindTexture(GL_TEXTURE_2D, tex)` when rendering, this should work out well for now.
- You kinda forgot `glGenTextures` in your texture loading code. I'm still curious how you managed to draw the background without that.
- I had `LoadShaders` return the program number generated. The way you did it you didn't actually modify the program ID, which defaults to 0 (no shader).

And now some design nitpicks:
- Why are your OpenGL functions wrapped in a class? There's not really any state here; just make them free functions.
- You repeated yourself SO much in your shader compile code. I did some of the heavy refactoring there for you.