Skip to main content
gamedev.net
🔒 Locked

Texture borders

Started by Dybbuk Apr 13, 2005 at 4:07 AM 2 replies 1.5k views
Original Post
Dybbuk
Dybbuk
Hello, I've got a problem with texture borders. I want to display video data using openGL and do some convolutions on it using Cg. The camera data is 640x480. I fetch the camera data, upload it to a texture and possibly do some convolutions, and then display the data. Unfortunately openGL (unless using extensions) requires power of 2 texture sizes, so i upload the data with subImage2D to a 1024x1024 texture. Because of this the videodata borders are not the texture-borders. So when i do convolutions or display the data when the texture is made with GL_LINEAR, i get errors at the edges of the video-data because the convolutionfilters and GL_LINEAR uses data from the texture wich is not part of the videodata. So my question is: Is there some way to set the borders from a texture at a differnent position. (eg. make GL_CLAMP clamp to range [0, 0.2476] or something) or do I have to use extensions to create a non-power-of-2 texture? Or is there another way perhaps. Thanks in advance [Edited by - Dybbuk on April 14, 2005 4:16:19 AM]
Dybbuk
Dybbuk
nobody?
mikeman
mikeman
No, I don't think you can set the borders of the texture. The only thing I can think of(except using non-power-of-two extensions) is to create a border yourself, by duplicating the last row and column of the image. Like this:

1)Copy the 640x480 image into a 1024x512 texture
2)Copy the 640th column of the image into the 641th column of the texture.
3)Copy the 480th row of the image into the 481th row of the texture.

I haven't try it my self, but I think it will do the job.
Dybbuk
Dybbuk
thx for the reply.

I tought of that myself but because of the high update rate i didn't really like this method. I need a bigger border than just 1 pixel, i rather have a GL_CLAMP like effect.

But i guess i'll have to do it in a way similar to your suggestion.

I think i:

1. render texture video data to the center of a pbuffer
2. render texture left and right and up and down with the same tex-coords as the corresponding border.
3. copy back to texture

This should give me a GL_CLAMP effect.

Quite expensive....

Better solutions are still welcome..

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.