Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

vpro

OpenGL setting up 2d in opengl

This topic is 5227 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

hello! how can i set up view in initgl procedure so bitmaps wont be blurred, i want em to be viewed 1:1

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites
And don''t forget to change your viewport if neccessary with
glViewport().

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
"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);

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!