PDA

View Full Version : Draw Texture in Actual Size



Binqay
05-18-2001, 06:41 AM
Hai...I'm really bad in english.I hope this can be understanded.

How can I draw texture in its actual size? I mean if I have 600x800 texture size,I want to draw it perfectly 600x800 in opengl app without distortion/blur/stratch. I want it perfectly like wallpaper.

I've tried pasted it on 800x600 quad, switch to orthographic projection but it still stratched!

How about glReadPixel and glDrawPixel? I've never use it but I know they read from the frame buffer to memory and draw from memory to frame buffer.But how to put the texture to the frame buffer without stretched it? Is the frame buffer reffer to the whole thing that appear on the screen?

Please help.

Korval
05-18-2001, 09:16 AM
Stretch the texture to 1024x1024 and then texture it onto an 800x600 size quad. That should eliminate any distortions. If you want to make sure there are no distortions, don't use bilinear filtering when stretching the texture (in whatever art program you use to stretch it) and don't use filtering in OpenGL to draw it.

Humus
05-18-2001, 11:04 AM
You don't even need to strech it. You could have it at 800x600 and let the rest of the texture up to 1024x1024 be black then use texturecoords (0,0) to (800/1024, 600/1024). With point sampling (GL_NEAREST) you should get a perfect copy, like blitting it in there.

hoshi55
05-18-2001, 12:43 PM
you might encounter a problem with very large textures:
some older cards (voodoo2) canīt handle textures larger than 256x256, that means if you want to be on the safe side, you would need to split your 800x600 texture to several 256x256 (and 32*256 / 256*32 / 32*32) textures and polygonquads of corresponding size.

Binqay
05-22-2001, 05:29 AM
Hai!

I've try to use GL_NEAREST but it's still stretch! OK,here's what the actual problem.I want to put my logo with some text under it at the begining of my app.It's my intro like those game have(their company logo).

Korval,
I've stretch my texture to 1024x1024 and paste it on my 600x600 QUADS but it's still blur especially for text.

Humus,
I've add the rest of the texture up to 1024x1024 and paste on 1024x1024 QUADS,display it on the centre of the screen,but it still blur especially for text.But what do you mean by "use texturecoords (0,0) to (800/1024, 600/1024)"?

What I do now to minimize this problem is to use bitmap font for the text and let the logo remain as texture.But I don't like this way much because the logo is still blur and I don't think the text will be resolution independent.May be the text will be smaller when I run my app in higher resolution.

Can it be something wrong with my texture loader? I use 3D Exploration bmp loader.I also have several type of loader which I found at internet but all of them give the same result.

DaViper
05-22-2001, 05:43 AM
GLint viewport[4]; glGetIntegerv(GL_VIEWPORT, viewport);
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
gluOrtho2D(0.0, (GLfloat)(viewport[2] - viewport[0]),
0.0, (GLfloat)(viewport[3] - viewport[1]));
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glLoadIdentity();

glTexCoord2d(0.0,0.0);
glVertex2d(viewport[2]-400,viewport[3]-300);
glTexCoord2d(0.0,(double)600/1034);
glVertex2d(viewport[2]-400,viewport[3]+300);
.
.
.
.


That should do the trick for u

Chris

Binqay
05-26-2001, 05:03 AM
Hai...

I've try everything what you guys told. After many days, I still can't do what I want.

But this morning, I found that maybe the problem occurs because of my 3D card or texture loader function. If I use 1024x1024 and 512x512 texture, both of them give the same quality!

So, do you know what's in my mind? I think the big texture is shrinked to 512x512 before stored in memory! Thats why I can't have a perfect copy of texture for 800x600!

So I split it into several 256x256 manualy using paint brush, tiled it and lastly, I have a perfect copy. http://www.opengl.org/discussion_boards/ubb/smile.gif

So, I make a conclusion. My Vodoo3 2000 can't handle large texture(above 256x256) perfectly. If I want to use something larger than that, I've to split it.

So, if anybody has any opinion, agree or disagree, or can load large texture perfectly using the same card as me, please let me know.

P/S: Sorry for so many "so" http://www.opengl.org/discussion_boards/ubb/smile.gif