Jump to content
  • Advertisement
Sign in to follow this  
Woltan

OpenGL Unsharp polygons

This topic is 4470 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey guys, once again I rely on your help. This time concerning th sharpnes of polygons in different distances from the camera. As you can see in the picture of the link below, the red circled elements are what my question is about. Why is it, that the line is not realy straight? And why is it impossible to read the font? Everything you see is made out of polygons, the fov is 45. Since I am a real noob with openGL I dont know why OpenGL is doing that to me ; ) Can I somehow change the resolution? or does it has something to do with anti aliasing? Or do I have to go into ortho mode? Any help, hint anything! is greatly appreciated! Oh here the link: http://home.arcor.de/mark.foti/nik/pic.jpg Thanks in advance cherio Woltan

Share this post


Link to post
Share on other sites
Advertisement
If you are using a font texture for the fonts increase the texture resolution. e.g. 128x128 512x512 and see if that helps with the text clarity...

Share this post


Link to post
Share on other sites
the short answer is you can't have a straight diagonal line on a 2D array of pixels. You create the illusion of straightness either by increasing the resolution or doing what's called aliasing which is basically fading pixels at the edges of the line. But even with aliasing, if you zoom to a sufficient resolution, the straightness disappear. Try doing a printscreen of some application with a "straight" diagonal line and copying the image into MSPaint and then zooming in.

For fun and understanding, draw out a 2D grid and try to draw a straight line along a diagonal obeying the rule that a pixel is either on or off.

-me

Share this post


Link to post
Share on other sites
Hey ho,
thanks for your help so far. I have a couple of questions about your comments.

1: Increasing screen resolution
How is this done? Does it have to do with the aspect ratio, or simply with the window size? How would it work in fullscreen mode?

2. Anti Aliasing
How exactly do you do that in OpenGL?
I found a couple of line smoother things in the references like
glEnable(GL_LINE_SMOOTH / GL_POLYGON_SMOOTH);
or
glHint(GL_POLYGON_SMOOTH_HINT, GL_NICEST);
But I am not realy sure if this is anti aliasing.

and @ MARS:
No I am not using a font texture. What I did, I built this image with Anim8or and exported it into a *.c file. All the text and the rest are polygons.

I hope you can help me some more
regards Woltan

Share this post


Link to post
Share on other sites
Quote:
Original post by Woltan
1: Increasing screen resolution
How is this done? Does it have to do with the aspect ratio, or simply with the window size? How would it work in fullscreen mode?


Somewhere in your program, you already have the numbers 800 and 600 which have defined the resolution. Change those to change the resolution. If you want more help than that, tell us what API you're using to create a window (Eg: Win32, SDL, Allegro, etc.).

Share this post


Link to post
Share on other sites
Quote:
Original post by Woltan
2. Anti Aliasing
How exactly do you do that in OpenGL?
I found a couple of line smoother things in the references like
glEnable(GL_LINE_SMOOTH / GL_POLYGON_SMOOTH);
or
glHint(GL_POLYGON_SMOOTH_HINT, GL_NICEST);
But I am not realy sure if this is anti aliasing.


Yes, those are some forms of per-primitive anti-aliasing. It's not commonly used tho. The most commonly used way to do AA is full-scene anti-aliasing via multisampling. Basically your images are (virtually) rendered in a higher resolution and then sampled down. Depending on your driver, there might be an option to force it on - or you can set it via the platform dependant MULTISAMPLE extensions.

Share this post


Link to post
Share on other sites
Quote:
Original post by Ezbez
If you want more help than that, tell us what API you're using to create a window (Eg: Win32, SDL, Allegro, etc.).


I am using Win32.
Somehow I think it is not clear to me what resolution is.
Lets say I have a resizable window. And I change the size by draging the edges. Do I change the resolution with that?
And doe the dmPelsWidth / Hight parameters define the resolution in fullscreen mode?

Quote:
Original post by LtJax
Depending on your driver, there might be an option to force it (anti aliasing) on - or you can set it via the platform dependant MULTISAMPLE extensions.

How exactly is this done? I have never heard of those extensions.

Thanks for your help guys!
cherio Woltan

Share this post


Link to post
Share on other sites
I think your easiest answer is to use textures instead of polygons. There isnt much you can do to polygons except antialias them, but this depends on the graphics card and driver settings on the computer it's running on, which isnt idea.

Using texture mapping, you'll be able to set it that it automatically smooths out your text and lines and it will work on ANY graphics card.

Here is an excellent tutorial on texture mapping:
NeHe Lesson 06

Pay special attention to this line:
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);

it sets the texture up so that it performs Linear interpolation between colours on your texture (ie. antialiasing)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!