A rectangle as a inclined parallelogram

Hello everyone, I was trying to make an example using openGL and then porting it to openGLES.
I draw a rectangle like this:
v0 = -1.0, 0.0, 0
v1 = -1.0, 1.0, 0
v2 = 1.0, 1.0, 0
v3 = 1.0, 0, 0
GLfloat vertices[] = {v0,v1,v2,v3};

glVertexPointer(3, GL_FLOAT, 0, vertices);
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);

and in desktop I see it right but when I port the code to openGLES I see it like a parallelogram with a 45º inclination.
Desktop vs. PDA

Can anybody tell me what can make this transformation?
Thanks in advance,
Santiago

Hello Santiago,

My first reaction to seeing those images is that that is not a tranformation problem but a pixel copy problem.

Given those images, it seems the implementation is copying scan lines to the frame buffer from bottom to top and that it’s copying one pixel more per line than it should. That creates the vertical bar you can find at the top right of the image. If you just draw an empty scene does that black bar (or garbage pixels) still appear at the top right?

If this is the problem I would have no idea about how to go about fixing it. It’s seems to be a bug with memory copying so I’d start by checking all the places where you are copying into the framebuffer.

I hope that helps,
Ian

Hi, thanks a lot for your reply.

…If you just draw an empty scene does that black bar (or garbage pixels) still appear at the top right?..

I’ve just tried and yes… it still appear. I also made another test, I draw an empty scene with another size (an square of 191X191).
The result:

In this example I have 2 black bars, so it incremments the amount of garbage pixels.
It seems to be what you said, but I don’t know what can I do to fix it.
I’m using Vincent implementation and I’m doing all the test in an IPaq hx2700 with Win Mobile5. Do you recommend me another opengles implementation?
I’m going to see what you said, the places where I copy into the framebuffer.
Thanks,
Santiago

Sorry, I’m actually not familiar with opengl-es and it’s implementations enough to recommend a different version or a fix. With Vincent you have all the source code so maybe you can track it down.

Good Luck,
Ian

Problem fixed!
my surface was 1 pixel wider than the openGLES’s scene.
Thanks for the help, I wouldn’t discovered the error without your help.
Santiago

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.