mojira.dev

daniel mills

Assigned

No issues.

Reported

MC-11099 Block Selector Overlays Block Particles Duplicate

Comments

I created a framebuffer for layered rendering in c++ to explain what I mean. like this

GLuint buffer;
glGenFramebuffers(1,&buffer);
glBindFramebuffer(GL_FRAMEBUFFER,buffer);

glFramebufferTexture(GL_FRAMEBUFFER,GL_COLOR_ATTACHMENT0,textures[0],0);

GLenum blub[] = {GL_COLOR_ATTACHMENT0};

glDrawBuffers(1,blub);

where textures[0] is a 3D texture for layered rendering. This layers the textures onto the attatchment (frame buffer)

When you aren't using pixel accelerated graphics (not using open gl, just from scratch) you usually run into issues with clipping. Its mainly objects behind other objects popping through.

Then I create and fill a buffer with vertex data for the points like this:

vector<vec2> points;
points.push_back(vec2(0.0f,0.0f)); //should draw in the middle
points.push_back(vec2(0.5f,0.5f)); //3/4th in each direction
points.push_back(vec2(-0.5f,-0.5f)); //opposite of second point
points.push_back(vec2(-0.95f,-0.95f)); //first texel on the bottom left

glGenBuffers(1,&result);

glBindBuffer(GL_ARRAY_BUFFER,result);
glBufferData(GL_ARRAY_BUFFER,points.size()*2*sizeof(float),&points[0],GL_STATIC_DRAW);
where vec2 is the vec2 floating point vector class provided by GLM.

Then I render it by doing this:

glViewport(0,0,textureSizeX,textureSizeY);
glBindFramebuffer(buffer);
glUseProgram(shader);
glBindBuffer(GL_ARRAY_BUFFER,_pointbuffer);
glEnableVertexAttribArray(0);
glVertexAttribPointer(0,2,GL_FLOAT,GL_FALSE,0,0);
glDrawArrays(GL_POINTS,0,4);
where shader is a shader constructed from vertex, geometry and fragment shaders. It compiles fine without warnings. Depth and stencil testing are disabled. textureSizeX and textureSizeY are the width and height of the 3D texture.

Anyways my point is that layering is not done in three dimensions it is done after it is rastered onto the screen

Believe what you want.