Skip to main content
gamedev.net
🔒 Locked

TEXTURE BORDER

Started by BGCJR 4 replies 1.1k views
Original Post
BGCJR
BGCJR
I need make a texture with a white border. I tried: glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE, 0, 0, x+2, y+2, 1); but it was too slow during rendering, 514x514 texture. The texture i create must contain a white border and the texture is created ''ON THE FLY''.
Game Core
Yann L
Yann L
You can''t create a 514x514 texture, it''s not a power of two. Use a 510x510 texture, and add a border making it 512x512.

Alternatively, you can use hardware texture borders, but only if your hardware supports it (GF3+).

/ Yann
BGCJR
BGCJR
it says 2 power + 2 * border size. and it runs but very slowly.
Maybe, another way.
I render a view , copy it to a texture, then use it later.
somewhere and somehow , i need to add a white border TO THE TEXTURE.
Game Core
Yann L
Yann L
quote:

it says 2 power + 2 * border size. and it runs but very slowly.


That's for hardware texture borders. Your hardware needs to support texture borders in order to get acceleration on a 514x514 texture. That's from GF3+ on upwards (and all ATi Radeon, iirc). What 3D card do you have ?

But the whole OpenGL texture border concept is awkward. Just create a standard 512² texture without border. Fill it with 510x510 valid texels of image data. And draw a white border around it (copy white pixels into the texture image).

/ Yann


[edited by - Yann L on July 23, 2002 5:21:15 PM]
BGCJR
BGCJR
My solution. i tried glOrtho then glineloop the border. finally, copy the texture for later use.
It works but I found that without glCopyTexImage2D. It runs alot faster. 100fps on a GeForce256. (and with) it runs 26fps.
Hmmm. just like boiling peanuts.
Game Core

Topic Locked

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

Sign in to reply to this topic.