- if( gpipeline.ready )
- {
- glBindTexture( GL_TEXTURE_2D, gpipeline.rgb_background );
- glTexImage2D( GL_TEXTURE_2D, 0, GL_RGB, vg.window_x, vg.window_y, 0,
- GL_RGB, GL_UNSIGNED_BYTE, NULL );
- }
-}
-
-/* used for drawing player onto */
-VG_STATIC void render_init_temp_buffer(void)
-{
- vg_info( "[render] Allocate temporary framebuffer\n" );
-
- glGenFramebuffers( 1, &gpipeline.fb_background );
- glBindFramebuffer( GL_FRAMEBUFFER, gpipeline.fb_background );
-
- glGenTextures( 1, &gpipeline.rgb_background );
- glBindTexture( GL_TEXTURE_2D, gpipeline.rgb_background );
- glTexImage2D( GL_TEXTURE_2D, 0, GL_RGB, vg.window_x, vg.window_y,
- 0, GL_RGB, GL_UNSIGNED_BYTE, NULL);
-
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE );
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE );
- glFramebufferTexture2D( GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
- GL_TEXTURE_2D,
- gpipeline.rgb_background, 0);
-
- VG_CHECK_GL_ERR();
-}
-
-/* used for drawing world depth from the top view, used in our water and
- * lighting calculations */
-VG_STATIC void render_init_depthmap_buffer(void)
-{
- vg_info( "[render] Allocate depth map buffer\n" );
-
- glGenFramebuffers( 1, &gpipeline.fb_depthmap );
- glBindFramebuffer( GL_FRAMEBUFFER, gpipeline.fb_depthmap );
-
- glGenTextures( 1, &gpipeline.rgb_depthmap );
- glBindTexture( GL_TEXTURE_2D, gpipeline.rgb_depthmap );
- glTexImage2D( GL_TEXTURE_2D, 0, GL_R32F, 1024, 1024, 0,
- GL_RED, GL_FLOAT, NULL );
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
- vg_tex2d_clamp();
-
- glFramebufferTexture2D( GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
- GL_TEXTURE_2D,
- gpipeline.rgb_depthmap, 0);
-
- VG_CHECK_GL_ERR();
-}
-
-VG_STATIC void render_init_fs_quad(void)
-{
- vg_info( "[render] Allocate quad\n" );
-
- float quad[] = { 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f,
- 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 1.0f,
-
- 0.2f, 0.0f, 0.8f, 1.0f, 0.2f, 1.0f,
- 0.2f, 0.0f, 0.8f, 0.0f, 0.8f, 1.0f};
-
- glGenVertexArrays( 1, &gpipeline.fsquad.vao );
- glGenBuffers( 1, &gpipeline.fsquad.vbo );
- glBindVertexArray( gpipeline.fsquad.vao );
- glBindBuffer( GL_ARRAY_BUFFER, gpipeline.fsquad.vbo );
- glBufferData( GL_ARRAY_BUFFER, sizeof(quad), quad, GL_STATIC_DRAW );
- glBindVertexArray( gpipeline.fsquad.vao );
- glVertexAttribPointer( 0, 2, GL_FLOAT, GL_FALSE,
- sizeof(float)*2, (void*)0 );
- glEnableVertexAttribArray( 0 );
-
- VG_CHECK_GL_ERR();
-}