MCPcopy Create free account
hub / github.com/OneLoneCoder/olcPixelGameEngine / DoGPUTask

Method DoGPUTask

olcPixelGameEngine.h:5570–5673  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5568 }
5569
5570 void DoGPUTask(const olc::GPUTask& task) override
5571 {
5572 SetDecalMode(task.mode);
5573
5574 if (task.decal == nullptr)
5575 glBindTexture(GL_TEXTURE_2D, 0);
5576 else
5577 glBindTexture(GL_TEXTURE_2D, task.decal->id);
5578
5579 glMatrixMode(GL_PROJECTION);
5580 glPushMatrix();
5581
5582 glMatrixMode(GL_MODELVIEW);
5583 glPushMatrix();
5584
5585 if (task.cull == olc::CullMode::NONE)
5586 {
5587 glCullFace(GL_FRONT);
5588 glDisable(GL_CULL_FACE);
5589 }
5590 else if (task.cull == olc::CullMode::CW)
5591 {
5592 glCullFace(GL_FRONT);
5593 glEnable(GL_CULL_FACE);
5594 }
5595 else if (task.cull == olc::CullMode::CCW)
5596 {
5597 glCullFace(GL_BACK);
5598 glEnable(GL_CULL_FACE);
5599 }
5600
5601 if (task.depth)
5602 {
5603 glEnable(GL_DEPTH_TEST);
5604
5605 glMatrixMode(GL_PROJECTION);
5606 glLoadMatrixf(matProjection.data());
5607
5608 glMatrixMode(GL_MODELVIEW);
5609 glLoadMatrixf(task.mvp.data());
5610 }
5611 else
5612 {
5613 glMatrixMode(GL_PROJECTION);
5614 glLoadIdentity();
5615
5616 glMatrixMode(GL_MODELVIEW);
5617 glLoadIdentity();
5618
5619 }
5620
5621 if (nDecalMode == DecalMode::WIREFRAME)
5622 glBegin(GL_LINE_LOOP);
5623 else
5624 {
5625 if (task.structure == olc::DecalStructure::FAN)
5626 glBegin(GL_TRIANGLE_FAN);
5627 else if (task.structure == olc::DecalStructure::STRIP)

Callers 2

olc_CoreUpdateMethod · 0.45

Calls 2

SetDecalModeFunction · 0.85
sizeMethod · 0.45

Tested by

no test coverage detected