#165954 - Kath - Wed Jan 14, 2009 9:19 am
Hello, I'm trying to use glOrtho() to be able to draw to the screen using pixel coordinates in 3d, so setting it to 256x192. I did this before in an older project but copying this code to the new one results in nothing displaying, I've since tried using the Ortho example code which works but when I change the values I get nothing again.
For example this code displays as expected, a quad taking up the top left 1/4 of the screen:
However this code results in nothing being drawn:
I'm wondering if I'm doing something extremely wrong here. My 3d setup is below:
Thanks in advance.
For example this code displays as expected, a quad taking up the top left 1/4 of the screen:
Code: |
glOrtho(0, 6, 6, 0, 1, 100);
glBegin(GL_QUADS); glVertex3v16( inttov16(0), inttov16(0), inttov16(-1) ); glVertex3v16( inttov16(0), inttov16(3), inttov16(-1) ); glVertex3v16( inttov16(3), inttov16(3), inttov16(-1) ); glVertex3v16( inttov16(3), inttov16(0), inttov16(-1) ); glEnd(); |
However this code results in nothing being drawn:
Code: |
glOrtho(0, 256, 192, 0, 1, 100);
glBegin(GL_QUADS); glVertex3v16( inttov16(100), inttov16(100), inttov16(-1) ); glVertex3v16( inttov16(100), inttov16(150), inttov16(-1) ); glVertex3v16( inttov16(200), inttov16(150), inttov16(-1) ); glVertex3v16( inttov16(200), inttov16(100), inttov16(-1) ); glEnd(); |
I'm wondering if I'm doing something extremely wrong here. My 3d setup is below:
Code: |
void Setup3d()
{ glInit(); // Enable AA, textures and blending. glEnable( GL_ANTIALIAS ); glEnable( GL_TEXTURE_2D ); glEnable( GL_BLEND ); // Setup the background. glClearColor( 16, 16, 16, 31 ); glClearPolyID( 63 ); glClearDepth( 0x7FFF ); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glMaterialf(GL_AMBIENT, RGB15(16,16,16)); glMaterialf(GL_DIFFUSE, RGB15(16,16,16)); glMaterialf(GL_SPECULAR, BIT(15) | RGB15(8,8,8)); glMaterialf(GL_EMISSION, RGB15(16,16,16)); glPolyFmt( POLY_ID(0) | POLY_ALPHA(31) | POLY_CULL_NONE ); // Set our viewport to be the same size as the screen glViewport(0,0,255,191); // Set ortho mode. glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrtho(0, 6, 6, 0, 1, 100); } |
Thanks in advance.