本文整理汇总了C++中vsx_texture::begin_capture方法的典型用法代码示例。如果您正苦于以下问题:C++ vsx_texture::begin_capture方法的具体用法?C++ vsx_texture::begin_capture怎么用?C++ vsx_texture::begin_capture使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vsx_texture
的用法示例。
在下文中一共展示了vsx_texture::begin_capture方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: activate_offscreen
bool activate_offscreen() {
//printf("ac1\n");
//printf("activate offscreen\n");
//glGetIntegerv(GL_VIEWPORT, viewport);
//printf("old viewport is %d %d %d %d\n",viewport[0],viewport[1],viewport[2],viewport[3]);
#if defined(VSXU_OPENGL_ES) || defined (__APPLE__)
glGetIntegerv (GL_VIEWPORT, viewport);
#endif
bool rebuild = false;
if (alpha_channel->get() != alpha_channel_int)
{
alpha_channel_int = alpha_channel->get();
rebuild = true;
}
if (float_texture->get() != float_texture_int)
{
float_texture_int = float_texture->get();
rebuild = true;
}
if (texture_size->get() >= 10)
{
glGetIntegerv (GL_VIEWPORT, viewport);
int t_res_x = abs(viewport[2] - viewport[0]);
int t_res_y = abs(viewport[3] - viewport[1]);
if (texture_size->get() == 10) {
if (t_res_x != res_x || t_res_y != res_y) rebuild = true;
}
if (texture_size->get() == 11) {
if (t_res_x / 2 != res_x || t_res_y / 2 != res_y) rebuild = true;
}
if (texture_size->get() == 12) {
if (t_res_x / 4 != res_x || t_res_y / 4 != res_y) rebuild = true;
}
if (texture_size->get() == 13) {
if (t_res_x * 2 != res_x || t_res_y * 2 != res_y) rebuild = true;
}
if (texture_size->get() == 14) {
if (t_res_x * 4 != res_x || t_res_y * 4 != res_y) rebuild = true;
}
}
if (texture_size->get() != tex_size_internal || rebuild) {
//printf("generating new framebuffer\n");
tex_size_internal = texture_size->get();
switch (tex_size_internal) {
case 0: res_y = res_x = 2048; break;
case 1: res_y = res_x = 1024; break;
case 2: res_y = res_x = 512; break;
case 3: res_y = res_x = 256; break;
case 4: res_y = res_x = 128; break;
case 5: res_y = res_x = 64; break;
case 6: res_y = res_x = 32; break;
case 7: res_y = res_x = 16; break;
case 8: res_y = res_x = 8; break;
case 9: res_y = res_x = 4; break;
case 10: res_x = abs(viewport[2] - viewport[0]); res_y = abs(viewport[3] - viewport[1]); break;
case 11: res_x = abs(viewport[2] - viewport[0]) / 2; res_y = abs(viewport[3] - viewport[1]) / 2; break;
case 12: res_x = abs(viewport[2] - viewport[0]) / 4; res_y = abs(viewport[3] - viewport[1]) / 4; break;
case 13: res_x = abs(viewport[2] - viewport[0]) * 2; res_y = abs(viewport[3] - viewport[1]) * 2; break;
case 14: res_x = abs(viewport[2] - viewport[0]) * 4; res_y = abs(viewport[3] - viewport[1]) * 4; break;
};
texture->reinit_buffer(res_x, res_y,float_texture->get(),alpha_channel->get());
if (support_feedback->get())
texture2->reinit_buffer(res_x, res_y, float_texture->get(),alpha_channel->get());
}
if (!which_buffer || support_feedback->get() == 0)
texture->begin_capture();
else
texture2->begin_capture();
//printf("changing viewport to %d\n",res_x);
glViewport(0,0,res_x,res_y);
glDepthMask(GL_TRUE);
//glDisable(GL_DEPTH_TEST);
glClearColor(clear_color->get(0),clear_color->get(1),clear_color->get(2),clear_color->get(3));
//printf("clear buffer\n");
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clear Screen And Depth Buffer
//#ifdef __APPLE__
glEnable(GL_BLEND);
//#endif
glGetIntegerv(GL_CURRENT_PROGRAM, (GLint*)&glsl_prog);
glUseProgram(0);
//glBlendFunc(GL_SRC_ALPHA,GL_ONE);
loading_done = true;
return true;
};