Quad primitive?
Posted: Mon Mar 12, 2007 4:34 pm
Is there any way to draw a quad primitive in 2D space in Irrlicht? The thing is that I want to use an RTT texture and overlay it over the entire screen so I can create some nice effects.
Official forum of the Irrlicht Engine
https://irrlicht.sourceforge.io/forum/
Code: Select all
Index: include/IGUIImage.h
===================================================================
--- include/IGUIImage.h (revision 543)
+++ include/IGUIImage.h (working copy)
@@ -28,6 +28,8 @@
//! sets an image
virtual void setImage(video::ITexture* image) = 0;
+ virtual void setColor(video::SColor& color) = 0;
+
//! sets if the image should use its alpha channel to draw itself
virtual void setUseAlphaChannel(bool use) = 0;
};
Index: source/Irrlicht/CD3D9ParallaxMapRenderer.cpp
===================================================================
--- source/Irrlicht/CD3D9ParallaxMapRenderer.cpp (revision 543)
+++ source/Irrlicht/CD3D9ParallaxMapRenderer.cpp (working copy)
@@ -383,7 +383,7 @@
services->setVertexShaderConstant(c96, 96, 1);
// set scale factor
- f32 factor = 0.02f; // default value
+ f32 factor = 0.02f; // default value
if (CurrentScale != 0)
factor = CurrentScale;
Index: source/Irrlicht/CGUIImage.cpp
===================================================================
--- source/Irrlicht/CGUIImage.cpp (revision 543)
+++ source/Irrlicht/CGUIImage.cpp (working copy)
@@ -16,7 +16,7 @@
//! constructor
CGUIImage::CGUIImage(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle)
-: IGUIImage(environment, parent, id, rectangle), Texture(0), UseAlphaChannel(false)
+: IGUIImage(environment, parent, id, rectangle), Texture(0), UseAlphaChannel(false), Color(255,255,255,255)
{
#ifdef _DEBUG
setDebugName("CGUIImage");
@@ -46,6 +46,11 @@
Texture->grab();
}
+//! sets the color of the image
+void CGUIImage::setColor(video::SColor &color)
+{
+ Color = color;
+}
//! draws the element and its children
@@ -62,7 +67,7 @@
if (Texture)
driver->draw2DImage(Texture, AbsoluteRect.UpperLeftCorner,
core::rect<s32>(core::position2d<s32>(0,0), Texture->getOriginalSize()),
- &AbsoluteClippingRect, video::SColor(255,255,255,255), UseAlphaChannel);
+ &AbsoluteClippingRect, Color, UseAlphaChannel);
else
driver->draw2DRectangle(skin->getColor(EGDC_3D_DARK_SHADOW), AbsoluteRect, &AbsoluteClippingRect);
Index: source/Irrlicht/CGUIImage.h
===================================================================
--- source/Irrlicht/CGUIImage.h (revision 543)
+++ source/Irrlicht/CGUIImage.h (working copy)
@@ -25,6 +25,9 @@
//! sets an image
virtual void setImage(video::ITexture* image);
+ //! sets the color of the image
+ void setColor(video::SColor &color);
+
//! draws the element and its children
virtual void draw();
@@ -39,7 +42,7 @@
private:
-
+ video::SColor Color;
video::ITexture* Texture;
bool UseAlphaChannel;
Felt like something that should have worked, but I see nothing.. seems like the texture parameter does nothing... Also, it is not possible to set any form of blending on the drawn image. I'd need that to be able to make the effects I am looking for.hybrid wrote:Please do read this:
http://irrlicht.sourceforge.net/docu/cl ... river.html
and watch for 2D methods. You'll find lots of color parameters there, too.