标签:oid doc end isa 应用 矩形 .com bat bsp
//核心代码
void RenderScene() { //清除缓存区 glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT|GL_STENCIL_BUFFER_BIT); //设置四个固定矩形颜色 GLfloat vRed[] = {1.0f, 0.0f, 0.0f, 0.5f}; GLfloat vGreen[] = {0.0f, 1.0f, 0.0f, 1.0f}; GLfloat vBlue[] = {0.0f, 0.0f, 1.0f, 1.0f}; GLfloat vBlack[] = {0.0f, 0.0f, 0.0f, 1.0f}; //绘制四个固定矩形 //GLT_SHADER_IDENTITY:单元着色器 shaderManager.UseStockShader(GLT_SHADER_IDENTITY, vRed); redBatch.Draw(); shaderManager.UseStockShader(GLT_SHADER_IDENTITY, vGreen); greenBatch.Draw(); shaderManager.UseStockShader(GLT_SHADER_IDENTITY, vBlue); blueBatch.Draw(); shaderManager.UseStockShader(GLT_SHADER_IDENTITY, vBlack); blackBatch.Draw(); //移动矩形设置混合功能 //开启混合功能 glEnable(GL_BLEND); //设置混合因子 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); //使用固定管线着色器 shaderManager.UseStockShader(GLT_SHADER_IDENTITY, vRed); //绘制 squareBatch.Draw(); //关闭混合功能 glDisable(GL_BLEND); //后台渲染完成交给前台 glutSwapBuffers(); }
标签:oid doc end isa 应用 矩形 .com bat bsp
原文地址:https://www.cnblogs.com/lybSkill/p/9983755.html