finding used texels...

Hi all!

I need to get the actual texels that are used by a triangle. That is I have the texture coordinates and an image, I now need to know exactly which texels are beeing used when the triangle is displayed.

I have tried making a simple “triangle rasterizer” and this seems to be the way to go but my algo misses some texels in some cases.

Any ideas?

regards!

/hObbE

You cannot get this information from OpenGL. If you are doing your own rasterizer for triangles, the information is immediately available to you however. Unfortunately, your graphics card will skip texels or blend them depending on scale, mapping, alpha etc.

Would feedback help with this? Or is the information returned by feedback insufficient.

Feedback refers primarily to the transform and lighting part of the pipeline. It allows you to get back transformed and lit vertex information so that your own code can do analysis or rasterize the geometry from there on in (can’t think of many applications that would need to do this).

If there is a particular application you need this for, we might be able to think up some alternative solution?

someone gave me this link the other day http://developer.nvidia.com/view.asp?IO=Show_Footprint

Thanx for the replies guys! Nice to know that one always can find help from U!

Actually I reworked all my code today and fond a robust sollution. It is a subpixel accuracy DDA (I think it’s called :wink: It seems to be working fine!

Got the general idea from this page:
http://cs-people.bu.edu/jisidoro/cs480/additional/trirast5.htm

I use this to calculate lightmaps in my application. That is I map the vertices of the poly, create a suitable image and then iterate over the texels actually visible performing lighting calcs. Works fine.

Now my problem is that my triangle fan poly generator generates some degenerate (non convex) polygons messing up the whole thing. But I have the whole weekend to fix that one :wink:

regards!
/hObbE

>>I use this to calculate lightmaps in my application. That is I map the vertices of the poly, create a suitable image and then iterate over the texels actually visible performing lighting calcs. Works fine.<<

easy with barycentric coordinates