Sign in to follow this  
arbuckle911

some RRT theory

Recommended Posts

arbuckle911    139
Say I have a texture in ram. IE. an array of colours. Lets pretend it's 1024 by 1024 and I want to have a texture in video ram (framebuffer for example) that is the same width and height, and I want to have the pixels in ram update the pixels in the framebuffer. So I think to myself "update texture = render to texture = framebuffer". Then I started thinking about the details of how I was going to put everything together, but as a RRT noob I have some implementation/performance tradeoff questions. (=Gamedev.net thread). So here I am with 3 main questions: 1. What's the fastest way to draw a series of pixels in ram to the screen? Is there anything faster than glBitmap()? 2. What if the array of colours will go off the screen?..1024x1024 wont fit on 1024x768. Is there a special viewport setup? 3. Is there a more direct way of editing a texture without drawing to the screen? Something with pointers and offsets to video memory would be preferable than RRT, sort of like vertex buffer objects and buffer mapping. Thanks in advance.

Share this post


Link to post
Share on other sites
_the_phantom_    11250
Errm, at the risk of sounding basic; why not just upload it to a texture, your pixel data has now been moved from system ram to [possibly] VRAM in one move.

To draw to the screen then you just draw a textured quad of the correct size.

Uploads can be done with glTexImage() and glTexSubImage() (the latter is faster but I seem to recall someone on here saying you had to do a glTexImage() before a glTexSubImage() to ensure it worked) so you can update your texture data.

Share this post


Link to post
Share on other sites
deavik    570
arbuckle911, I'm interested in what you're asking, but I don't know what RRT means? Are you perhaps referring to RTT?

RTT is not actually related to copying data from sysmem -> video card memory. RTT deals with data taht is on the graphics card (typically the framebuffer) and creates a texture from it.

Quote:
1. What's the fastest way to draw a series of pixels in ram to the screen? Is there anything faster than glBitmap()?

2. What if the array of colours will go off the screen?..1024x1024 wont fit on 1024x768. Is there a special viewport setup?


^^ What phantom said. Fastest way has to be using a texture - and you might also want to take a look at the "Streaming textures using pixel buffer objects" example in the PBO spec (look below for link).

Quote:
3. Is there a more direct way of editing a texture without drawing to the screen? Something with pointers and offsets to video memory would be preferable than RRT, sort of like vertex buffer objects and buffer mapping.


There are Pixel buffer objects.

Quote:
Original post by phantom
(the latter is faster but I seem to recall someone on here saying you had to do a glTexImage() before a glTexSubImage() to ensure it worked)

As I understand it, that's because glTexImage2D actually does all the work regarding setting up of a new texture object (internalformat, width, height etc). glTexSubImage merely works on the data of an exising texture object. To use glTexSubImage, a call to glTexImage2D with the desired params and NULL for pixel data is fine for using glTexSubImage2D subsequently.

Share this post


Link to post
Share on other sites
_the_phantom_    11250
One point to keep in mind, at least until the X800 series ATI doesn't support the PBO extension, I think that might have changed with teh X1K series but don't quote me on that as I don't have the hardware to confirm/deny it [smile]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this