bool initBlend() { glEnable(GL_SAMPLE_MASK); glSampleMaski(0, 0xFF); glEnablei(GL_BLEND, 0); glColorMaski(0, GL_TRUE, GL_TRUE, GL_TRUE, GL_FALSE); glBlendEquationSeparatei(0, GL_FUNC_REVERSE_SUBTRACT, GL_FUNC_ADD); glBlendFuncSeparatei(0, GL_SRC_COLOR, GL_ONE, GL_ZERO, GL_ZERO); glEnablei(GL_BLEND, 1); glColorMaski(1, GL_TRUE, GL_FALSE, GL_FALSE, GL_FALSE); glBlendEquationSeparatei(1, GL_FACTOR_MIN_AMD, GL_FUNC_ADD); glBlendFuncSeparatei(1, GL_SRC_COLOR, GL_SRC_COLOR, GL_ZERO, GL_ZERO); glEnablei(GL_BLEND, 2); glColorMaski(2, GL_TRUE, GL_FALSE, GL_FALSE, GL_FALSE); glBlendEquationSeparatei(2, GL_FACTOR_MAX_AMD, GL_FUNC_ADD); glBlendFuncSeparatei(2, GL_SRC_COLOR, GL_SRC_COLOR, GL_ZERO, GL_ZERO); glEnablei(GL_BLEND, 3); glColorMaski(3, GL_TRUE, GL_FALSE, GL_FALSE, GL_FALSE); glBlendEquationSeparatei(3, GL_FUNC_ADD, GL_FUNC_ADD); glBlendFuncSeparatei(3, GL_SRC_COLOR, GL_SRC_COLOR, GL_ZERO, GL_ZERO); return glf::checkError("initBlend"); }
bool render() { glm::ivec2 WindowSize(this->getWindowSize()); { glBindBuffer(GL_UNIFORM_BUFFER, BufferName[buffer::TRANSFORM]); glm::mat4* Pointer = reinterpret_cast<glm::mat4*>(glMapBufferRange(GL_UNIFORM_BUFFER, 0, sizeof(glm::mat4), GL_MAP_WRITE_BIT | GL_MAP_INVALIDATE_BUFFER_BIT)); glm::mat4 Projection = glm::perspective(glm::pi<float>() * 0.25f, static_cast<float>(WindowSize.x) / static_cast<float>(WindowSize.y), 0.1f, 100.0f); glm::mat4 Model = glm::mat4(1.0f); *Pointer = Projection * this->view() * Model; glUnmapBuffer(GL_UNIFORM_BUFFER); } // Set the display viewport glViewport(0, 0, WindowSize.x, WindowSize.y); glBindBufferBase(GL_UNIFORM_BUFFER, semantic::uniform::TRANSFORM0, BufferName[buffer::TRANSFORM]); // Clear color buffer with black glClearBufferfv(GL_COLOR, 0, &glm::vec4(0.0f, 0.0f, 0.0f, 1.0f)[0]); // Bind program glUseProgram(ProgramName); glBindVertexArray(VertexArrayName); glBindBufferRange(GL_UNIFORM_BUFFER, semantic::uniform::MATERIAL, BufferName[buffer::MATERIAL], 0, sizeof(glm::vec4)); // The first orange quad is not written in the framebuffer. glColorMaski(0, GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); // Beginning of the samples count query glBeginQuery(GL_SAMPLES_PASSED, QueryName); // To test the condional rendering, comment this line, the next draw call won't happen. glDrawArraysInstanced(GL_TRIANGLES, 0, VertexCount, 1); // End of the samples count query glEndQuery(GL_SAMPLES_PASSED); // The second blue quad is written in the framebuffer only if a sample pass the occlusion query. glColorMaski(0, GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); glBindBufferRange(GL_UNIFORM_BUFFER, semantic::uniform::MATERIAL, BufferName[buffer::MATERIAL], this->UniformMaterialOffset, sizeof(glm::vec4)); // Draw only if one sample went through the tests, // we don't need to get the query result which prevent the rendering pipeline to stall. glBeginConditionalRender(QueryName, GL_QUERY_WAIT); // Clear color buffer with white glClearBufferfv(GL_COLOR, 0, &glm::vec4(1.0f)[0]); glDrawArraysInstanced(GL_TRIANGLES, 0, VertexCount, 1); glEndConditionalRender(); return true; }
void PipelineImpl::setColorState(GlState& state) const { if(state.m_stateHashes.m_color == m_hashes.m_color) { return; } state.m_stateHashes.m_color = m_hashes.m_color; if(m_blendEnabled) { glEnable(GL_BLEND); for(U i = 0; i < m_in.m_color.m_attachmentCount; ++i) { const Attachment& att = m_cache.m_attachments[i]; glBlendFunci(i, att.m_srcBlendMethod, att.m_dstBlendMethod); glBlendEquationi(i, att.m_blendFunction); glColorMaski(i, att.m_channelWriteMask[0], att.m_channelWriteMask[1], att.m_channelWriteMask[2], att.m_channelWriteMask[3]); state.m_colorWriteMasks[i][0] = att.m_channelWriteMask[0]; state.m_colorWriteMasks[i][1] = att.m_channelWriteMask[1]; state.m_colorWriteMasks[i][2] = att.m_channelWriteMask[2]; state.m_colorWriteMasks[i][3] = att.m_channelWriteMask[3]; } } else { glDisable(GL_BLEND); for(U i = 0; i < m_in.m_color.m_attachmentCount; ++i) { const Attachment& att = m_cache.m_attachments[i]; glColorMaski(i, att.m_channelWriteMask[0], att.m_channelWriteMask[1], att.m_channelWriteMask[2], att.m_channelWriteMask[3]); state.m_colorWriteMasks[i][0] = att.m_channelWriteMask[0]; state.m_colorWriteMasks[i][1] = att.m_channelWriteMask[1]; state.m_colorWriteMasks[i][2] = att.m_channelWriteMask[2]; state.m_colorWriteMasks[i][3] = att.m_channelWriteMask[3]; } } }
void kit::PixelBuffer::blitFrom(kit::PixelBuffer::Ptr source, bool colorMask, std::vector<std::array<bool, 4>> componentMask, bool depthMask, bool stencilMask) { bool clearColorMask = false; GLbitfield mask = 0; if (colorMask) { mask |= GL_COLOR_BUFFER_BIT; if (this->m_colorAttachments.size() != source->getNumColorAttachments()) { KIT_THROW("source: color attachment count mismatch"); return; } } if (depthMask) { mask |= GL_DEPTH_BUFFER_BIT; } if (stencilMask) { mask |= GL_STENCIL_BUFFER_BIT; } if (componentMask.size() != 0 && colorMask) { if (componentMask.size() != this->m_colorAttachments.size()) { KIT_ERR("componentMask: color attachment count mismatch"); return; } for (int i = 0; i < this->m_colorAttachments.size(); i++) { KIT_GL(glColorMaski(i, componentMask[i][0], componentMask[i][1], componentMask[i][2], componentMask[i][3])); } clearColorMask = true; } KIT_GL(glBlitNamedFramebuffer(source->getHandle(), this->getHandle(), 0, 0, source->getResolution().x, source->getResolution().y, 0, 0, this->getResolution().x, this->getResolution().y, mask, GL_LINEAR)); if (clearColorMask) { for (int i = 0; i < this->m_colorAttachments.size(); i++) { KIT_GL(glColorMaski(i, true, true, true, true)); } } }
void ReplayRenderWidget::paintGL() { // Set up some needed GL state glColorMaski(0, GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); glDisablei(GL_BLEND, 0); glDisable(GL_DEPTH_TEST); glDisable(GL_STENCIL_TEST); glDisable(GL_SCISSOR_TEST); glDisable(GL_CULL_FACE); // Clear screen glClearColor(0.6f, 0.2f, 0.2f, 1.0f); glClear(GL_COLOR_BUFFER_BIT); // Draw displays // Setup screen draw shader glBindVertexArray(mVertArray); glBindVertexBuffer(0, mVertBuffer, 0, 4 * sizeof(GLfloat)); glBindProgramPipeline(mPipeline); // Draw screen quad glBindSampler(0, mSampler); glBindTextureUnit(0, mTvBuffer); glDrawArrays(GL_TRIANGLES, 0, 6); }
//! glColorMaski wrapper. May throw. inline void colorMaski(GLuint const buf, GLboolean const r, GLboolean const g, GLboolean const b, GLboolean const a) { glColorMaski(buf, r, g, b, a); checkError("glColorMaski"); }
void StateSystem::MaskState::applyGL() const { if (colormaskUseSeparate){ for (GLuint i = 0; i < MAX_DRAWBUFFERS; i++){ glColorMaski(i, colormask[i][0],colormask[i][1],colormask[i][2],colormask[i][3]); } } else{ glColorMask( colormask[0][0],colormask[0][1],colormask[0][2],colormask[0][3] ); } glDepthMask(depth); glStencilMaskSeparate(GL_FRONT, stencil[FACE_FRONT]); glStencilMaskSeparate(GL_BACK, stencil[FACE_BACK]); }
void OGLBlendState::Enable () { if (m_EnableAlphaToCoverage) glEnable (GL_SAMPLE_COVERAGE); else glDisable (GL_SAMPLE_COVERAGE); if (m_EnableIndependentBlend) { for (int i = 0; i < BlendState::NUM_TARGETS; i++) { Target& target = m_Target[i]; if (target.enable) { glEnable (GL_BLEND); glBlendFuncSeparate (target.srcColor, target.dstColor, target.srcAlpha, target.dstAlpha); glBlendEquationSeparate (target.opColor, target.opAlpha); } else { glDisable (GL_BLEND); } glColorMaski (i, target.rMask, target.gMask, target.bMask, target.aMask); glSampleMaski (i, m_SampleMask); } } else { Target& target = m_Target[0]; if (target.enable) { glEnable (GL_BLEND); glBlendFuncSeparate (target.srcColor, target.dstColor, target.srcAlpha, target.dstAlpha); glBlendEquationSeparate (target.opColor, target.opAlpha); } else { glDisable (GL_BLEND); } glColorMask (target.rMask, target.gMask, target.bMask, target.aMask); glSampleMaski (0, m_SampleMask); } glBlendColor (m_BlendColor.x, m_BlendColor.y, m_BlendColor.z, m_BlendColor.w); }
int MFMat_Standard_Begin(MFMaterial *pMaterial, MFRendererState &state) { MFMat_Standard_Data *pData = (MFMat_Standard_Data*)pMaterial->pInstanceData; MFEffectTechnique *pTechnique = NULL; if(pData->pEffect) pTechnique = MFEffect_GetTechnique(pData->pEffect, state); MFDebug_Assert(pTechnique, "No technique!"); MFEffectData_OpenGL &techniqueData = *(MFEffectData_OpenGL*)pTechnique->pPlatformData; if(pTechnique != state.pTechniqueSet) { state.pTechniqueSet = pTechnique; glUseProgram(techniqueData.program); // need to clear all the cache states //... or ignore the state caching for now } // bools /* do a bitscan loop over the bool states uint32 boolState = state.bools & state.rsSet[MFSB_CT_Bool]; uint32 req = pTechnique->renderStateRequirements[MFSB_CT_Bool]; if(req) { uint32 vsReq = pVS->renderStateRequirements[MFSB_CT_Bool]; uint32 psReq = pPS->renderStateRequirements[MFSB_CT_Bool]; if((state.boolsSet & req) != (boolState & req)) { BOOL bools[32]; for(uint32 i=0, b=1; i<MFSCB_Max; ++i, b<<=1) bools[i] = (boolState & b) != 0; if((state.boolsSet & vsReq) != (boolState & vsReq)) pd3dDevice->SetVertexShaderConstantB(0, bools, 32); if((state.boolsSet & psReq) != (boolState & psReq)) pd3dDevice->SetPixelShaderConstantB(0, bools, 32); } } */ // matrices uint32 req = pTechnique->renderStateRequirements[MFSB_CT_Matrix]; uint32 i; while(MFUtil_BitScanReverse(req, &i)) { uint32 b = MFBIT(i); req ^= b; // if(state.pMatrixStatesSet[i] != state.pMatrixStates[i]) { MFMatrix *pM; if(i > MFSCM_DerivedStart) pM = state.getDerivedMatrix((MFStateConstant_Matrix)i); else pM = state.pMatrixStates[i]; // state.pMatrixStatesSet[i] = pM; GLint uniform = techniqueData.uniformLocation[MFSB_CT_Matrix][i]; glUniformMatrix4fv(uniform, 1, GL_TRUE, (float*)pM); } } // vectors req = pTechnique->renderStateRequirements[MFSB_CT_Vector]; while(MFUtil_BitScanReverse(req, &i)) { uint32 b = MFBIT(i); req ^= b; // if(state.pVectorStatesSet[i] != state.pVectorStates[i]) { MFVector *pV = state.pVectorStates[i]; // state.pVectorStatesSet[i] = pV; GLint uniform = techniqueData.uniformLocation[MFSB_CT_Vector][i]; glUniform4fv(uniform, 1, (float*)pV); } } // textures req = pTechnique->renderStateRequirements[MFSB_CT_Texture]; while(MFUtil_BitScanReverse(req, &i)) { req ^= MFBIT(i); MFTexture *pT = state.pTextures[i]; if(state.pTexturesSet[i] != pT) { state.pTexturesSet[i] = pT; glActiveTexture(GL_TEXTURE0 + i); glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, (GLuint)(size_t)pT->pInternalData); } /* else { glActiveTexture(GL_TEXTURE0 + i); glDisable(GL_TEXTURE_2D); } */ MFSamplerState *pS = (MFSamplerState*)state.pRenderStates[MFSCRS_DiffuseSamplerState + i]; // if(state.pRenderStatesSet[MFSCRS_DiffuseSamplerState + i] != pS) { // state.pRenderStatesSet[MFSCRS_DiffuseSamplerState + i] = pS; GLint uniform = techniqueData.uniformLocation[MFSB_CT_RenderState][MFSCRS_DiffuseSamplerState + i]; GLint sampler = (GLint)(size_t)pS->pPlatformData; glUniform1i(uniform, i); glBindSampler(i, sampler); } } // blend state MFBlendState *pBlendState = (MFBlendState*)state.pRenderStates[MFSCRS_BlendState]; if(state.pRenderStatesSet[MFSCRS_BlendState] != pBlendState) { state.pRenderStatesSet[MFSCRS_BlendState] = pBlendState; if(pBlendState->stateDesc.bIndependentBlendEnable) { for(int j=0; j<8; ++j) { MFBlendStateDesc::RenderTargetBlendDesc &target = pBlendState->stateDesc.renderTarget[j]; if(target.bEnable) { glEnable(GL_BLEND); glBlendEquationSeparatei(j, glBlendOp[target.blendOp], glBlendOp[target.blendOpAlpha]); glBlendFuncSeparatei(j, glBlendArg[target.srcBlend], glBlendArg[target.destBlend], glBlendArg[target.srcBlendAlpha], glBlendArg[target.destBlendAlpha]); } else glDisable(GL_BLEND); glColorMaski(j, target.writeMask & MFColourWriteEnable_Red, target.writeMask & MFColourWriteEnable_Green, target.writeMask & MFColourWriteEnable_Blue, target.writeMask & MFColourWriteEnable_Alpha); } } else { MFBlendStateDesc::RenderTargetBlendDesc &target = pBlendState->stateDesc.renderTarget[0]; if(target.bEnable) { glEnable(GL_BLEND); glBlendEquationSeparate(glBlendOp[target.blendOp], glBlendOp[target.blendOpAlpha]); glBlendFuncSeparate(glBlendArg[target.srcBlend], glBlendArg[target.destBlend], glBlendArg[target.srcBlendAlpha], glBlendArg[target.destBlendAlpha]); } else glDisable(GL_BLEND); glColorMask(target.writeMask & MFColourWriteEnable_Red, target.writeMask & MFColourWriteEnable_Green, target.writeMask & MFColourWriteEnable_Blue, target.writeMask & MFColourWriteEnable_Alpha); } } // rasteriser state MFRasteriserState *pRasteriserState = (MFRasteriserState*)state.pRenderStates[MFSCRS_RasteriserState]; if(state.pRenderStatesSet[MFSCRS_RasteriserState] != pRasteriserState) { state.pRenderStatesSet[MFSCRS_RasteriserState] = pRasteriserState; switch(pRasteriserState->stateDesc.cullMode) { case MFCullMode_None: glDisable(GL_CULL_FACE); break; case MFCullMode_CCW: glEnable(GL_CULL_FACE); glFrontFace(GL_CW); glCullFace(GL_BACK); break; case MFCullMode_CW: glEnable(GL_CULL_FACE); glFrontFace(GL_CCW); glCullFace(GL_BACK); break; default: MFUNREACHABLE; } } // depth/stencil state MFDepthStencilState *pDSState = (MFDepthStencilState*)state.pRenderStates[MFSCRS_DepthStencilState]; if(state.pRenderStatesSet[MFSCRS_DepthStencilState] != pDSState) { state.pRenderStatesSet[MFSCRS_DepthStencilState] = pDSState; if(pDSState->stateDesc.bDepthEnable) { glEnable(GL_DEPTH_TEST); glDepthFunc(glCompareFunc[pDSState->stateDesc.depthFunc]); glDepthMask(pDSState->stateDesc.depthWriteMask == MFDepthWriteMask_Zero ? GL_FALSE : GL_TRUE); } else glDisable(GL_DEPTH_TEST); } // setup alpha test if(state.boolChanged(MFSCB_AlphaTest) || (state.pVectorStatesSet[MFSCV_RenderState] != state.pVectorStates[MFSCV_RenderState] && state.getBool(MFSCB_AlphaTest))) { MFVector *pRS = state.pVectorStates[MFSCV_RenderState]; state.pVectorStatesSet[MFSCV_RenderState] = pRS; state.boolsSet = (state.boolsSet & ~MFBIT(MFSCB_AlphaTest)) | (state.bools & MFBIT(MFSCB_AlphaTest)); #if !defined(MF_OPENGL_ES) if(state.getBool(MFSCB_AlphaTest)) { glEnable(GL_ALPHA_TEST); glAlphaFunc(GL_GEQUAL, pRS->x); } else glDisable(GL_ALPHA_TEST); #else // TODO: do something here... //I guess we need to implement the alpha test in the shader... #endif } /* // set clour/alpha scales if(state.pVectorStatesSet[MFSCV_User0] != state.pVectorStates[MFSCV_User0]) { MFVector *pMask = state.pVectorStates[MFSCV_User0]; state.pVectorStatesSet[MFSCV_User0] = pMask; // pd3dDevice->SetVertexShaderConstantF(r_colourMask, (float*)pMask, 1); } */ // set animation matrices if(state.getBool(MFSCB_Animated)) { MFDebug_Assert(false, "TODO!"); // for(uint32 b=0; b<state.matrixBatch.numMatrices; b++) // MFRendererPC_SetAnimationMatrix(b, state.animation.pMatrices[state.matrixBatch.pIndices[b]]); } // set viewport if(state.pViewportSet != state.pViewport) { if(!state.pViewport) MFRenderer_ResetViewport(); else MFRenderer_SetViewport(state.pViewport); state.pViewportSet = state.pViewport; } MFCheckForOpenGLError(true); // update the bools 'set' state state.boolsSet = state.bools & state.rsSet[MFSB_CT_Bool]; return 0; }
void Framebuffer::colorMaski(const GLuint buffer, const GLboolean red, const GLboolean green, const GLboolean blue, const GLboolean alpha) { glColorMaski(buffer, red, green, blue, alpha); }
JNIEXPORT void JNICALL Java_org_lwjgl_opengles_GLES32_glColorMaski(JNIEnv *__env, jclass clazz, jint index, jboolean r, jboolean g, jboolean b, jboolean a) { glColorMaskiPROC glColorMaski = (glColorMaskiPROC)tlsGetFunction(333); UNUSED_PARAM(clazz) glColorMaski(index, r, g, b, a); }
void Kinc_G4_Internal_SetPipeline(kinc_g4_pipeline_t *pipeline) { #ifndef KORE_OPENGL_ES Kinc_Internal_ProgramUsesTessellation = pipeline->tessellation_control_shader != NULL; #endif glUseProgram(pipeline->impl.programId); glCheckErrors(); for (int index = 0; index < pipeline->impl.textureCount; ++index) { glUniform1i(pipeline->impl.textureValues[index], index); glCheckErrors(); } if (pipeline->stencil_mode == KINC_G4_COMPARE_ALWAYS && pipeline->stencil_both_pass == KINC_G4_STENCIL_KEEP && pipeline->stencil_depth_fail == KINC_G4_STENCIL_KEEP && pipeline->stencil_fail == KINC_G4_STENCIL_KEEP) { glDisable(GL_STENCIL_TEST); } else { glEnable(GL_STENCIL_TEST); int stencilFunc = Kinc_G4_Internal_StencilFunc(pipeline->stencil_mode); glStencilMask(pipeline->stencil_write_mask); glStencilOp(convertStencilAction(pipeline->stencil_fail), convertStencilAction(pipeline->stencil_depth_fail), convertStencilAction(pipeline->stencil_both_pass)); glStencilFunc(stencilFunc, pipeline->stencil_reference_value, pipeline->stencil_read_mask); } #ifdef KORE_OPENGL_ES glColorMask(pipeline->colorWriteMaskRed[0], pipeline->colorWriteMaskGreen[0], pipeline->colorWriteMaskBlue[0], pipeline->colorWriteMaskAlpha[0]); #else for (int i = 0; i < 8; ++i) glColorMaski(i, pipeline->color_write_mask_red[i], pipeline->color_write_mask_green[i], pipeline->color_write_mask_blue[i], pipeline->color_write_mask_alpha[i]); #endif if (Kinc_Internal_SupportsConservativeRaster) { if (pipeline->conservative_rasterization) { glEnable(0x9346); // GL_CONSERVATIVE_RASTERIZATION_NV } else { glDisable(0x9346); } } glCheckErrors(); /*switch (state) { case Normalize: device->SetRenderState(D3DRS_NORMALIZENORMALS, on ? TRUE : FALSE); break; case BackfaceCulling: if (on) device->SetRenderState(D3DRS_CULLMODE, D3DCULL_CCW); else device->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE); break; case FogState: device->SetRenderState(D3DRS_FOGENABLE, on ? TRUE : FALSE); break; case ScissorTestState: device->SetRenderState(D3DRS_SCISSORTESTENABLE, on ? TRUE : FALSE); break; case AlphaTestState: device->SetRenderState(D3DRS_ALPHATESTENABLE, on ? TRUE : FALSE); device->SetRenderState(D3DRS_ALPHAFUNC, D3DCMP_GREATEREQUAL); break; default: throw Exception(); }*/ if (pipeline->depth_write) { glDepthMask(GL_TRUE); } else { glDepthMask(GL_FALSE); } if (pipeline->depth_mode != KINC_G4_COMPARE_ALWAYS) { glEnable(GL_DEPTH_TEST); } else { glDisable(GL_DEPTH_TEST); } GLenum func = GL_ALWAYS; switch (pipeline->depth_mode) { default: case KINC_G4_COMPARE_ALWAYS: func = GL_ALWAYS; break; case KINC_G4_COMPARE_NEVER: func = GL_NEVER; break; case KINC_G4_COMPARE_EQUAL: func = GL_EQUAL; break; case KINC_G4_COMPARE_NOT_EQUAL: func = GL_NOTEQUAL; break; case KINC_G4_COMPARE_LESS: func = GL_LESS; break; case KINC_G4_COMPARE_LESS_EQUAL: func = GL_LEQUAL; break; case KINC_G4_COMPARE_GREATER: func = GL_GREATER; break; case KINC_G4_COMPARE_GREATER_EQUAL: func = GL_GEQUAL; break; } glDepthFunc(func); glCheckErrors(); switch (pipeline->cull_mode) { case KINC_G4_CULL_CLOCKWISE: glEnable(GL_CULL_FACE); glCullFace(GL_BACK); glCheckErrors(); break; case KINC_G4_CULL_COUNTER_CLOCKWISE: glEnable(GL_CULL_FACE); glCullFace(GL_FRONT); glCheckErrors(); break; case KINC_G4_CULL_NOTHING: glDisable(GL_CULL_FACE); glCheckErrors(); break; default: break; } /*switch (state) { case DepthTestCompare: switch (v) { // TODO: Cmp-Konstanten systemabhaengig abgleichen default: case ZCmp_Always : v = D3DCMP_ALWAYS; break; case ZCmp_Never : v = D3DCMP_NEVER; break; case ZCmp_Equal : v = D3DCMP_EQUAL; break; case ZCmp_NotEqual : v = D3DCMP_NOTEQUAL; break; case ZCmp_Less : v = D3DCMP_LESS; break; case ZCmp_LessEqual : v = D3DCMP_LESSEQUAL; break; case ZCmp_Greater : v = D3DCMP_GREATER; break; case ZCmp_GreaterEqual: v = D3DCMP_GREATEREQUAL; break; } device->SetRenderState(D3DRS_ZFUNC, v); break; case FogTypeState: switch (v) { case LinearFog: device->SetRenderState(D3DRS_FOGVERTEXMODE, D3DFOG_LINEAR); } break; case AlphaReferenceState: device->SetRenderState(D3DRS_ALPHAREF, (DWORD)v); break; default: throw Exception(); }*/ if (pipeline->blend_source != KINC_G4_BLEND_ONE || pipeline->blend_destination != KINC_G4_BLEND_ZERO || pipeline->alpha_blend_source != KINC_G4_BLEND_ONE || pipeline->alpha_blend_destination != KINC_G4_BLEND_ZERO) { glEnable(GL_BLEND); } else { glDisable(GL_BLEND); } // glBlendFunc(convert(pipeline->blendSource), convert(pipeline->blendDestination)); glBlendFuncSeparate(convertBlendingOperation(pipeline->blend_source), convertBlendingOperation(pipeline->blend_destination), convertBlendingOperation(pipeline->alpha_blend_source), convertBlendingOperation(pipeline->alpha_blend_destination)); }