I am having a problem drawing an image. When I draw the image at raster position (0,0) the final screen display is ok. When I draw the image at raster position (0,10) I can seen on the screen that the image is 14 pixels above the origin. Setting (0,20) draws 29 pixels above and setting raster position (0,30) draws at 43 pixels above the offset. This all suggests a scaling factor is being used (about 1.4).
This is (part of) my code:
public class Renderer implements GLEventListener {
private int pixelWidth,pixelHeight;
private byte[] pixels;
...
public void display(GLDrawable drawable) {
GL gl = drawable.getGL();
gl.glClear(GL.GL_COLOR_BUFFER_BIT);
gl.glRasterPos2i(0,30);
gl.glDrawPixels(pixelWidth, pixelHeight-30, GL.GL_RGBA, GL.GL_UNSIGNED_BYTE, pixels);
}
public void init(GLDrawable drawable) {
}
public void reshape(GLDrawable drawable, int x, int y, int width, int height) {
GL gl = drawable.getGL();
GLU glu = drawable.getGLU();
gl.glViewport(0, 0, height, width);
gl.glMatrixMode(GL.GL_PROJECTION);
gl.glLoadIdentity();
glu.gluOrtho2D(0.0, width, 0.0, height);
gl.glMatrixMode(GL.GL_MODELVIEW);
gl.glLoadIdentity();
}
public void displayChanged(GLDrawable drawable, boolean modeChanged, boolean deviceChanged) {
}
}
What am I missing here? ???