v--sorting pririty listing for includes
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
custom.h // early declarations
custom.c
input.h // input handler
input.c
shaders.h // shader initializations
shaders.c
text.h // text render pipeline
text.c
geometry.h // sphere/cube++
geometry.c
sky.h // sky sphere with sun and moon
sky.c
terrain.h // height map terrain generator
terrain.c
water.h // 3d water waves mesh
water.c
fire.h // fire/spell effect
fire.c
player.h // "player" move handler
player.c
main.c // main
data/* // textures fonts shaders other
(glsl shaders compile on runtime)
+ libraries~ linmath uthash stb_image gl glfw (glew?win) freetype math std time~
compile.sh // gcc command
quad // exec file
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
process of using openGL--is setting up buffers and binding before draw
initialization (once) :
create VAO / vertex array
create VBO / vertex buffer
create EBO / element buffer <-- only if using indices
(
glDrawTriangles( // no indices
glDrawElements( // with indices
)
glGenVertexArrays(1,&..
glBindVertexArray(..
glGenBuffers(1,&..
glBindBuffer(GL_ARRAY_BUFFER,..
glBufferData(GL_ARRAY_BUFFER,..GL_STATIC/DYNAMIC_DRAW)
// prepare 3x floats for position values for shader
glVertexAttribPointer(0,3,GL_FLOAT,GL_FALSE,0,(void*)0)
glEnableVertexAttribArray(0)
// element buffer add if using indices--
glGenBuffers(1,..
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER,..
glBufferData(GL_ELEMENT_ARRAY_BUFFER,..GL_STATIC/DYNAMIC_DRAW)
initiation done//
render
glBindVertexArray(VAO)
glDrawElements(GL_TRIANGLE,
||
glDrawElements(GL_TRIANGLE_STRIP
// load height map texture
int width, height, nChannels;
unsigned char *data = stbi_load("resources/heightmaps/iceland_heightmap.png",&width, &height, &nChannels,0);
Top