Author Topic: cant use softward n hardware renderer on the same framebuffer  (Read 11761 times)

Offline MichaelJPCT

  • float
  • ****
  • Posts: 264
    • View Profile
cant use softward n hardware renderer on the same framebuffer
« on: January 01, 2016, 02:47:09 pm »
javadoc says "It is possible to use the software renderer as well as the OpenGL renderer on a single framebuffer at the same time"

i tried this:

buffer.disableRenderer(2); buffer.enableRenderer(1)
buffer.clear()
buffer.disableRenderer(1); buffer.enableRenderer(2)

then "array index out of bound exception" was reported at buffer.clear().

i was trying to use software renderer to render a large model with per-pixel fog, since my GPU can't do per-pixel fog.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: cant use softward n hardware renderer on the same framebuffer
« Reply #1 on: January 01, 2016, 03:44:48 pm »
That's actually not what the docs mean. You can enable both renderers and render the scene using both, but you'll end up with two different images, one rendered by GL, one by the CPU. And if you do this, there are some restrictions that apply (for example, you are not allowed to compile objects). As a rule of thumb: You don't want to do this. It's an option, but it's rather pointless in 99.99% of all cases.
And honestly, I don't think that your GPU doesn't support per pixel fogging. That's a feature almost as old as GPUs. What makes you think that it doesn't support it?

Offline MichaelJPCT

  • float
  • ****
  • Posts: 264
    • View Profile
Re: cant use softward n hardware renderer on the same framebuffer
« Reply #2 on: January 01, 2016, 04:14:04 pm »
And honestly, I don't think that your GPU doesn't support per pixel fogging. That's a feature almost as old as GPUs. What makes you think that it doesn't support it?

say my camera is placed at (0,0,0) and there is a large quad of size 20000x20000 at (0,10,0), with each vertex at the same distance to camera (at 45,135,-45,-135 degree). fog ends at 5000.
when the quad is rendered, its color is totally fog color. because all vertices have the color of fog, they make all pixels have the same color. this is the behavior of per-vertex fog.
if the 2 vertices which were behind the camera are moved forward so that they are a little bit in front of the camera, then the fog effect looks correct.
right now i am using Intel Atom Z3740D with onboard GPU.
anyway i'll try to use shader to render the quad, i did it once with other engine. i was just curious how software renderer would do in this case.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: cant use softward n hardware renderer on the same framebuffer
« Reply #3 on: January 01, 2016, 04:21:11 pm »
Yes, which such large polygons, per pixel fog on a GPU might indeed be a problem. They claim to support per pixel, but it might as well be per vertex. Older ATI cards did it that way, Intel might as well. Can't you just increase the detail of the plane?

Offline MichaelJPCT

  • float
  • ****
  • Posts: 264
    • View Profile
Re: cant use softward n hardware renderer on the same framebuffer
« Reply #4 on: January 01, 2016, 05:09:34 pm »
i guess dividing a large quad into smaller quads will not give smooth color if fog is calculated per-vertex. i want the color look smooth. and one quad can be rendered much faster than hundreds or thousands of quads.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: cant use softward n hardware renderer on the same framebuffer
« Reply #5 on: January 01, 2016, 05:20:06 pm »
You have no other option, I'm afraid. And I'm talking about 2 vs. hundreds of thousands of polygons here. The problem that the fog has is actually the same that per vertex lighting has and usually, increasing the polygon count really helps. Just try to create it from 4 quads or 16. That should help IMHO.