本文整理汇总了C++中Shader::GetProgram方法的典型用法代码示例。如果您正苦于以下问题:C++ Shader::GetProgram方法的具体用法?C++ Shader::GetProgram怎么用?C++ Shader::GetProgram使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Shader
的用法示例。
在下文中一共展示了Shader::GetProgram方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: init_shader
void shadowmapping_app::init_shader()
{
ViewShader.init();
ViewShader.attach(GL_VERTEX_SHADER, "render.vert");
ViewShader.attach(GL_FRAGMENT_SHADER, "render.frag");
ViewShader.link();
view_program = ViewShader.GetProgram();
uniforms.view.proj_matrix = glGetUniformLocation(view_program, "proj_matrix");
uniforms.view.mv_matrix = glGetUniformLocation(view_program, "mv_matrix");
uniforms.view.full_shading = glGetUniformLocation(view_program, "full_shading");
uniforms.view.diffuse_albedo = glGetUniformLocation(view_program, "diffuse_albedo");
DisplayShader.init();
DisplayShader.attach( GL_VERTEX_SHADER, "display.vert");
DisplayShader.attach( GL_FRAGMENT_SHADER, "display.frag");
DisplayShader.link();
display_program = DisplayShader.GetProgram();
uniforms.dof.focal_distance = glGetUniformLocation(display_program, "focal_distance");
uniforms.dof.focal_depth = glGetUniformLocation(display_program, "focal_depth");
FilterShader.init();
FilterShader.attach( GL_COMPUTE_SHADER, "gensat.comp");
FilterShader.link();
filter_program = FilterShader.GetProgram();
}
示例2: init_shader
void init_shader()
{
selectionShader.init();
selectionShader.attach(GL_VERTEX_SHADER, "selection.vert");
selectionShader.attach(GL_FRAGMENT_SHADER, "selection.frag");
selectionShader.link();
selection_pro = selectionShader.GetProgram();
code_loc = glGetUniformLocation(selection_pro, "code");
pickingShader.init();
pickingShader.attach(GL_VERTEX_SHADER, "picking.vert");
pickingShader.attach(GL_FRAGMENT_SHADER, "picking.frag");
pickingShader.link();
picking_pro = pickingShader.GetProgram();
diffuse_loc = glGetUniformLocation(picking_pro, "diffuse");
}
示例3:
//-----------------------------------------------------------------------------
void RenderingContext::Draw(Shader& shader, GLRenderer& gl_renderer)
{
__GL_CALL(glUseProgram(shader.GetProgram()))
shader.SetUniforms(*this);
gl_renderer.Draw(shader, *this);
}
示例4: init_shader
void init_shader()
{
TriangleShader.init();
TriangleShader.attach(GL_VERTEX_SHADER, "triangle.vert");
TriangleShader.attach(GL_FRAGMENT_SHADER, "triangle.frag");
TriangleShader.link();
program = TriangleShader.GetProgram();
}
示例5: init_shader
void init_shader()
{
toonShader.init();
toonShader.attach(GL_VERTEX_SHADER, "toon3.vert");
toonShader.attach(GL_FRAGMENT_SHADER, "toon3.frag");
toonShader.link();
toonShader.use();
program = toonShader.GetProgram();
}
示例6: init_shader
void ImageApp::init_shader()
{
AppShader.init();
AppShader.attach(GL_VERTEX_SHADER, "overdraw_count.vert");
AppShader.attach(GL_FRAGMENT_SHADER, "overdraw_count.frag");
AppShader.link();
render_scene_prog = AppShader.GetProgram();
render_scene_uniforms.model_matrix = glGetUniformLocation(render_scene_prog, "model_matrix");
render_scene_uniforms.view_matrix = glGetUniformLocation(render_scene_prog, "view_matrix");
render_scene_uniforms.projection_matrix = glGetUniformLocation(render_scene_prog, "projection_matrix");
render_scene_uniforms.aspect = glGetUniformLocation(render_scene_prog, "aspect");
render_scene_uniforms.time = glGetUniformLocation(render_scene_prog, "time");
BlitShader.init();
BlitShader.attach(GL_VERTEX_SHADER, "blit.vert");
BlitShader.attach(GL_FRAGMENT_SHADER, "blit.frag");
BlitShader.link();
resolve_program = BlitShader.GetProgram();
}
示例7: CreateGlContext
int CreateGlContext()
{
hDC = ::GetDC(glHwnd);
if(!hDC)
return -1;
PIXELFORMATDESCRIPTOR pfd;
memset(&pfd, 0, sizeof(pfd));
pfd.nSize = sizeof(pfd);
pfd.nVersion = 1;
pfd.dwFlags =
PFD_DRAW_TO_WINDOW |
PFD_DOUBLEBUFFER |
PFD_SUPPORT_OPENGL |
//PFD_SUPPORT_COMPOSITION |
0x00008000 |
PFD_GENERIC_ACCELERATED;
pfd.iPixelType = PFD_TYPE_RGBA;
pfd.cColorBits = 32;
pfd.cDepthBits = 24;
pfd.cStencilBits = 8;
pfd.iLayerType = PFD_MAIN_PLANE;
int pf = ChoosePixelFormat(hDC, &pfd);
if(!pf) {
error ="ChoosePixelFormat error";
return -2;
}
RLOG("OpenGL: ChoosePixelFormat ok..");
if(!SetPixelFormat(hDC, pf, &pfd)) {
error = "SetPixelFormat error";
return -3;
}
DescribePixelFormat(hDC, pf, sizeof(PIXELFORMATDESCRIPTOR), &pfd);
hRC = wglCreateContext(hDC);
if(!hRC)
{
error = "wglCreateContext error";
return -4;
}
RLOG("OpenGL: wglCreateContext ok..");
if(!wglMakeCurrent(hDC, hRC))
{
error = "wglMakeCurrent error";
return -5;
}
RLOG("OpenGL: wglMakeCurrent ok..");
GLenum err = glewInit();
if(err != GLEW_OK)
{
error = "Glew library initialization error: " + String((const char*) glewGetErrorString(err));
return -6;
}
RLOG("OpenGL: glewInit ok..");
Size sz = Ctrl::GetScreenSize();
if(!screenFbo0.Create(sz.cx, sz.cy))
{
error = "Creating screen 0 fbo error: " + screenFbo0.GetError();
return -7;
}
if(!screenFbo1.Create(sz.cx, sz.cy))
{
error = "Creating screen 1 fbo error: " + screenFbo1.GetError();
return -7;
}
RLOG("OpenGL: Creating fbo ok..");
alphaMagProg.CompileProgram(alphaMagVert, alphaMagFrag);
if(alphaMagProg.GetProgram() < 0)
{
error = alphaMagProg.GetError();
return -8;
}
blurProg.CompileProgram(blurVert, blurFrag);
if(blurProg.GetProgram() < 0)
{
error = blurProg.GetError();
return -8;
}
RLOG("OpenGL: CompileProgram ok..");
resources.GetFont(Tahoma(), true);
resources.GetFont(Tahoma().Bold(), true);
RLOG("OpenGL: Preloading fonts ok..");
wglSwapIntervalEXT(1);
if(glDrawMode == DRAW_ON_TIMER)
{
SetTimer(glHwnd, 1, 10, NULL);
RLOG("OpenGL: SetTimer ok..");
}
//.........这里部分代码省略.........