FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


OpenGL: enlarge window but still get sharp pixels





Peterssidan
I am trying to make a 2D game in C++ using SDL and OpenGL. The game is 320x200 pixels. Of course I was to expand it so it cover a larger area of the screen. If I resize the window the game area will also be bigger but it seems like OpenGL don't have the behaviour that I want. Problem is that I only want to expand the game to a multiple of the original size. example: 2x: 640x400, 3x: 960x600, 4: 1280x800
That mean one pixel will be translated into 4, 9, 16 (and so on) pixels. A problem is That even if I have some of these sizes OpenGL will try to make it smooth. I don't want that! I want sharp edges on my pixels.

I don't really expect anyone here to have a solution to my problem but if you know what can help please tell me. I have start to think "what if it's not possible", but I don't want to think like that because I believe that OpenGL is powerful and it's probably my tiny knowledge of OpenGL that is the biggest problem.
Peterssidan
I found the solution myself. All I had to do was to set some parameters to GL_NEAREST
Code:
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST);
Related topics
First two chapters [< 3 pg] of Still Life With Woodpecker
Gimp - Sig making:N00b to pro!(finally finished)
weird problem with computer standby
Which is the best Mobile phone
RTCW:Enemy Territory OpenGL Issue
Software programming with Visual Basic (VB) - window shaper
What's New in Pocket Internet Explorer
Final Fantasy Tactics Advance
So I have a sort of stupid hobby.
xp 3d desktop tools
R/C helicopters
How many auto accidents have you had?
a think test
VirtualBox
Reply to topic    Frihost Forum Index -> Scripting -> Others

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.