# Thread: How to choose the texture which is not in rectangular form?

1. ## How to choose the texture which is not in rectangular form?

Hi all,

How do I choose/make a 2D texture image using glReadPixels but the area of my interest is not a rectangular. The area could be a slunted rectangle, triangle or even a sphere? Anyone can help me please?

regards,

2. ## Re: How to choose the texture which is not in rectangular form?

Hmm, i am interested for what you need that. How do you want to store the data?
Could't you just read a rectangle and only use the required parts?

3. ## Re: How to choose the texture which is not in rectangular form?

hmmm... I still do not have any idea of what I will do.. may be I can consider your suggestion to let say get the smallest rectangle that enclose the area and use part of it which is the area of interest.

But if we do that I still think that we don't actually solve the problem rite? we have just making the texture choice smaller by defining this small rectangle. We still have to get the area of interest which is not in rectangle form.

FYI, in my application it will be something like this. eg the simplest, I have slunted rectangle A(0,0) B(2,1) C(2,4) and D(0,3) how should I get texture from this area of interest? Oh ya I have store the image in let's say an array called image.

regards,

4. ## Re: How to choose the texture which is not in rectangular form?

I still have some difficulties in understanding how you wanna store the data. In your example, you have a slunted rectangle. When you read the data, do you wanna read it into a (rectengular) array?
So, shall the read rectangle be unslunted that the pixels at the edges of each rectangle match?
Well, this method won't work for other shapes like triangles or circles. Or do you simply read the smallest surrounding rectangle and your problem is how to determine where the edges are?

[This message has been edited by plastichead (edited 01-22-2002).]

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•