Draw a single pixel
Draw a single pixel
Is the drawing of single pixels in Irrlicht possible, when not, how it could be done?
I've searched for this feature today, but I've found nothing.
Thanks for your help
spyro
I've searched for this feature today, but I've found nothing.
Thanks for your help
spyro
Last edited by spyro on Thu Aug 10, 2006 5:16 pm, edited 1 time in total.
My Forum Link
you could always use drawrectangle (think thats the name, never used it) and just make the rectangle be one pixel.
New RF2 website at: http://realityfactory2.sourceforge.net/
but in this way there is a ugly performance! Using OPENGL is certain possible! there was a function, GL_BEGIN(POINT)... or at leas a similar funtion...sorry, i don't remember
excuse me for my bad english and for my ignorance...but I'm 14 and i come from Italy, where the study of english is a optional (-:
share it with us
hey spyro
if you got it workin , share it with us
if you got it workin , share it with us
irrlicht game character project
http://picasaweb.google.com/juliusctw/FinishedArt
http://picasaweb.google.com/juliusctw/FinishedArt
-
- Posts: 518
- Joined: Tue Mar 29, 2005 9:02 pm
- Location: Alex,Egypt
- Contact:
spyro:
you could integrate OpenGl stuff easlly with yor Irrlicht program, so you do not have to rechange the engine.
here is example that showing you how to a point. it is part from Magic Library.
so as you see ,merging opengl is so easy.
hope it help you.
you could integrate OpenGl stuff easlly with yor Irrlicht program, so you do not have to rechange the engine.
here is example that showing you how to a point. it is part from Magic Library.
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;
}
hope it help you.
Magic 2d Library For Irrlicht : http://www.freewebs.com/bcxgl/index.htm
http://www.freewebs.com/bcxdx/index.htm
http://groups.yahoo.com/group/bcxdxc/
http://www.freewebs.com/bcxdx/index.htm
http://groups.yahoo.com/group/bcxdxc/
-
- Admin
- Posts: 14143
- Joined: Wed Apr 19, 2006 9:20 pm
- Location: Oldenburg(Oldb), Germany
- Contact:
Emil, the point is that this will work *ONLY* for OpenGL. Adding a generic point drawing routine would enable the use of any driver. Furthermore you could add several vertices to draw a point cloud in a performant way. Of course you could also add a driver check in the code, but adding an additional method would allow for easy integration with Irrlicht core. I guess that such basic but useful additions could easily make it into the core.
-
- Posts: 518
- Joined: Tue Mar 29, 2005 9:02 pm
- Location: Alex,Egypt
- Contact:
ok hybrid, i got you idea.
but i really donot know how to draw 2D vertices in DirectX,so if anyone knows please post it to make it standard routine and adding it to the core of engine.
but i really donot know how to draw 2D vertices in DirectX,so if anyone knows please post it to make it standard routine and adding it to the core of engine.
Magic 2d Library For Irrlicht : http://www.freewebs.com/bcxgl/index.htm
http://www.freewebs.com/bcxdx/index.htm
http://groups.yahoo.com/group/bcxdxc/
http://www.freewebs.com/bcxdx/index.htm
http://groups.yahoo.com/group/bcxdxc/
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):
I've tried it, but nothing happened.
Any Ideas?
Here is my current code (thanks to Emil_halim for his example):
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;
}
-
- Posts: 518
- Joined: Tue Mar 29, 2005 9:02 pm
- Location: Alex,Egypt
- Contact:
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);
the last parametr is the alpha value try to replace it with the next line
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();
Magic 2d Library For Irrlicht : http://www.freewebs.com/bcxgl/index.htm
http://www.freewebs.com/bcxdx/index.htm
http://groups.yahoo.com/group/bcxdxc/
http://www.freewebs.com/bcxdx/index.htm
http://groups.yahoo.com/group/bcxdxc/