General Texture Question....

Member
Posts: 321
Joined: 2004.10
Post: #1
Not looking for details, but just a nudge in the general direction:

I've got a complex shaped object which is in reality a
512x512 texel RGBA texture. There is a pattern "painted"
on the complex geometric shaped and the alpha (transparency)
is set to everything that is not the complex geometric object.


Using texture coordinates of [0,1] and object coordinates of [0,10],
I then resize the object. Make it bigger.

The overall dimensions of the object are now correct (for my game), but
obviously the "painted" pattern is now blown up and looks unnatural at
this new scale.

Is there some technique I can use to rectify this cosmetic problem?

I don't suppose there is a method of repeating a texture of a pattern
onto a complex geometric object?

Thanks.
Quote this message in a reply
Moderator
Posts: 133
Joined: 2008.05
Post: #2
When you set up your texture's, you can do something like this:
Code:
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);

Then try using different numbers for your texture coordinates, for example, if you blew up the polygon by 2x, try using 2, or .5, I can't really remember. You'll learn better just by playing with it anyway.
Quote this message in a reply
Moderator
Posts: 529
Joined: 2003.03
Post: #3
If the texture is set to repeat and you give it a u or v greater than 1, it should tile the texture.

"Yes, well, that's the sort of blinkered, Philistine pig-ignorance I've come to expect from you non-creative garbage."
Quote this message in a reply
Member
Posts: 321
Joined: 2004.10
Post: #4
Wow, is it that simple. I thought that repeating pattern would simply
give me a solid rectangle of the pattern. Covering everything of
the complex geometric shape. So the alpha is preserved.
Quote this message in a reply
Moderator
Posts: 1,140
Joined: 2005.07
Post: #5
If you set the texture mode to modulate, the alpha will be preserved. Example:
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);

There should be no border between textures. It is that simple. Smile
Quote this message in a reply
Member
Posts: 321
Joined: 2004.10
Post: #6
I tried to do a simple replacement of my GL_REPLACE with GL_MODULATE but nothing changes
so I don't think I still get it. I've been reading the "Texture Functions" section in the Red Book
over and over, but I'm now more confused than ever.

First, is this an application of multi-texturing? If so, I'll go off and study that more.

Let's make the example even simpler. Let's say I've got an RGBA image (texture) of
an oval: the oval is 1024x256 pixels and it is solid white. The alpha defines the part
that is not the oval (the anti-oval). I want to lay over the oval a "wood plank" texture of
an 128x128 texture. (The texture is tileable so it will look pretty if the texture repeats)

So I display a blue screen, and display a white oval. So far so fine, But what to do next.
should I change the glTexEnv() to GL_MODULATE and repeat the display operation
with the oval's object coordinates, but now using the wooden plank's texture?
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  General Questions About Old Or Limited Graphics Cards Oddity007 5 4,039 Mar 3, 2009 01:39 AM
Last Post: arekkusu
  Texture Basic Question(s)... WhatMeWorry 2 3,342 Feb 27, 2007 10:06 AM
Last Post: arekkusu
  general blending versus texture blending questions WhatMeWorry 2 5,228 Dec 7, 2006 02:43 PM
Last Post: arekkusu
  general question - greying out RGB textures? WhatMeWorry 2 2,859 Oct 21, 2004 02:20 PM
Last Post: arekkusu
  GL question- redefining texture? arekkusu 4 5,511 Jul 31, 2004 04:08 PM
Last Post: OneSadCookie