Adventures in Shader-ville

g++ triangle.cpp ... -lglew32 -lopengl32
/tmp/cc2DLE4T.o:triangle.cpp:(.text+0x7): undefined reference to `__imp____glewDeleteProgram'
/tmp/cc2DLE4T.o:triangle.cpp:(.text+0x27): undefined reference to `__imp____glewUseProgram'
/tmp/cc2DLE4T.o:triangle.cpp:(.text+0x69): undefined reference to `__imp____glewEnableVertexAttribArray'
/tmp/cc2DLE4T.o:triangle.cpp:(.text+0x90): undefined reference to `__imp____glewVertexAttribPointer'
/tmp/cc2DLE4T.o:triangle.cpp:(.text+0xc7): undefined reference to `__imp____glewDisableVertexAttribArray'
/tmp/cc2DLE4T.o:triangle.cpp:(.text+0xff): undefined reference to `__imp____glewCreateShader'
/tmp/cc2DLE4T.o:triangle.cpp:(.text+0x11d): undefined reference to `__imp____glewShaderSource'
/tmp/cc2DLE4T.o:triangle.cpp:(.text+0x131): undefined reference to `__imp____glewCompileShader'
/tmp/cc2DLE4T.o:triangle.cpp:(.text+0x143): undefined reference to `__imp____glewGetShaderiv'
/tmp/cc2DLE4T.o:triangle.cpp:(.text+0x18b): undefined reference to `__imp____glewCreateShader'
/tmp/cc2DLE4T.o:triangle.cpp:(.text+0x1a9): undefined reference to `__imp____glewShaderSource'
/tmp/cc2DLE4T.o:triangle.cpp:(.text+0x1bd): undefined reference to `__imp____glewCompileShader'
/tmp/cc2DLE4T.o:triangle.cpp:(.text+0x1cf): undefined reference to `__imp____glewGetShaderiv'
/tmp/cc2DLE4T.o:triangle.cpp:(.text+0x217): undefined reference to `__imp____glewCreateProgram'
/tmp/cc2DLE4T.o:triangle.cpp:(.text+0x225): undefined reference to `__imp____glewAttachShader'
/tmp/cc2DLE4T.o:triangle.cpp:(.text+0x23d): undefined reference to `__imp____glewAttachShader'
/tmp/cc2DLE4T.o:triangle.cpp:(.text+0x255): undefined reference to `__imp____glewLinkProgram'
/tmp/cc2DLE4T.o:triangle.cpp:(.text+0x26a): undefined reference to `__imp____glewGetProgramiv'
/tmp/cc2DLE4T.o:triangle.cpp:(.text+0x2ba): undefined reference to `__imp____glewGetAttribLocation'
collect2: ld returned 1 exit status

Does that look like anything to you? Yeah. Me neither. In honor of that fact, this article is intended to be understandable enough to be interesting and readable for even an inexperienced non-programmer type. However, it will also provide some very useful information which may save from grief someone else who is attempting the same thing as I just have. Therefore, I will try to provide as many useful links as possible.

Continue reading “Adventures in Shader-ville”

Advertisement

Culling

I suppose it is unrealistic to suggest that performance is never an issue when creating a video game. Since the better a game performs, the more graphical tricks you can cram up your games proverbial sleeves. But with the speed of modern computers, 2D games tend to not require much optimization. And as they primarily use tile-based graphics, it is relatively trivial to determine which tiles in the level are on screen (and therefore should be drawn), and which are not.

However, there are some newer 2D games, such as Braid, or Aquaria which use a entirely different method for their graphics which is not tile-based, but instead uses images which can be repeated positioned, rotated, and scaled arbitrarily to build a level. These images are rendered to the screen using modern 3D graphics hardware, which—being designed for 3D games—is rather fast for this application. Even still, there can be quite a large number of these images building up a level, so it is useful to devise an accurate and speedy method for determining which objects are on screen, and which are not. Continue reading “Culling”