Fuzzy GUI picture/colorkey?

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
Guest

Fuzzy GUI picture/colorkey?

Post by Guest »

i have 2 problems:

1. the gui picture that i made looks fuzzy in irrlicht (iam using opengl mode), any suggestions how to fix this? ive read much about it but not how to fix this problem.

2. how can i make some sort of makeColorKey for gui images? it seems that they dont have something like this.

i uploaded 2 pictures showing the 2 problems:

problem
Image

what it should look like
Image

i hope you can help me :)

edit: the gui isnt final, elements are missing, the colors are too hard and some sentences are wrong because iam german, and its a little big, but i already have another gui, but i dont know which one i should use, they both arent looking so bad 8)
Robomaniac
Posts: 602
Joined: Sat Aug 23, 2003 2:03 am
Location: Pottstown, PA
Contact:

Post by Robomaniac »

Just to let you know

Personal should be Personnel :)

I had the same problems w/ OpenGL too, i think its an internal implementation problem
The Robomaniac
Project Head / Lead Programmer
Centaur Force
Guest

Post by Guest »

ok i changed the "personal" thing to personnel :)

and i even got the UI to work ( i had to cut it into 3 pieces and then set them separately as GUI image, otherwise it wont work for me, but its looking good)

maybe i should use addStaticText for the text lines instead of painting them on the GUI picture? because then it wouldnt be blurry and i could may change it faster if i wanted to :) just a thought.
Guest

Post by Guest »

WTF IS THAT ??? if i disable anisotropic filtering the whole text gets totally blurry and no human beeing could read that stuff!! if i set anisotropic filtering to 8x mode, it looks perfectly! common there must be a way to solve this, or do i really have to buy microsofts visual studio for this???
bal
Posts: 829
Joined: Fri Jun 18, 2004 5:19 pm
Location: Geluwe, Belgium

Post by bal »

Can't you load it as seperate images (top part and bottom part)? This would also make it resolution-independant...
General Tools List
General FAQ
System: AMD Barton 2600+, 512MB, 9600XT 256MB, WinXP + FC3
Tyn
Posts: 932
Joined: Thu Nov 20, 2003 7:53 pm
Location: England
Contact:

Post by Tyn »

Using IGUIImage by any chance? Had same problem, for some unknown reason it doesn't support alphablending. Try the patch here, it is what I am using the following changes to the engine ( fix by zola ):

IGUIImage.h

Code: Select all


// Copyright (C) 2002-2004 Nikolaus Gebhardt 
// This file is part of the "Irrlicht Engine". 
// For conditions of distribution and use, see copyright notice in Irrlicht.h 
  
#ifndef __I_GUI_IMAGE_H_INCLUDED__ 
#define __I_GUI_IMAGE_H_INCLUDED__ 

#include "IGUIElement.h" 
#include "ITexture.h" 
#include "SColor.h" 

namespace irr 
{ 
namespace gui 
{ 

   //! GUI element displaying an image. 
   class IGUIImage : public IGUIElement 
   { 
   protected: 
       
      bool alphablend; 
       
      video::SColor image_color; 

   public: 

      //! constructor 
      IGUIImage(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle) 
         : IGUIElement(environment, parent, id, rectangle) 
      { 
         image_color=video::SColor(255,255,255,255); 
         alphablend=false; 
      } 

      //! destructor 
      ~IGUIImage() {}; 

      //! sets an image 
      virtual void setImage(video::ITexture* image) = 0; 

      // set alphablending for the gui image 
      virtual void setAlphaBlend(bool enable) 
      { 
         alphablend=enable; 
      } 

      // set color for the gui image 
      virtual void setColor(const video::SColor& c) 
      { 
         image_color=c; 
      } 


   }; 


} // end namespace gui 
} // end namespace irr 

#endif 

--------------------------------------------------------------------------------




CGUIImage.cpp

Code: Select all

//! draws the element and its children 
void CGUIImage::draw() 
{ 
   if (!IsVisible) 
      return; 

   IGUISkin* skin = Environment->getSkin(); 
   irr::video::IVideoDriver* driver = Environment->getVideoDriver(); 

   core::rect<s32> rect = AbsoluteRect; 

   if (Texture) 
   { 
      driver->draw2DImage(Texture, AbsoluteRect.UpperLeftCorner, 
         core::rect<s32>(core::position2d<s32>(0,0), Texture->getOriginalSize()), 
         &AbsoluteClippingRect, image_color,alphablend); 
   } 
   else 
   { 
      // maybe this would also be a good idea then 
      // driver->draw2DRectangle(image_color, AbsoluteRect, &AbsoluteClippingRect); 
      driver->draw2DRectangle(skin->getColor(EGDC_3D_DARK_SHADOW), AbsoluteRect, &AbsoluteClippingRect); 
   } 

   IGUIElement::draw(); 
} 
Guest

Post by Guest »

im not sure which method you used for your HUD, but personally i used draw2dimage.
this is fuzzy(blurred) in opnegl(but fine in software) by default, but easily solved but disabling mipmapping on the HUD texture(frankly not a problem since mipmapping is of little interest to such a display).



hmm maybe i should register with this forum...

will do i guess, but since ive already typed this, ill just sign.

Gwalahad
dingo
Posts: 95
Joined: Tue Mar 09, 2004 5:02 am
Location: Brisbane, Australia
Contact:

Post by dingo »

I think it has to do with the fact OGL is mipmapping the HUD. Turn off mipmapping and see if that fixes it. Also maybe draw the HUD is 2D and use a scissor test to apply it to the scene.

Also make sure your HUD is 1:1 for each pixel in the framebuffer. (or use an resolution independent solution)

Ansioscopic filtering works because it is sharpening up the fuzzy mip mapped image.

I think there are also plenty of threads here if you search on the topic "logo" or something similar
-= Want your C code to control real life robots? www.users.on.net/~symes =-
Post Reply