I've searched for this feature today, but I've found nothing.
Thanks for your help
![Smile :)](./images/smilies/icon_smile.gif)
spyro
Code: Select all
/****************************************
draw a pixel by using OpenGl
By Emil Halim
****************************************/
// ViewOrtho,ViewPerspective,Plot are
// parts of MagicLibrary.
#include "windows.h"
#include "gl/gl.h"
#include "gl/glu.h"
#include "gl/glaux.h"
#include "gl/glext.h"
#include <irrlicht.h>
using namespace irr;
using namespace core;
using namespace scene;
using namespace video;
using namespace io;
#pragma comment(lib, "Irrlicht.lib")
#pragma comment(lib,"opengl32.lib")
void ViewOrtho()
{
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_EXT, GL_MODULATE);
glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_ALPHA_EXT, GL_MODULATE);
glDisable(GL_LIGHTING);
glDisable(GL_DEPTH_TEST);
glDisable(GL_CULL_FACE);
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
glOrtho( 0, 640 , 480 , 0, -10, 10 );
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glLoadIdentity();
}
void ViewPerspective()
{
glMatrixMode( GL_PROJECTION );
glPopMatrix();
glMatrixMode( GL_MODELVIEW );
glPopMatrix();
glEnable(GL_DEPTH_TEST);
glEnable(GL_CULL_FACE);
}
void Plot (float x, float y)
{
glBegin(0);
glVertex2f(x,y);
glEnd();
}
int main()
{
IrrlichtDevice *device =
createDevice( video::EDT_OPENGL, dimension2d<s32>(640, 480), 16);
IVideoDriver* driver = device->getVideoDriver();
ISceneManager* smgr = device->getSceneManager();
while(device->run())
{
driver->beginScene(true, true, SColor(255,100,101,140));
ViewOrtho();
/// draw a pixel at 100,200
Plot (100, 200);
ViewPerspective();
smgr->drawAll();
driver->endScene();
}
device->drop();
return 0;
}
Code: Select all
#include "gl/gl.h"
#include <irrlicht.h>
using namespace irr;
using namespace core;
using namespace scene;
using namespace video;
using namespace io;
int main()
{
IrrlichtDevice *device = createDevice(EDT_OPENGL, dimension2d<s32>(800, 600), 16);
IVideoDriver* driver = device->getVideoDriver();
glOrtho( 0, 800 , 600 , 0, -10, 10 );
while(device->run())
{
driver->beginScene(true, true, SColor(0,255,255,255));
glBegin(GL_POINTS);
glColor4f(0,255,0,0);
glVertex2f(10,10);
glEnd();
driver->endScene();
}
device->drop();
return 0;
}
thanks spyrospyro wrote:How can I use glColor4f(red, green, blue, alpha)?
I've tried it, but nothing happened.
Any Ideas?
Here is my current code (thanks to Emil_halim for his example):Code: Select all
glColor4f(0,255,0,0);
Code: Select all
glColor4f(0,255,0,1.0);
Code: Select all
driver->beginScene(true, true, SColor(0,0,0,0));
ViewOrtho();
glBegin(GL_POINTS);
glColor4f(0,255,0,1.0);
glVertex2f(10,10);
glEnd();
ViewPerspective();
smgr->drawAll();
driver->endScene();