reduced texture

Started by
6 comments, last by silvermace 19 years, 6 months ago
okay the problem: im trying to get a low res image of the screen in to the accumulation buffer eg. my screen might be 800x600 i want an image size 400x300 capture of the screen stretched to 800x600 in the accumulation buffer. my origonal ideas was: use glCopyTexImage2D or glCopyTexSubImage2D to a 400x300 texture, but this only copies the top left 400x300 pixels and not the whole screen as intended :-/ so my new idea: copy the screen to a 800x600 texture, render it to the back buffer as 400x300 pixel quad. then copy this to a 400x300 texture then render it back to the back buffer as 800x600 quad then copy to accum buffer, but this sounds like a lot of work for a simple task :-/ is there some easy way to do this, with out to much copying going on?
Advertisement
set the viewport to the smaller window (glViewport), render as normal and then copy the correct size, set viewport back to normal.

HTH
or you could use a P-Buffer and avoid the readback (for a speedup)

ATI have an excelent wrapper on their website (should work for NV as long as you dont want a float one)

i think i got it from the Mandelbrot sample, its piss easy to use.

http://www.ati.com/developer/

"I am a donut! Ask not how many tris/batch, but rather how many batches/frame!" -- Matthias Wloka & Richard Huddy, (GDC, DirectX 9 Performance)

http://www.silvermace.com/ -- My personal website
but if i already have the scene rendered in a higher res, and want a lower res version.

I dont really have to want to render the scene 2 times? or could i just render my high res using a quad, to a lower res pbuffer? then can i copy from pbuffer to accumulation buffer?
I don't exactly know how to help... but can't you make OpenGL skip every other byte when copying? That would give you exactly half the size. Although, this may not work, just an idea.
Quote:Original post by supagu
but if i already have the scene rendered in a higher res, and want a lower res version.

I dont really have to want to render the scene 2 times? or could i just render my high res using a quad, to a lower res pbuffer? then can i copy from pbuffer to accumulation buffer?


Yes, u just render the scene to a texture(hign res), and map the texture to a quad, which only takes up half res of the high res screen, and then render the quad, glCopyTexSubImage2D the specific screen buffer(only contains the quad) to another texture. done!
but u need to carefully adjust the size of the quad to make it only take up res 400*300 on the high res(800*600) screen

or as u suggested, render the mapped screen quad to a low res p-buffer.
can you copy pbuffer to accumulation buffer?
not sure, havn't worked with the accum buffer befor, sorry :-/
googled?
"I am a donut! Ask not how many tris/batch, but rather how many batches/frame!" -- Matthias Wloka & Richard Huddy, (GDC, DirectX 9 Performance)

http://www.silvermace.com/ -- My personal website

This topic is closed to new replies.

Advertisement