이 페이지에서

Qt3DRender::QMultiSampleAntiAliasing Class

class Qt3DRender::QMultiSampleAntiAliasing

다중 샘플 앤티앨리어싱을 활성화합니다. 더 보기...

헤더: #include <qmultisampleantialiasing.h>
CMake: find_package(Qt6 REQUIRED COMPONENTS 3drender)
target_link_libraries(mytarget PRIVATE Qt6::3drender)
qmake: QT += 3drender
QML에서: MultiSampleAntiAliasing
상속: Qt3DRender::QRenderState
상태: 사용 중단됨

이 클래스는 더 이상 사용되지 않습니다. 새로운 코드에서는 이 클래스를 사용하지 않는 것을 강력히 권장합니다.

공개 함수

QMultiSampleAntiAliasing(Qt3DCore::QNode *parent = nullptr)

상세 설명

Qt3DRender::QMultiSampleAntiAliasing 클래스는 멀티샘플 앤티앨리어싱을 지원합니다.

QRenderPass::addRenderState()를 호출하여 QRenderPass 에 추가할 수 있습니다.

QRenderPass *renderPass = new QRenderPass();

QMultiSampleAntiAliasing *msaa = new QMultiSampleAntiAliasing();
renderPass->addRenderState(msaa);

또는 QRenderStateSet::addRenderState()를 호출하여 QRenderStateSet 에 추가할 수 있습니다:

QRenderStateSet *renderStateSet = new QRenderStateSet();

QMultiSampleAntiAliasing *msaa = new QMultiSampleAntiAliasing();
renderStateSet->addRenderState(msaa);

멀티샘플링이 적용되려면 렌더 타겟이 멀티샘플링이 활성화된 상태로 할당되어야 합니다:

QTexture2DMultisample *colorTex = new QTexture2DMultisample;
colorTex->setFormat(QAbstractTexture::RGBA8_UNorm);
colorTex->setWidth(1024);
colorTex->setHeight(1024);

QRenderTargetOutput *color = new QRenderTargetOutput;
color->setAttachmentPoint(QRenderTargetOutput::Color0);
color->setTexture(colorTex);

QTexture2DMultisample *depthStencilTex = new QTexture2DMultisample;
depthStencilTex->setFormat(QAbstractTexture::RGBA8_UNorm);
depthStencilTex->setWidth(1024);
depthStencilTex->setHeight(1024);

QRenderTargetOutput *depthStencil = new QRenderTargetOutput;
depthStencil->setAttachmentPoint(QRenderTargetOutput::DepthStencil);
depthStencil->setTexture(depthStencilTex);

Qt3DRender::QRenderTarget *renderTarget = new Qt3DRender::QRenderTarget;
renderTarget->addOutput(color);
renderTarget->addOutput(depthStencil);

또한, 셰이더 코드에서는 texture() 대신 멀티샘플링 샘플러 유형과 texelFetch()를 사용해야 합니다.

예를 들어, 다음과 같은 코드가 있다면

#version 150

uniform sampler2D colorTexture;
in vec2 texCoord;
out vec4 fragColor;

void main()
{
    fragColor = texture(colorTexture, texCoord);
}

다음과 같이 재작성할 수 있습니다.

#version 150

uniform sampler2DMS colorTexture;
in vec2 texCoord;
out vec4 fragColor;

void main()
{
    ivec2 tc = ivec2(floor(textureSize(colorTexture) * texCoord));
    vec4 c = texelFetch(colorTexture, tc, 0) +
                texelFetch(colorTexture, tc, 1) +
                texelFetch(colorTexture, tc, 2) +
                texelFetch(colorTexture, tc, 3);
    fragColor = c / 4.0;
}

참고: OpenGL을 그래픽 API로 사용하는경우 , QMultiSampleAntiAliasing이 렌더링 상태에 추가되면 glEnable(GL_MULTISAMPLE)이 호출됩니다.

멤버 함수 문서

[explicit] QMultiSampleAntiAliasing::QMultiSampleAntiAliasing(Qt3DCore::QNode *parent = nullptr)

이 생성자는 지정된 parent 를 사용하여 새로운 QMultiSampleAntiAliasing::QMultiSampleAntiAliasing 인스턴스를 생성합니다.

© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.