Sub Texture

Started by
16 comments, last by Last Attacker 17 years, 6 months ago
Quote:Original post by Last Attacker
The thing is I am workig with Vertex Textures and I want to use a sub area of a texture untill I have to replace it with another texture. Think of it as a Radar in a RTS game. When that white box (your view port) moves to the side and reaches the edge, a new background is copied to the radar and the white box moves accordingly. Get what I'm saying? I am using it for a heightmap. Its for my year project.
If it were possible to do, would there be any speed increases since no new textures have to be created so many times?

Or how about the vertex shader?

I hope I am making sence. Sorry I'm typing in a rush.

Vertex Textures?

Uhm.. do you want to scroll the texture?

Quote:If it were possible to do, would there be any speed increases since no new textures have to be created so many times?

Are you creating textures every frame??

Quote:I hope I am making sence.

You're not making any sence at all :P :D
Advertisement
Quote:Original post by angry
Quote:I hope I am making sence.

You're not making any sence at all :P :D


Sorry man. Had to type quick.

Quote:Original post by angry
Are you creating textures every frame??


Almost. I have to do a lot of buffer copying to send the resulting texture to the GPU.

Quote:Original post by angry
Uhm.. do you want to scroll the texture?


Basically yes.

I have a big buffer containing heightmap info and I have to take a sub image, make it a texture and send it to the GPU. As the camera moves I have to do this almost every frame. Still too costly though. I was hoping of creating a bigger than normal texture and tell the GPU to use only a sub part of that texture the size of what I normally wanted it to be, so when the camera moves, there should be no copying, just adjusting.

Making sence now? ;p
"Take delight in the Lord and He will give you your heart's desires" - Psalm 37:4My Blog
adjusting texture coordinates is still going to be the simplest and probably the best way to go with this... at least based on the description you gave
Just one problem. VBOs.
I have a couple of VBO vertex and texture coords buffers. Thus it's static.
Don't tell me to resend those data to the video card. I think it will then make it 10x slower, or something. Then I could have just as well not have used VBOs.
"Take delight in the Lord and He will give you your heart's desires" - Psalm 37:4My Blog
Perhaps it would be better not to use VBOs for that one quad you're using to display the 'radar'. Instead, render it normally and modify the texture coordinates to make it display only a small portion of your entire map.

If your problem lies in the fact that your heightmap is very large, too big to fit in one OpenGL texture, you can just break it down into a grid of smaller textures and render using those accordingly (you may have to render up to 4 quads this way, when your view is over the corner where 4 smaller subdivided squares of your minimap meet).

That way you would only need to generate the minimap texture(s) once at the beginning.

If you need to display moving objects, it might be a good idea to separate them from the background and render them separately (you could use glScissor testing), on top of the static minimap.

Those are just some ideas that come to me after reading what you've described trying to accomplish. Hope it helps.
Quote:Original post by Last Attacker
Just one problem. VBOs.
I have a couple of VBO vertex and texture coords buffers. Thus it's static.
Don't tell me to resend those data to the video card. I think it will then make it 10x slower, or something. Then I could have just as well not have used VBOs.


Not remotely a problem, set up the VBOs with the texture coords set to the smallest size you want to display then feed an offset into a VS and add the offset to the texture coords.

simple.
Quote:Original post by shurcool
Perhaps it would be better not to use VBOs for that one quad you're using to display the 'radar'. Instead, render it normally and modify the texture coordinates to make it display only a small portion of your entire map.

If your problem lies in the fact that your heightmap is very large, too big to fit in one OpenGL texture, you can just break it down into a grid of smaller textures and render using those accordingly (you may have to render up to 4 quads this way, when your view is over the corner where 4 smaller subdivided squares of your minimap meet).

That way you would only need to generate the minimap texture(s) once at the beginning.

If you need to display moving objects, it might be a good idea to separate them from the background and render them separately (you could use glScissor testing), on top of the static minimap.

Those are just some ideas that come to me after reading what you've described trying to accomplish. Hope it helps.


Thanks for your input, but I just used the radar as an illustration of what I wanted to achieve. I am using a texture for rendering my terrain. Sorry that I didn't sound very clear on the subject. I Guess I was in a little rush or something or didn't think to clearly.

After a while I thought of using the Vertex Shader, I guess I was thinking inside the box ;). Still have to implement it though, but for interrest sake... is there a way of doing this in plain OpenGL? No Shader programming "allowed" ;)

Thanks again... and sorry for the beat around the bush. I feel kinda stupid...
"Take delight in the Lord and He will give you your heart's desires" - Psalm 37:4My Blog
I gave you all some extra points to make it up to all of you [wink]
"Take delight in the Lord and He will give you your heart's desires" - Psalm 37:4My Blog

This topic is closed to new replies.

Advertisement