|
shodanjr_gr posted:Id actually love a brief how-to on Multiple Render Targets in OGL since id like to build a basic deferred renderer at some point. Deferred shading in OpenGL is a little annoying, but reasonably easy once you get the idea: - Disable clamping so we can set colors outside the range of 0..1: code:
code:
code:
code:
- Bind your MRTs code:
In your pixel shader, instead of setting a gl_FragColor, you do something like this: code:
code:
This time we read from the two textures, use them to calculate the pixel brightness, and spit that out on to the screen. Hopefully that made sense :P feel free to ask if you have any questions.
|
# ¿ Sep 2, 2008 03:37 |
|
|
# ¿ Apr 29, 2024 04:33 |
|
Mithaldu posted:However when i take the begin and end out of the lists proper and put them in front and after the loop, it suddenly goes weird. The CPUs cores both go to 100%, all used by the Perl process and the framerate noticeably drops. It doesn't even matter whether the list calling loops is within begin/end or not. If it isn't it won't render, but the CPU will still freak out. As soon as you call glBegin(), you enter immediate mode and the display driver expects *nothing but* vertex data (glColor, glAttribute, glVertex etc). When you called a display list while in this mode, your display driver was probably nice enough to notice this and pass the display list that way (hence the slowdown). Same deal if you're creating a display list full of vertices but have no glBegin anywhere, inside or out of it - the driver has no idea what to do with them, anything could happen. Basically the begin and end are meant to be in the display list definition, not when you call the display list, and Bad Things happen if you put them anywhere else :P. As for the threading thing, it's not really that surprising. Just because your program is single-threaded, doesn't mean the display driver it's calling is. If you do something weird like this it's not entirely unexpected that the driver will balance the load between cores to increase performance. Edit: pianoSpleen fucked around with this message at 07:34 on Sep 6, 2008 |
# ¿ Sep 6, 2008 04:46 |
|
brian posted:Ok another question for you dapper fellas, how do I copy a texture from one handle to another in openGL without copying the pixels manually? I want to create a faux-motion blur effect by taking the previous frame and doing a simple fragment shader blend with the current one, I can get the current framebuffer using the framebuffer EXT and it's stored in an image handle but that handle is linked to the FBO so whenever the FBO is drawn to it's overwritten. I know I can detach the current image and attach a different one but that doesn't seem like a particularly good way to go about it but I could be wrong, would using an alternating color attachment each frame do the job? Any help would be fabbo. Uh, you realise you can do that in about 4 lines using the accumulation buffer, right? (and it'll be faster than doing it manually, too) Like this: float q=0.7f; glAccum(GL_MULT, q); glAccum(GL_ACCUM, 1.0f-q); glAccum(GL_RETURN, 1.0f); Where q is the amount to blur, naturally.
|
# ¿ Oct 11, 2008 01:49 |
|
OneEightHundred posted:Don't most consumer graphics cards do accumulation buffers in software, punching your framerate in the face? Hrm, reading up it seems that support for it is indeed a little iffy. Maybe using FBOs would be a better idea overall... it's a neat trick when you need a quick blur though.
|
# ¿ Oct 11, 2008 09:48 |