Sign in to follow this  
montka

gl_ClipDistance is not working

Recommended Posts

Hi,

I enabled GL_CLIP_DISTANCE: glEnable(GL_CLIP_DISTANCE0);

before I call glDrawArraysInstanced();

and my vertex shader looks that:

#version 330
layout (location = 0) in vec2 position;
layout (location = 1) in vec2 texcoord;
layout (location = 2) in vec2 offset;


out Vertex
{
	vec2 position;
    vec2 texcoord;
	vec2 offset;
} vertout;

void main () {
	gl_ClipDistance[0] = -0.1;
	vertout.position = position;
	vertout.texcoord = texcoord;
	vertout.offset = offset;
	//gl_ClipDistance[1] = -1.0;
}

gl_ClipDistance is not working - everything is being rendered, why? What I did wrong?

My GPU: Nvidia gtx 1060, drivers are up to date. 

 

#edit

glIsEnabled(GL_CLIP_DISTANCE0)) returns GL_TRUE;

 

#edit2

Ok, I know what was wrong.

I use Tessellation, so I just filled gl_ClipDistance[0] = -1.0 there and now it's working correct.

Edited by montka

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this