void test_initgbuf() { #if 1 #define MRT 0 #if MRT if (!shaderpdm_mrt) shaderpdm_mrt=vfs_load("shaders/pdm_mrt.c"); rnd_tg("ttd", gbuf_color, gbuf_normal, gbuf_depth); #else rnd_tg("td", gbuf_color, gbuf_depth); // rnd_tg(0); #endif rnd_clearall(); //////////////////////////////// test_vbfmt_t verts[4]; verts[0].co=vec(-10, -10, 30); verts[1].co=vec(10, -10, 30); verts[2].co=vec(10, 10, 30); verts[3].co=vec(-10, 10, 30); for (int i=0; i<4; i++) { verts[i].normal=vec(0,0,-1); verts[i].tangent=vec(1,0,0); verts[i].binormal=vec(0,1,0); } verts[0].texco[0]=0; verts[0].texco[1]=0; verts[1].texco[0]=.5; verts[1].texco[1]=0; verts[2].texco[0]=.5; verts[2].texco[1]=.5; verts[3].texco[0]=0; verts[3].texco[1]=.5; #if MRT vfs_use(shaderpdm_mrt); #else vfs_use(shaderpdm); #endif samp2d("color_map", texcolor); samp2d("relief_map", texrelief); samp2d("pyramid_map", texpyramid); samp2d("depth_map", texdepth); uni3f("lightpos", 5.36f, 10.0f, 1.8f); int vb=vb_alloc(4, sizeof(test_vbfmt_t), verts); rendq("{co texco normal tangent binormal}", -1, vb); vb_free(vb); #endif //0 vfs_use(-1); #if 1 float tcbnd[4]={0,0,1,1}; float qbnd[4]={-10,-10,10,10}; glColor4f(1,1,1,1); // glEnable(GL_TEXTURE_2D); // glBindTexture(GL_TEXTURE_2D, texcolor); //texpyramid);//texrelief); //texlena); float z=50; glBegin(GL_QUADS); glTexCoord2f(tcbnd[0], tcbnd[1]); glVertex3f(qbnd[0], qbnd[1], z); glTexCoord2f(tcbnd[2], tcbnd[1]); glVertex3f(qbnd[2], qbnd[1], z); glTexCoord2f(tcbnd[2], tcbnd[3]); glVertex3f(qbnd[2], qbnd[3], z); glTexCoord2f(tcbnd[0], tcbnd[3]); glVertex3f(qbnd[0], qbnd[3], z); glEnd(); // glDisable(GL_TEXTURE_2D); //TODO #endif }
void Shader::uni3f (const char* uniName, float uniValue1, float uniValue2, float uniValue3) { GLuint uni = checkUniform (uniName); uni3f (uni, uniValue1, uniValue2, uniValue3); }