| Reference | Downloads | Github

All elements clipped at a certain distance from the edge?

Hi all, so bear with me, I just started using PsychoPy!

Very simple issue; I want to show a TextStim near the top of the window (to act as a title). It seems to be clipped off once it gets to a certain distance:

So of course I could just move it lower and change everything accordingly, but it would be great if I could increase that boundary somehow.
Anyone know what’s going on here?

OS: Ubuntu 16.04
PsychoPy version: 3.1.2
Standard Standalone? (y/n): Yes (I think)

Thanks! :slight_smile:

Edit: A colleague recommended I move to pure coding instead of the Builder. I’m comfortable with Python, so I’m changing the topic to Coding.

Hi @adam_coyne, its hard to know without seeing your code. If you are using an Aperture component to control where text can be presented, you could try making the aperture larger. If not, would you mind sharing a minimal working example? E.g. one slider and the text component.

So I think I may have found a bug. I was preparing a working example with a single routine, and I found that without other routines before the one pictured the problem didn’t occur. It seems to be clipped to the edges of the Form component I used in the previous one.

So far I haven’t messed around with the code, here’s two examples generated by the Builder so I’m sure it’s fairly standard: (18.4 KB) (22.8 KB)

For me, the 1routine file displays fine, but the same routine with the Form preceding it cuts off the edges like I described.

Here’s a quick view of how it looks.

Single routine:

The same routine, after another with a Form component:

Also I realised you’ll need form questions for the 2routines file, here’s mine: ssq.xlsx (5.3 KB)

1 Like

Yes, it is related to the aperture that is being used in the Form component, however I cannot recreate this error from Builder or Coder. Would you mind also sending me your psyexp file?

Here’s the experiment file. You’ll also need the ssq.xlsx file again.
2routines.psyexp (38.4 KB)
Thanks for all your help!

@adam_coyne, there is a fix but this involves changing the source code. If you are happy to output your code into Coder and run the study from Coder, you just need to set the useFBO param in the Window component to False:

# Setup the Window
win = visual.Window(
    size=[1920, 1080], fullscr=True, screen=0, 
    winType='pyglet', allowGUI=False, allowStencil=False,
    monitor='testMonitor', color=[0,0,0], colorSpace='rgb',
    blendMode='avg', useFBO=False,  # Change useFBO to False 

If you are happy to change the source code, go to the psychopy>visual folder and in the `" file and…

replace line 690

with the following:

if GL.glIsEnabled(GL.GL_STENCIL_TEST):

So I tried changing the source code, however I don’t seem to have the same as the one you linked. Here’s a snippet of my version where I found the only reference to GL.glEnable(GL.GL_STENCIL_TEST) (around line 790):

        flipThisFrame = self._startOfFlip()
        self.resetEyeTransform(False)  # reset transformations
        if self.useFBO:
            if flipThisFrame:
                # need blit the framebuffer object to the actual back buffer

                # unbind the framebuffer as the render target
                GL.glBindFramebufferEXT(GL.GL_FRAMEBUFFER_EXT, 0)
                stencilOn = GL.glIsEnabled(GL.GL_STENCIL_TEST)

                if self.bits is not None:

                # before flipping need to copy the renderBuffer to the
                # frameBuffer
                GL.glBindTexture(GL.GL_TEXTURE_2D, self.frameTexture)
                GL.glColor3f(1.0, 1.0, 1.0)  # glColor multiplies with texture
                GL.glColorMask(True, True, True, True)



        # call this before flip() whether FBO was used or not

        if self.useFBO:
            if flipThisFrame:
                # set rendering back to the framebuffer object
                    GL.GL_FRAMEBUFFER_EXT, self.frameBuffer)
                # set to no active rendering texture
                GL.glBindTexture(GL.GL_TEXTURE_2D, 0)
                if stencilOn:

It seems to already include the stencil check you mentioned; I tried playing around with it, inverting the condition, removing the if statement, removing the glEnable line entirely, but it didn’t stop the issue. I see you’re a contributor on the Github @dvbridges, would you think this is a bug that should be reported?

Setting useFBO=True in the Coder did solve the problem however, so I’m happy meanwhile :slightly_smiling_face:
Thanks for all your time!

Ah I see, my fix only works on the GitHub repository as the changes have not been released yet (the fix has been posted here). You would instead go into the psychopy\visual\backends folder and make the changes to the file, line 291.

1 Like

Beautiful! All fixed, with the default project code. Thanks!