@Mac70
Blending doesn’t help with geometry like lines.
@roland
when you only want to activate multisampling aka. anti-aliasing for some geometrie like your minimap, you can do it like this.
- create a multisamples RenderBuffer
- render to that buffer
- copy/blit the result to the screen or texture which you want to render
Code should look like this:
// creating a multisampled renderbuffer
int samples = 4;//you can query the max supported samples by glGetIntegerv(GL_MAX_SAMPLES, out, 0);
int[] id = new int[1];
glGenRenderbuffers(1, i, 0);
glBindRenderbuffer(GL2ES2.GL_RENDERBUFFER, id[0]);
glRenderbufferStorageMultisample(GL_RENDERBUFFER, samples, GL_RGBA8, width, height);
//blitting the buffer to the screen or a texture
//bind the renderbuffer as colorbuffer to a FBO
glBindFramebuffer(GL_READ_FRAMEBUFFER, id);//bind this FBO as read buffer
//now bind the default Framebuffer(0: the screen) or a FBO with the texture
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, id2);
//and as a last step copy the content of the multisampled renderbuffer
glBlitFramebuffer(0, 0, width, height, 0, 0, dstWidth, dstHeight, GL_COLOR_BUFFER_BIT, GL_LINEAR);
In your case I would do the rendering like this.
Clear the multisampled renderbuffer to some semi transparent black(like in your screenshot)
Render the minimap into it
Copy the renderbuffer into a texture(this step is needed to resolve the multisampling)
render the texture into the top right corner of your screen.
The thing is if you wouldn’t need a transparent minimap background, you could directly copy the minimap onto the screen.
ps:
Some googling unearthed this nice trick: http://http.developer.nvidia.com/GPUGems2/gpugems2_chapter22.html