Hello,
Is it possible to create pixel perfect images in OpenGL?
What I mean:
- one sets a graphic mode eg: 320,200
- one creates a quad the same size as an image
- one applies a texture [from this image] to the quad
Somehow, I'm unable to create one.
There is always some fuzzyness at the end in my image..
Some code:
It must be possible - Max2d creates them.. But how?
Ghislain
Is it possible to create pixel perfect images in OpenGL?
What I mean:
- one sets a graphic mode eg: 320,200
- one creates a quad the same size as an image
- one applies a texture [from this image] to the quad
Somehow, I'm unable to create one.
There is always some fuzzyness at the end in my image..
Some code:
Strict Local c_width:Int = 320 Local c_height:Int = 200 GLGraphics c_width, c_height ', 16 glviewport (0,0, c_width, c_height) ' origin of avbl screen + width & height glmatrixmode (gl_projection) ' modelview, projection or texture matrix glloadidentity () ' set 4x4 identity matrix gluortho2d (0, c_width, c_height, 0) ' creates a matrix for projecting 2d coordinates glclear(gl_color_buffer_bit) glmatrixmode (gl_modelview) glLoadidentity () Local pmap:TPixmap = LoadPixmap ("mapkansas.bmp") Local texInt:Int = GLTexFromPixmap (pmap, False) glBindTexture (gl_texture_2d, texInt ) glTexParameteri GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST glTexParameteri GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST Local w:Float = PixmapWidth (pmap) - 1 Local h:Float = PixmapHeight (pmap) - 1 glEnable (gl_texture_2d) ' glTranslatef(0.375, 0.375, 0.0) glBegin (gl_quads) ' TL glTexCoord2f 0.0, 0.0 glvertex2f 0.0, 0.0 ' TR glTexCoord2f 1.0, 0.0 glVertex2f w, 0.0 ' BR glTexCoord2f 1.0, 1.0 glVertex2f w, h ' BL glTexCoord2f 0.0, 1.0 glVertex2f 0.0, h glEnd Flip WaitKey() End
It must be possible - Max2d creates them.. But how?
Ghislain