Thanks! But how do I ensure a quad for example is the same size in 800x600 as it is in 1024x768? That's the bit I don't understand.
For example;
Code:
#include <GL/glfw.h>
#include <stdio.h>
int main(void)
{
int running = GL_TRUE;
int width = 800, height = 600;
glfwInit();
glfwOpenWindow( width, height, /* width, height */
8, 8, 8, /* red bits, green bits, blue bits = 8 + 8 + 8 = 24bits */
8, /* alpha buffer bits */
0, /* depth buffer bits */
0, /* stencil buffer bits */
GLFW_WINDOW
);
/* orthographic projection */
glViewport(0, 0, width, height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D(0.0f, width, height, 0.0f);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
/* loop */
while(running == GL_TRUE)
{
glClear(GL_COLOR_BUFFER_BIT);
glLoadIdentity();
/* I'd perform scaling etc here? We are at the origin after all */
/* I want the object in the middle, move to 400, 300 */
glTranslatef(400, 300, 0);
/* --- */
glColor3ub(255, 255, 255);
/* vertex: top left, bottom left, bottom right, top right
* NOTE: this is in pixels and won't scale with the scren resolution */
glBegin(GL_QUADS);
/* top left */
glVertex2i(0, 0);
glVertex2i(0, 100);
glVertex2i(100, 100);
glVertex2i(100, 0);
glEnd();
/* --- */
glfwSwapBuffers();
running = glfwGetWindowParam(GLFW_OPENED);
}
glfwTerminate();
return 0;
}
I know you're a DX man, but it's all the same. I've seen other people work in a fixed resolution (say 1000x800) and "normalize". Although that's the same idea I had really...
[edit]
Research it seems a lot of people normalize... but I really don't want to do that.
[/edit]