OpenGL Main Loop [SOLVED]
Posted: Wed Apr 04, 2012 4:47 am
Just curious, is there a way to use the OpenGL render function for drawing (Quads, Triangle Fans, etc...)?
Official forum of the Irrlicht Engine
https://irrlicht.sourceforge.io/forum/
Code: Select all
float size=100;
float verts[4][3]=
{
{-size,size,0},
{size,size,0},
{size,-size,0},
{-size,-size,0}
};
unsigned int prims[4]=
{
0,1,2,3
};
Code: Select all
irr::video::SMaterial material;
material.BackfaceCulling=false;
material.EmissiveColor.set(0xffFFff);
device->getVideoDriver()->setMaterial(material);
device->getVideoDriver()->setTransform(irr::video::ETS_WORLD,irr::core::matrix4());
device->getVideoDriver()->drawVertexPrimitiveList(verts,12,prims,4,irr::video::EVT_STANDARD,irr::scene::EPT_QUADS);
Code: Select all
float size=100;
irr::video::S3DVertex verts[4]=
{
irr::video::S3DVertex(-size, size,0, 0,0,1, irr::video::SColor(255,0,0,0),0,0),
irr::video::S3DVertex( size, size,0, 0,0,1, irr::video::SColor(255,0,0,0),0,0),
irr::video::S3DVertex( size,-size,0, 0,0,1, irr::video::SColor(255,0,0,0),0,0),
irr::video::S3DVertex(-size,-size,0, 0,0,1, irr::video::SColor(255,0,0,0),0,0),
};
Code: Select all
device->getVideoDriver()->beginScene(true,true,irr::video::SColor(255,100,101,140));
irr::video::SMaterial material;
material.BackfaceCulling=false;
material.EmissiveColor.set(0xffFFff);
device->getVideoDriver()->setMaterial(material);
device->getVideoDriver()->setTransform(irr::video::ETS_WORLD,irr::core::matrix4());
device->getVideoDriver()->drawVertexPrimitiveList(verts,4,prims,4,irr::video::EVT_STANDARD,irr::scene::EPT_QUADS);
device->getSceneManager()->drawAll();
device->getVideoDriver()->endScene();
Code: Select all
device->getVideoDriver()->beginScene(true,true,irr::video::SColor(255,100,101,140));
glDisable(GL_CULL_FACE);
glBegin(GL_QUADS);
float size=100;
glVertex3f(-size,size,0);
glVertex3f(size,size,0);
glVertex3f(size,-size,0);
glVertex3f(-size,-size,0);
glEnd();
device->getSceneManager()->drawAll();
device->getVideoDriver()->endScene();
Code: Select all
short prims[8]=
{
0,1,2,3,
4,5,6,7
};
float size=10;
S3DVertex verts[8]=
{
S3DVertex(-size, size,0, 0,0,0,SColor(255,255,0,0),0,1),
S3DVertex( size, size,0, 0,0,0,SColor(255,0,255,0),1,1),
S3DVertex( size,-size,0, 0,0,0,SColor(255,0,255,0),1,0),
S3DVertex(-size,-size,0, 0,0,0,SColor(255,255,0,0),0,0),
S3DVertex(-size,0, size, 0,0,0,SColor(255,255,255,255),0,1),
S3DVertex( size,0, size, 0,0,0,SColor(255,255,255,255),1,1),
S3DVertex( size,0,-size, 0,0,0,SColor(255,255,255,255),1,0),
S3DVertex(-size,0,-size, 0,0,0,SColor(255,255,255,255),0,0),
};
Code: Select all
irr::video::SMaterial material;
material.BackfaceCulling=false;
material.Lighting=false;
material.EmissiveColor.set(0xffFFff);
device->getVideoDriver()->setMaterial(material);
device->getVideoDriver()->setTransform(irr::video::ETS_WORLD,irr::core::matrix4());
device->getVideoDriver()->drawVertexPrimitiveList(verts,8,prims,2,irr::video::EVT_STANDARD,irr::scene::EPT_QUADS,irr::video::EIT_16BIT);