Skip to main content
gamedev.net
🔒 Locked

Texture Question

Started by Mad_Koder Sep 15, 2006 at 5:12 PM 3 replies 1.1k views
Original Post
Mad_Koder
Mad_Koder
I dont understand something about textures, maby you guys can help. Say I wanted to have the same size squares on the screen with each of its own texture (I three textures in all -tex1,tex2,tex3- , how when I call i make it so i can have multiple quads and have em have different textures and have knows which texture object to use for that one , do i call the drawrect1 ...2 ...3 in the init() function so it can call what texture to use localy and then draw the square to which the texture is attached to. Like so..... void Initialize() { .... glEnable(GL_TEXTURE_2D); bitmapdata1 = LoadBitmapFile("tex1.bmp"), &bitmapinfoheader glGenTexture(1, &tex1) glBitmap(GL_TEXTURE_2D, texture); ...... drawtex1(); .... } and do the same for tex2 and tex 3 in the func? thanks a bunch. ~Mad_Koder
Dont need one.... i'm so cool, dont ask me just do what you do..... meet me in the trap its going down....
Mad_Koder
Mad_Koder
What I m simply asking is how do you have several quads and have each have different textures?
Dont need one.... i'm so cool, dont ask me just do what you do..... meet me in the trap its going down....
_neutrin0_
_neutrin0_
You need to bind the texture first for each quad using
glBindTexture

Then you need to map the UVs for the texture using
glTexCoord2f

draw quad1

bind a new texture
map uvs

draw quad 2

check this out.
++ My::Game ++
Mad_Koder
Mad_Koder
but when u have to functions that draw to different cubes like in the nehe example, how does it know which texture goes on that one? ( how does it know that you want bunnies.bmp to go on the first cube and osama.bmp to go on the second cube?)
Dont need one.... i'm so cool, dont ask me just do what you do..... meet me in the trap its going down....
_neutrin0_
_neutrin0_
GLuint TexIDBunny;
GLuint TexIDOsama;

glGenTexture(1, &TexIDBunny);
glBindTexture(GL_TEXTURE_2D,TexIDBunny);
.... Load bunny texture .....

glGenTexture(1, &TexIDOsama);
glBindTexture(GL_TEXTURE_2D,TexIDOsama);
.... Load Osama texture .....

.....
... code ...


glBindTexture(GL_TEXTURE_2D,TexIDBunny);
... Draw quads with Bunny ...
...
...
glBindTexture(GL_TEXTURE_2D,TexIDOsama);
... Draw quads with Osama ...
++ My::Game ++

Topic Locked

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

Sign in to reply to this topic.