Jump to content
  • Advertisement

sqeezycheese

Member
  • Content Count

    3
  • Joined

  • Last visited

Community Reputation

151 Neutral

About sqeezycheese

  • Rank
    Newbie
  1. sqeezycheese

    unexpected texture aliasing

    As for rendering methods for the quad itself, the various options you mentioned don't seem to make too much of a difference with regards to fixing the problem, but thanks anyway - i now know some more convenient ways to do some rendering to the screen. i did happen to be using gluBuild2DMipmaps in order to create the texture, and after changing the implementation to use glTexImage2D instead, the texture is being rendered without any of the odd aliasing artifacts. Thanks for your input on this. ~Sqeezy
  2. sqeezycheese

    unexpected texture aliasing

    The client area of the window is 640x480, even though i'm creating it with a call to glutInitWindowSize(640,480), so it seems this function doesn't include the title bar and border in the specified size. one thing i did realize though is that the rectangle i'm rendering the texture to isn't actually 640x480, which may be resulting in unnecessary scaling of the texture. I had been using the following code in order to make the rectangle the appropriate size for the screen, when displayed depth units into the screen from the camera. double depth = 1.5; double AR = double(width)/height; double viewangle = camera->getAngle(); double hW = depth*tan(viewangle/2); double hH = (depth/AR)*tan(viewangle/2); printf( "hw: %f\thh: %f\n", hW, hH ); glColor3f(1,1,1); tm->UseTexture(0); glTranslated(0,0,-depth); glBegin( GL_QUADS ); glTexCoord2d(0,0); glVertex3d( -hW, -hH, 0 ); glTexCoord2d(1,0); glVertex3d( hW, -hH, 0 ); glTexCoord2d(1,1); glVertex3d( hW, hH, 0 ); glTexCoord2d(0,1); glVertex3d( -hW, hH, 0 ); glEnd(); glTranslated(0,0,depth); The above code results in a rectangle that's approximately .26x.16, which would be some pretty drastic scaling. To reduce the amount of scaling, I tried converting the code to the following: double depth = 1.5; double AR = double(width)/height; double viewangle = camera->getAngle(); double hW = depth*tan(viewangle/2); double hH = (depth/AR)*tan(viewangle/2); printf( "hw: %f\thh: %f\n", hW, hH ); glColor3f(1,1,1); tm->UseTexture(0); glTranslated(0,0,-depth); glScalef((2*hW)/640,(2*hH)/400,1.0); glBegin( GL_QUADS ); glTexCoord2d(0,0); glVertex3d( -320, -200, 0 ); glTexCoord2d(1,0); glVertex3d( 320, -200, 0 ); glTexCoord2d(1,1); glVertex3d( 320, 200, 0 ); glTexCoord2d(0,1); glVertex3d( -320, 200, 0 ); glEnd(); glTranslated(0,0,depth); However, this change didn't resolve the problem at all, the aliasing still remains. Any possibilities i haven't thought of?
  3. It took me a few tries to figure out some issues with the order in which to call the gl functions for adding texture functionality to my program, and now i've run into a texturing roadblock. The texture i designed is a 640x480 texture, as is the opengl/glut window i'm using and the rectangle(quad) onto which the texture is being mapped. However, when the buffer is output to the screen, the texture becomes aliased such that the 1:1 pixel correspondence is no longer preserved. I've tried using the different glTexParameteri options to try and resolve theis problem, but the changes in the amount of aliasing are minimal (if any different). Short of rendering the screen pixel by pixel, specifying each color manually (which i'd rather avoid doing if possible), how could i overcome this situation?
  • 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!