Jump to content
  • Advertisement
Sign in to follow this  
Ozelo

Help showing textures?

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

As I am a complete beginner, I would like to show textures (In particula, 16x16) like I could see a "clear" distinction between texture pixels. I couldn't find it yet, hope someone can help me out.

I am using this code:


Init:

mytexdata := LoadBMP('tst.bmp');
glGenTextures(1, mytex);
glBindTexture(GL_TEXTURE_2D, mytex);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST);
gluBuild2DMipmaps(GL_TEXTURE_2D, 3, mytexdata.sizeX, mytexdata.sizeY, GL_RGB, GL_UNSIGNED_BYTE, mytexdata.data);
[/quote]

Show:

glEnable(GL_LIGHTING);

glEnable(GL_TEXTURE_2D);
glColor4f(1.0, 1.0, 1.0, 1.0);
glBindTexture(GL_TEXTURE_2D, mytex);
glBegin(GL_QUADS);
glNormal3f( 0.0, 0.0, 1.0);
glTexCoord2f(0.0, 0.0); glVertex3f(-0.5, 19.5, 0.5);
glTexCoord2f(1.0, 0.0); glVertex3f( 0.5, 19.5, 0.5);
glTexCoord2f(1.0, 1.0); glVertex3f( 0.5, 20.5, 0.5);
glTexCoord2f(0.0, 1.0); glVertex3f(-0.5, 20.5, 0.5);
glEnd();
[/quote]



Iv'e attached the results: The picture on left is what I got, the picture on the right side is what I would like to see. Pls, advice. Why it seem so "blur"?

Share this post


Link to post
Share on other sites
Advertisement
(warning I don't use open GL)

You may want to look at the specifics behind your glTexParameteri()

edited for your edit of clarity!

Share this post


Link to post
Share on other sites
I'm still confused. Even a texture size of 2x2 pixels seems to "merge" pixel colors and I would like to see four clearly distinct squares, each one at a discrete color corresponding to that texture pixel.. :( You mean I need to place and apply a specific parameter to get the expected result?

Share this post


Link to post
Share on other sites
YES, Thank you very much! Now I got it! It was kinda giving me a bite on my feets! lol ty ty ty ty

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!