• FEATURED

View more

View more

View more

### Image of the Day Submit

IOTD | Top Screenshots

### The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.

# Texture area selecting in openGL

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

4 replies to this topic

### #1kolpo  Members

Posted 01 January 2000 - 10:47 PM

Is there a similar command to glTexCoord2d that determinate wich area of the bitmap is used as texture ? The current problem is that I use small quads to create realistic lighting but I have high res textures.

### #2logistix  Members

Posted 02 January 2000 - 05:52 AM

If I''m following you, can''t you just multiply the texture''s width and height by the T and S parameters passed to glTexCoord?

Do that with each set of parameters and you''ll have the (approximate) area of the bitmap being used(since texels have integer locations, not fp).

### #3Enigm@  Members

Posted 02 January 2000 - 10:15 AM

glTexSubImage2D(...)

### #4JD  Members

Posted 03 January 2000 - 04:53 PM

I don't know if this is what you're looking for but what I've done in OpenGL was to create a single wall 10 by 10 feet in dimensions and draw this wall 10 times to create one long side of a room. I've also wrote a tesselation algorithm to help me split one 10x10 wall into smaller quads exactly 10 horizontally and 10 vertically for dynamic lighting purposes. I gave the inside quads texture coords values that were 1/10th of the length of the wall. So the first bottom left quad's text.coords look like this:

Bottom left 0,0
Top left 0,0.10
Top right 0.10,0.10
Bottom right 0.10,0

The quad next to this one was:

Bottom left 0.10,0
Top left 0.10,0.10
Top right 0.20,0.10
Bottom right 0.20,0

Bottom left 0.20,0
Top left 0.20,0.10
Top right 0.30,0.10
Bottom right 0.30,0

And this continued across horizontally and vertically. If you don't care about tesselation, then create one long wall 100 feet long 10 feet high out of one quad and give the bottom left texture coord a value of 0,0 top left a value of 0,1 bottom right is 10,0 and top right is 10,1. This will tile the bitmap ten times in the horizontal direction and one time in vertical direction, which I did in D3D except there I created the wall out of 2 triangles (triangle strip) for the lack of quad support in that api. Hope this will give you some ideas.

Edited by - JD on 1/3/00 11:00:12 PM

### #5kolpo  Members

Posted 04 January 2000 - 10:54 AM

With glTexCoord2d is it indeed easy. The raison of my misunderstanding is that I thought that the values of glValue where boolean values: 0 or 1 but they are normal floating points.

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.