Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 191995
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T16:23:19+00:00 2026-05-11T16:23:19+00:00

Update: This only seems to be a problem at some computers. The normal, intuitive

  • 0

Update: This only seems to be a problem at some computers. The normal, intuitive code seems to work fine one my home computer, but the computer at work has trouble.

Home computer: (no problems)

  • Windows XP Professional SP3
  • AMD Athlon 64 X2 3800+ Dual Core 2.0 GHz
  • NVIDIA GeForce 7800 GT
  • 2 GB RAM

Work computer: (this question applies to this computer)

  • Windows XP Professional SP3
  • Intel Pentium 4 2.8 Ghz (dual core, I think)
  • Intel 82945G Express Chipset Family
  • 1 GB RAM

Original post:

I’m trying to apply a very simple texture to a part of the screen using Psychtoolbox in Matlab with the following code:

win = Screen('OpenWindow', 0, 127); % open window and obtain window pointer
tex = Screen('MakeTexture', win, [255 0;0 255]); % get texture pointer
% draw texture. Args: command, window pointer, texture pointer, source
% (i.e. the entire 2x2 matrix), destination (a 100x100 square), rotation
% (none) and filtering (nearest neighbour)
Screen('DrawTexture', win, tex, [0 0 2 2], [100 100 200 200], 0, 0);
Screen('Flip', win); % flip the buffer so the texture is drawn
KbWait; % wait for keystroke
Screen('Close', win); % close screen

Now I would expect to see this (four equally sized squares):

Expected result

But instead I get this (right and bottom sides are cut off and top left square is too large):

Actual result

Obviously the destination rectangle is a lot bigger than the source rectangle, so the texture needs to be magnified. I would expect this to happen symmetrically like in the first picture and this is also what I need. Why is this not happening and what can I do about it?

I have also tried using [128 0 1152 1024] as a destination rectangle (as it’s the square in the center of my screen). In this case, all sides are 1024, which makes each involved rectangle a power of 2. This does not help.
Increasing the size of the checkerboard results in a similar situation where the right- and bottommost sides are not showed correctly.

Like I said, I use Psychtoolbox, but I know that it uses OpenGL under the hood. I don’t know much about OpenGL either, but maybe someone who does can help without knowing Matlab. I don’t know.

Thanks for your time!

  • 1 1 Answer
  • 3 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T16:23:20+00:00Added an answer on May 11, 2026 at 4:23 pm

    Without knowing a lot about the Psychtoolbox, but having dealt with graphics and user interfaces a lot in MATLAB, the first thing I would try would be to fiddle with the fourth input to Screen (the “source” input). Try shifting each corner by half-pixel and whole-pixel values. For example, the first thing I would try would be:

    Screen('DrawTexture', win, tex, [0 0 2.5 2.5], [100 100 200 200], 0, 0);
    

    And if that didn’t seem to do anything, I would next try:

    Screen('DrawTexture', win, tex, [0 0 3 3], [100 100 200 200], 0, 0);
    

    My reasoning for this advice: I’ve noticed sometimes that images or GUI controls in my figures can appear to be off by a pixel, which I can only speculate is some kind of round-off error when scaling or positioning them.

    That’s the best advice I can give. Hope it helps!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 149k
  • Answers 149k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer There was an add-on tool someone mentioned to me, using… May 12, 2026 at 9:32 am
  • Editorial Team
    Editorial Team added an answer This is more general than just building websites. This is… May 12, 2026 at 9:32 am
  • Editorial Team
    Editorial Team added an answer Yes exploded means than instead of deploying a WAR/EAR file… May 12, 2026 at 9:32 am

Related Questions

I'm having a problem with an application hanging and giving me the default Please
There are quite a number of modules on CPAN relating to the creation and
I'd like to learn how to effectively use Swing Application Framework . Most of
I need to do a simple progress indicator while loading an image on background.

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.