views:

69

answers:

2

I have create my own NSOpenGLView class, right now the data that i want to displayed with an inverted co-ordinate system.

The origin starts at the bottom-left corner. I would like to change it so that the co-ordinate starts at the top-left corner.

How should I inverted the view/setup a new co-ordinate system.

A: 

My OpenGL skills are pretty weak, but I believe you can use the glViewport function to move the origin to the top right. Then you'll probably need to use all negative numbers for everything in the screen. You could then try using glRotate to use all positive numbers. I haven't actually tried this, but see what you can do with it.

glViewPort(0.0, -height, width, height);
glRotatef(180.0, 1.0, 0.0, 0.0);
Cory Kilger
I tried out your code with glViewport(0.0, -[self bounds].size.height, [self bounds].size.width, [self bounds].size.height); glRotatef(180.0, 1.0, 0.0, 0.0);And it doesn't work. I modified it to glRotatef(180, [self bounds].size.width / 2, [self bounds].size.height / 2, 0); and it only rotate the stream by 90 degrees. I think I m going to try and reverse by yuv feed buffer to account for the screen inversion
ReachConnection
A: 

I have the solution

 glPushMatrix();
 glRotatef( 180.0f, 1.0f, 0.0f, 0.0f );
ReachConnection