How to magnify/stretch a texture with Matlab Psychtoolbox (OpenGL)? -
Update: This seems to be a problem only on some computers. Normal, intuitive code works in my home computer. , But there is a problem in the computer at work.
Home Computer: (no problem)
- Windows XP Professional SP3
- AMD Athlon 64 X2 3800+ Dual Core 2.0 GHz
- 2GB RAM
- Intel Pentium 4 2.8 GHz (Dual Core, I think)
- / Li>
- Intel 82945G Express Chipset Family
- 1 GB RAM
Task
Original Post:
I have a lot for a part Trying to apply simple texture using the following code in Matlab using the Psychtoolbox screen:
win = screen (open) Indo ', 0, 127); % Open window and window pointer TX = get screen ('architecture', win, [255 0; 0 255]); Get the texture indicator% draw text Args: Command, window pointer, texture pointer, source% (full 2x2 matrix), destination (100x100 square), rotation% (none) and filtering (closest neighbor) screen ('Draw Cloth' , Win, tex, [0 2 2], [100 100 200 200], 0, 0); Screen ('flip', win); Flip buffer so that texture is drawn; % Wait for keystroke screen ('off', win); % Off screen Now I'm hoping to see it (four equally sized classes):
But instead of me (The right and the bottom left is very big):
Obviously the destination rectangle source is very bigger than the rectangular, so the texture is bigger should be done. I hope this should be symmetrical in the first picture and this is what I need. Why is this not happening and what can I do about it?
I also tried to use [128 0 1152 1024] as a destination rectangle (because it is the square at the center of my screen). In this case, all the sides are 1024, which makes the power of rectangle 2 in each. It does not help. In such a situation, increasing the size of the checkerboard result, where the right- and the sides below are not shown correctly.
Like I said, I use psycholobes, but I know that it uses OpenGL under the hood. I do not know much about OpenGL, but maybe someone who can help without knowing the matlab I do not know.
Thank you for your time!
There is a lot about Psychtoolbox, but to work with graphics and user interfaces in MATLAB First of all, the first thing I will try will be fiddle with the fourth input of the screen ("source" input). Try moving from each corner to half-pixel and full-pixel values. For example, the first thing I try is:
screen ('Draw Cloth', Win, Tech, [2.5 2.5], [100 100 200 200], 0, 0) ; And if nothing looks like that, then I will try next:
screen ('Draw Cloth', Win, Tech, [0] ] 3 3], [100 100 200 200], 0, 0); My reasoning for this advice: I have ever seen that images or GUI controls in my data may be off by pixels, which I can only guess is that some kind of round-off error when scaling or positioning them. This is the best advice I can give. Hope it helps!
Comments
Post a Comment