Jump to content
  • Advertisement
Sign in to follow this  
16bit_port

OpenGL OpenGL texture question

This topic is 3623 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have a few questions about textures and how they're stored in OpenGL and/or in hardware. Note: I'm not asking how to do it through OpenGL calls (glTexImage2D), I'm just asking about the internal workings of it. I know very little about hardware and the first two are pretty basic hardware questions so bear with me. I heard somewhere that textures should be stored in VRAM, so that is why the following questions are focused on that. 1) I know that VRAM (video RAM) is a variant of DRAM but is a VRAM a separate physical memory like DRAM, or is it part of the graphics card? 2) What other purposes does VRAM serve, other than to store the current framebuffer? Do all applications store the things to be rendered in VRAM by default or is it an optional thing? 3) When I pass in my texture data through glTexImage2D, is it being stored in VRAM? If so, (and I'm pretty sure I can do this) does that mean I can dealloc my local texture data after the call to glTexImage2D? If it's not stored in VRAM, how can I have it so that it is? 4) So if OpenGL does store the textures in VRAM along with the current framebuffer, what else does OpenGL use VRAM for? Ignore. It's the same as question 2). 5) Lets say I close my application, do I need to free up the textures in VRAM myself or does OpenGL handle that for me? 6) How can I free up a texture in VRAM (I don't need that texture anymore)? Through glDeleteTextures? 7) Suppose I have a texture in VRAM, how do I read/write each of its texture data? [Edited by - 16bit_port on November 21, 2008 8:29:24 PM]

Share this post


Link to post
Share on other sites
Advertisement
1) VRAM is just standard DDR memory that is integrated onto the graphics card. Driver calls can transfer from your computer's main memory to VRAM and back.

2/4) It stores everything. If it shows up on the screen it has to be in VRAM at some point, as the GPU can't directly access main memory.
This is all your geometry, shaders, textures, frame buffers, offscreen buffers. It is also all the same graphics assets from any other running programs (ie vista's AERO, other games, a CUDA application, etc.)

It doesn't all have to be there forever, as some API calls(glVertex3f) transfer data to the GPU buffers for one frame only, then it gets trashed for the next frame. But you can store stuff there (like textures, VBO's, etc.) for the length of the application.

3) Probably. But the driver can swap the data in and out of VRAM whenever it wants/needs to due to space, or your application going out of focus. And yes, once you create the texture and pass the data to the opengl driver you don't need to keep your copy of it around.

5/6) yup. and prolly a good idea to do this, cause the diver might not.

7) glTexSubImage2d

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!