本文整理汇总了C++中Shader::CompileProgram方法的典型用法代码示例。如果您正苦于以下问题:C++ Shader::CompileProgram方法的具体用法?C++ Shader::CompileProgram怎么用?C++ Shader::CompileProgram使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Shader
的用法示例。
在下文中一共展示了Shader::CompileProgram方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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..");
}
//.........这里部分代码省略.........