I’m trying to setup my world using normalised coordinates (-1->1) rather than screen (0->ofGetScreenWidth())
so my vertices of my objects would be like
but it seems that if I call glLoadIdentity();
i dont get anything on my screen at all.
I tried setting my verticies to both normalised and screen coordinates but I dont seem to get anything
if i dont call glLoadIdentity() then I get verticies on my screen.
Is there something I’m missing? e.g. a clipping plane might be applied somewhere?
Currently I’m using ofx3Dutils to get around it (with screen coordinates) which works nicely.
But i’d rather get back to normalised if possible as a lot of the maths I want to do is quite messy in screen coordinates.
Maybe nobody else has experienced this?
it seems i can get to normalised by playing with ofx3DUtils.
I think it’s just the example file where it’s setup for screen coordinates.
it’s pretty nice
question still stands about glLoadIdentity though
If you just want to use normalized coordinates, you could try something like:
float norm = 1 / ofGetHeight();
glScalef(norm, norm, norm);
Before you do anything else.
That said, I’m pretty sure glLoadIdentity will put 0,0 in the corner of the screen and make +y “up”. So you might just be rendering offscreen.
Where and why are you calling glLoadIdentity? This will normally clear either the projection or view-model matrix depending in what state you are in, and therefore clear stuff.
In ofx3DUtils I have added this function:
This sets the scene to use OF coordinates:
or you can set the origin (0,0,0) to be the centre of the screen if you call this:
To normalize coordinates to -1,1 you should try what Kyle suggests.