(Left) What my model looks like in-program. Note that the camera is in quadrant I looking toward the origin. (Right) The texture that i used for all six sides of the cube, 16px by 16px. The arrow is white but its alpha is 0, so it is transparent.
Writing the shaders and texture loading code was easy enough, but i was stumped on an elusive bug for the better part of the past three days. Everything would load correctly, my shaders compiled and linked with absolutely no problems, OpenGL never reported any errors ... and all i got was a black cube in my debug build, and a mono-colored cube in my release build.
After spending a couple sleepless nights figuring out what could possibly be wrong with my code, i stumbled across a random question on Stack Overflow that demonstrated the same problem. Turns out, i had the following two lines in my shaders:
out vec2 texcoord; //vertex shader
in vec2 vt; //fragment shader
So yeah, of course it was a stupid mistake that involved modifying eight characters in my code.
Now this is still a little bit broken; notice that the texture image has transparency where the the arrow is, while the model in-program displays a white arrow. Also, my debug build is still broken; i only get a black cube still, and i haven't the foggiest clue why. I'll just live with it for now.
I suppose the next step is creating a main menu and language bindings, which will probably involve figuring out how to overlay things over the main window (think of a typical HUD in a video game).
.png)
.png)
No comments:
Post a Comment