order - Opengl front to back blending issue (black screen) -
i'm implementing renderer shading requires front-to-back rendering. i'm having issues figuring out how initialize blending function.
here's tried.
glenable(gl_depth_test); gldepthfunc(gl_less); glenable(gl_blend); glblendfunc(gl_one_minus_dst_alpha, gl_one); glclearcolor(0.0f, 0.0f, 0.0f, 0.0f);
this results in black screen.
the blog post says use gl_one_minus_dst_alpha, gl_one , initialize background black translucent, think i'm doing. post cites an nvidia whitepaper looked well. looked through code there , seem same me. wrong isn't working. if don't use blending or use other blending functions things seem work.
edit:
glutinit(&argc, argv); glutinitdisplaymode(glut_double | glut_rgba); glutcreatewindow("window");
you need request alpha planes during glut initialization if use blending involves destination alpha. change call to:
glutinitdisplaymode(glut_double | glut_rgba | glut_alpha);
you might think specifying gl_rgba
sufficient. @ least did, until checked documentation, says:
note glut_rgba selects rgba color model, not request bits of alpha (sometimes called alpha buffer or destination alpha) allocated. request alpha, specify glut_alpha.
Comments
Post a Comment