I find the OpenGL Co-ordinate system really hard to use. I would much rather have things like glVertex2f(-100,-100) put a vertex back 100 pixels in the X and Y direction from the origin, instead of it being totally off the screen. Is there any way that I can do this? I was thinking mabey just glTranslate'ing out in the Z direction but I am not sure if this will work.

Recommended Answers

All 2 Replies

Well, to work in screen co-ordinates, you will have to use glDrawPixels. But it is really suggested that you do not use it.

If i understand you correctly, you mean you want to directly draw a line on the screen in terms of pixels right? i doubt there is a function to draw a line. You can explicitly use a buffer, store the pixel values in it and the draw it. But it would not be a good idea to do it that way.

Or, you could set up an orthographic projection as

glOrtho(0, winWidth, 0, winHeight, -1, 1);
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.