Sign in to follow this  

texturing problem

This topic is 4303 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I draw two textured quads(1d texturing ) with tex coords shown below. My assumption ws that the quads will be colored as mirror images of each .. thats how i have specified the tex coords. But it does not happed so. Have a look at it here OGL_TEX_PROB 0_1 |_| 0 0 1_0 |_| 0 0 sorry for the real bad diagram . hope it suffices The quads are drwan with counter clockwise winding with the bottom left vertex first. Shouldnt the coloring produced for the two quads be mirror images of each other ???? [Edited by - _gl_coder_one_ on March 6, 2006 1:24:36 PM]

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
OK, the description of the problem is kind of fuzzy and empty and I'm a bit slow at understanding what other ppl mean. You could say what you expected to happen there. ;)
But anyway, if what is going on is that you wanted a smooth transition between the colors (just a guess.. very vague) then you should set linear filtering to the texture.

Share this post


Link to post
Share on other sites
Okay
I hope the following diagrams make it easier to understand.

sorry the dia looks bad here ... its basically a square with the tex coords specified at the vertices . Please look at the link below for a better pic

The top right image of the page is drawn with texx coords as below :

0 ____ 1
|        |
|        |
|        |
|____|
0     0

The bottom right image is draw as follows
1____ 0
|        |
|        |
|        |
|____|
0     0

The quads are drwan with counter clockwise winding with the bottom left vertex first.

Shouldnt the coloring produced for the two quads be mirror images of each other ????
I have put up a fresh image please hav a look
tex_prob

Share this post


Link to post
Share on other sites
please post the code for drawing the quads and textures. in theory it should look something like this

p.s. bear in mind i'm a Visual Basic programmer not C/C++ so you're code will probs look a little different

glbegin bmquads ' First Quad
gltexcoord2f 0f,0f: glvertex3f 0f,0f,0f
gltexcoord2f 0f,1f: glvertex3f 0f,1f,0f
gltexcoord2f 1f,0f: glvertex3f 1f,0f,0f
gltexcoord2f 1f,1f: glvertex3f 1f,1f,0f
glend

glbegin bmquads ' Second Quad
gltexcoord2f 1f,0f: glvertex3f 0f,0f,0f
gltexcoord2f 1f,1f: glvertex3f 0f,1f,0f
gltexcoord2f 0f,0f: glvertex3f 1f,0f,0f
gltexcoord2f 0f,1f: glvertex3f 1f,1f,0f
glend

Remember to bind the right texture and set the correct filtering. In theory this should give you an image that I believe you are trying to get.

Share this post


Link to post
Share on other sites
The problem you're encountering is that there's no such thing as a quad for your computer, that square is actualy 2 triangles together!

It's not like this:

x---x
|....|
|....|
x---x

It's like this:

x---x
|.\.1|
|2.\.|
x---x

(my ASCII art sucks)

So, if you look at the 2nd triangle on your first quad you'll notice that all it's vertices have texture coordinate 0, while on the second quad that same triangle has one vertex with tex. coord. 1 and two others with 0.

Oh yeah, and the solution is what AndyEsser said. If you're drawing that quad like:
Vertex1 - Vertex2 - Vertex3 - Vertex4
then you can reverse the triangles division drawing like:
Vertex3 - Vertex4 - Vertex1 - Vertex2

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
you should use the texture matrix to do this.
It is used in the same way as the modelview and projection matrix


you may not do this



0 1
x----x
| |
| |
x----x
0 0

or

0 1
x----x
| |
| |
x----x
1 0


you must always do

0 1
x----x
| |
| |
x----x
0 1

or

1 1
x----x
| |
| |
x----x
0 0




and if it doesnt work that way, use the texture matrix

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
sorry for the wrong drawing

dont do this

0      1
x----x
|      |
|      |
x----x
0      0

or

0      1
x----x
|      |
|      |
x----x
1      0


you must always do

0      1
x----x
|      |
|      |
x----x
0      1

or

1      1
x----x
|      |
|      |
x----x
0      0




Share this post


Link to post
Share on other sites
assiging tex coords like that is not possible as the tex coords are generated procedurally ... and checkin for that particular case would be not right ... i posted the same problem at the opengl.org forum and found out that such a thing is s problem due to the way he quad is rendered and that a fragment shader can be used to change the way the texturing happens .. u can have a llok at the post here ,,,

OPENGL

Share this post


Link to post
Share on other sites

This topic is 4303 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this