Skip to main content
GameDev.net gamedev.net
🔒 Locked

Textures

Started by _Jedi_ Apr 22, 2002 at 6:47 AM 11 replies 600+ views
Original Post
_Jedi_
_Jedi_
Hello, I want to load a car picture on to the screen and to move it (2D). I was advised to used textures and quads for this, Thats what I did the only problem is that texture has to be 2^n and my car picture isnt.. so I resized it but now it looks real ugly. Im sure there is a way to use a texture (maybe not texture) so it will be at the size as it is. If anyone knows I would like ot know pleasea. Thanks alot. Advises are welcome too
Maximus
Maximus
Either use an nVidia specific extension, or youll have to resize the image. If you resize the image, youll be stretching it back out to its normal preportions to fit the quad anyway.

-----------------------
"When I have a problem on an Nvidia, I assume that it is my fault. With anyone else''s drivers, I assume it is their fault" - John Carmack
-----------------------"When I have a problem on an Nvidia, I assume that it is my fault. With anyone else's drivers, I assume it is their fault" - John Carmack
_the_phantom_
_the_phantom_
instead of resizing the whole image, just pad the image out to the correct size with one color (one u dont use in your car image) and then on loading the image set the alpha value to all instances of your padded color to 0, thus making it see thought so you can blend the car in the with background

Edit: removed the dumbascii art as I cant be bothered to fix it

[edited by - _the_phantom_ on April 22, 2002 9:35:10 AM]
_Jedi_
_Jedi_
how to do the padding?
ANSI2000
ANSI2000
You can Either use texture coords to center the image on your quad, or center the image in the graphic using photoshop or something...
_Jedi_
_Jedi_
another question
how can i make a quad with the size of texture?
sbennett
sbennett
I would use phantom''s idea, but instead of enable blending, set up the alpha test to remove any fragments with alpha 0. The alpha test is done on a per-fragment basis, earlier in the pipeline, so it''s quicker.
_Jedi_
_Jedi_
quote:
Original post by sbennett
set up the alpha test to remove any fragments with alpha 0


ok how to do that?
_the_phantom_
_the_phantom_
quote:
Original post by sbennett
I would use phantom''s idea, but instead of enable blending, set up the alpha test to remove any fragments with alpha 0. The alpha test is done on a per-fragment basis, earlier in the pipeline, so it''s quicker.


ah, yes, that wasnt me being clear, I tend to think of alpha testing and alpha blending as the same thing, but yes that was what I was thinking
_Jedi_
_Jedi_
thank you all for helping me. the first problem is solved now i just need to know how to create a quad with the size of the texture if i know its (texture''s) width and height
eldee
eldee

glBegin(GL_QUADS);
glVertex2d(0,0);
glVertex2d(width,0);
glVertex2d(width,height);
glVertex2d(0,height);
glEnd();


frankly i dont see what''s so difficult.
perhaps you should read some basic OpenGL tutorials.



-eldee
;another space monkey;
[ Forced Evolution Studios ]

::evolve::

_Jedi_
_Jedi_
quote:
Original post by eldee

glBegin(GL_QUADS);
glVertex2d(0,0);
glVertex2d(width,0);
glVertex2d(width,height);
glVertex2d(0,height);
glEnd();


frankly i dont see what's so difficult.
perhaps you should read some basic OpenGL tutorials.



-eldee
;another space monkey;
[ Forced Evolution Studios ]

::evolve::




well i did that before but then i see a black screen.
i assume it happens because glTexCoord2f() is missing

[edited by - _Jedi_ on April 22, 2002 2:35:58 PM]

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.