Ummmm… I drew a triangle in 3D
[ATTACH=CONFIG]278[/ATTACH]
I then changed a z coordinate to be on a different z plane… but it doesnt work?
[ATTACH=CONFIG]277[/ATTACH]
Any ideas please?
#include "frmDeviceRender.h"
void initGL() {
glClearColor (0.0, 0.0, 0.0, 0.0);
glColor3f (1.0, 1.0, 1.0);
glOrtho(0.0, 10.0, 0.0, 10.0, -1.0, 10.0);
};
void drawIt() {
glClear (GL_COLOR_BUFFER_BIT);
glBegin(GL_TRIANGLES);
glVertex3f (2.5, 2.5, 8);
glVertex3f (7.5, 2.5, 0.0);
glVertex3f (7.5, 7.5, 0.0);
glEnd();
glFlush();
};
void FrmDeviceRender::populateForm() {
hdc = GetDC (me) ;
GLsizei width = 200;
GLsizei height = 200;
int bits = 32;
GLuint PixelFormat;
static PIXELFORMATDESCRIPTOR pfd=
{
sizeof(PIXELFORMATDESCRIPTOR), // Size Of This Pixel Format Descriptor
1, // Version Number
PFD_DRAW_TO_WINDOW | // Format Must Support Window
PFD_SUPPORT_OPENGL | // Format Must Support OpenGL
PFD_DOUBLEBUFFER, // Must Support Double Buffering
PFD_TYPE_RGBA, // Request An RGBA Format
bits, // Select Our Color Depth
0, 0, 0, 0, 0, 0, // Color Bits Ignored
0, // No Alpha Buffer
0, // Shift Bit Ignored
0, // No Accumulation Buffer
0, 0, 0, 0, // Accumulation Bits Ignored
16, // 16Bit Z-Buffer (Depth Buffer)
0, // No Stencil Buffer
0, // No Auxiliary Buffer
PFD_MAIN_PLANE, // Main Drawing Layer
0, // Reserved
0, 0, 0 // Layer Masks Ignored
};
if (!(PixelFormat=ChoosePixelFormat(hdc,&pfd))) {
MessageBox(NULL,L"Can't Find A Suitable PixelFormat.",L"ERROR",MB_OK|MB_ICONEXCLAMATION);
}
if(!SetPixelFormat(hdc,PixelFormat,&pfd)) {
MessageBox(NULL,L"Can't Set The PixelFormat.",L"ERROR",MB_OK|MB_ICONEXCLAMATION);
}
if (!(hRC=wglCreateContext(hdc))) {
MessageBox(NULL,L"Can't Create A GL Rendering Context.",L"ERROR",MB_OK|MB_ICONEXCLAMATION);
}
if(!wglMakeCurrent(hdc,hRC)) {
MessageBox(NULL,L"Can't Activate The GL Rendering Context.",L"ERROR",MB_OK|MB_ICONEXCLAMATION);
}
};
void FrmDeviceRender::onPaint() {
initGL();
drawIt();
SwapBuffers(hdc);
}
void FrmDeviceRender::onUnload() {
ReleaseDC (me, hdc) ;
PostQuitMessage (0);
};