setting up 2d in opengl

Started by
4 comments, last by vpro 19 years, 10 months ago
hello! how can i set up view in initgl procedure so bitmaps wont be blurred, i want em to be viewed 1:1
Advertisement
When you call glOrtho:

void glOrtho(GLdouble left,
GLdouble right,
GLdouble bottom,
GLdouble top,
GLdouble near,
GLdouble far)



Make sure you have something like:

void glOrtho(0.0,
X_RESOLUTION,
Y_RESOLUTION,
0.0,
-1.0,
1.0);

Where X_RESOLUTION and Y_RESOLUTION are the dimensions of your window in pixels.

This makes it so that each unit in Opengl maps to one pixel.


Oh and this question has been more than sufficiently answered before. Look up above your post, at ViewForumFAQ, it's one of the first questions answered on there.


[edited by - atcdevil on May 29, 2004 8:47:49 AM]
And don''t forget to change your viewport if neccessary with
glViewport().
My HomepageSome shoot to kill, others shoot to mame. I say clear the chamber and let the lord decide. - Reno 911
and I don''t think it is:
void glOrtho(0.0,
X_RESOLUTION,
Y_RESOLUTION,
0.0,
-1.0,
1.0);

but it''s:
void glOrtho(0.0,
X_RESOLUTION,
0.0, //these swap
Y_RESOLUTION, // " "
-1.0,
1.0);

This is because the bottom of the screen is 0 and the top of the screen would be the X_RESOLUTION as u put it.

____________________________________________________________
Programmers Resource Central
____________________________________________________________Programmers Resource Central
quote:Original post by Tera_Dragon
and I don''t think it is:
void glOrtho(0.0,
X_RESOLUTION,
Y_RESOLUTION,
0.0,
-1.0,
1.0);

but it''s:
void glOrtho(0.0,
X_RESOLUTION,
0.0, //these swap
Y_RESOLUTION, // " "
-1.0,
1.0);

This is because the bottom of the screen is 0 and the top of the screen would be the X_RESOLUTION as u put it.

____________________________________________________________
Programmers Resource Central


heh that''s just my preference
"hello! how can i set up view in initgl procedure so bitmaps wont be blurred, i want em to be viewed 1:1 "

the blurring might be caused by the filter settings of your textures, im using 256 maps with tiles and gltexcoords to extract the tiles and i set the magnification filter to GL_NEAREST to get unblurred images.

glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST);

This topic is closed to new replies.

Advertisement