Commit d5952b1f authored by Laszlo Agocs's avatar Laszlo Agocs

Fix msaa option in triquadcube example

parent 0c9d9458
......@@ -119,7 +119,6 @@ QString graphicsApiName()
QRhi::Flags rhiFlags = 0;
int sampleCount = 1;
QRhiSwapChain::Flags scFlags = 0;
void (*preInitFunc)() = nullptr;
class Window : public QWindow
{
......@@ -439,10 +438,17 @@ int main(int argc, char **argv)
qDebug("Selected graphics API is %s", qPrintable(graphicsApiName()));
qDebug("This is a multi-api example, use command line arguments to override:\n%s", qPrintable(cmdLineParser.helpText()));
#ifdef EXAMPLEFW_PREINIT
void preInit();
preInit();
#endif
// OpenGL specifics.
QSurfaceFormat fmt;
fmt.setDepthBufferSize(24);
fmt.setStencilBufferSize(8);
if (sampleCount > 1)
fmt.setSamples(sampleCount);
QSurfaceFormat::setDefaultFormat(fmt);
// Vulkan setup.
......@@ -468,11 +474,6 @@ int main(int argc, char **argv)
}
#endif
#ifdef EXAMPLEFW_PREINIT
void preInit();
preInit();
#endif
// Create and show the window.
Window w;
#if QT_CONFIG(vulkan)
......
......@@ -74,7 +74,6 @@ struct {
QuadRenderer quadRenderer;
TexturedCubeRenderer cubeRenderer;
TriangleOnCubeRenderer liveTexCubeRenderer;
int sampleCount = 1;
bool onScreenOnly = false;
bool triangleOnly = false;
QSize lastOutputSize;
......@@ -114,27 +113,27 @@ void Window::customInit()
#endif
d.triRenderer.setRhi(m_r);
d.triRenderer.setSampleCount(d.sampleCount);
d.triRenderer.setSampleCount(sampleCount);
d.triRenderer.initResources(m_rp);
if (!d.triangleOnly) {
d.triRenderer.setTranslation(QVector3D(0, 0.5f, 0));
d.quadRenderer.setRhi(m_r);
d.quadRenderer.setSampleCount(d.sampleCount);
d.quadRenderer.setSampleCount(sampleCount);
d.quadRenderer.setPipeline(d.triRenderer.pipeline());
d.quadRenderer.initResources(m_rp);
d.quadRenderer.setTranslation(QVector3D(1.5f, -0.5f, 0));
d.cubeRenderer.setRhi(m_r);
d.cubeRenderer.setSampleCount(d.sampleCount);
d.cubeRenderer.setSampleCount(sampleCount);
d.cubeRenderer.initResources(m_rp);
d.cubeRenderer.setTranslation(QVector3D(0, -0.5f, 0));
}
if (!d.onScreenOnly) {
d.liveTexCubeRenderer.setRhi(m_r);
d.liveTexCubeRenderer.setSampleCount(d.sampleCount);
d.liveTexCubeRenderer.setSampleCount(sampleCount);
d.liveTexCubeRenderer.initResources(m_rp);
d.liveTexCubeRenderer.setTranslation(QVector3D(-2.0f, 0, 0));
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment