Yes, other programs run fine. So you are saying that the below code is correct?
hmm... well, here''s the functions I use to enable/disable OGL.
///////////////////////////////////////// opengl.h#ifndef __OPENGL_H#define __OPENGL_H#include "window.h" // this is my windows init stuff#include <gl/gl.h>#define COLORBITS 24#define DEPTHBITS 16void enableOpenGL( HWND, HDC *, HGLRC * );void disableOpenGL( HWND, HDC, HGLRC );#endif///////////////////////////////////////////////#include "opengl.h"// opengl.cpp - my own file (is there another file in lib named the same?... i also have opengl.h// Enable OpenGLvoid enableOpenGL( HWND hWnd, HDC *hDC, HGLRC *hRC ){ PIXELFORMATDESCRIPTOR pfd; int format; // get the device context (DC) *hDC = GetDC( hWnd ); // set the pixel format for the DC ZeroMemory( &pfd, sizeof( pfd ) ); pfd.nSize = sizeof( pfd ); pfd.nVersion = 1; pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER; pfd.iPixelType = PFD_TYPE_RGBA; pfd.cColorBits = COLORBITS; pfd.cDepthBits = DEPTHBITS; pfd.iLayerType = PFD_MAIN_PLANE; format = ChoosePixelFormat( *hDC, &pfd ); SetPixelFormat( *hDC, format, &pfd ); // create and enable the render context (RC) *hRC = wglCreateContext( *hDC ); wglMakeCurrent( *hDC, *hRC ); }// Disable OpenGLvoid disableOpenGL( HWND hWnd, HDC hDC, HGLRC hRC ){ wglMakeCurrent( NULL, NULL ); wglDeleteContext( hRC ); ReleaseDC( hWnd, hDC );}///////////////////////////////// main.cpp#ifndef WIN32_LEAN_AND_MEAN#define WIN32_LEAN_AND_MEAN#endif//---------------------------------------------------------------------// INCLUDES//---------------------------------------------------------------------#include "window.h"#include "logger.h"#include "opengl.h"//---------------------------------------------------------------------// GLOBALS//---------------------------------------------------------------------HDC hDC;HGLRC hRC;//---------------------------------------------------------------------// PROTOTYPES//---------------------------------------------------------------------BOOL MAIN_Init( void );BOOL MAIN_Update( void );void MAIN_Release( void );//---------------------------------------------------------------------// IMPLEMENTATION//---------------------------------------------------------------------//=====================================================================// WinMain() - Main Program//=====================================================================int WINAPI WinMain( HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, int nCmdShow ){ MSG msg; if ( MAIN_Init() == FALSE ) { MAIN_Release(); return FALSE; } while ( TRUE ) { if ( PeekMessage( &msg, 0, 0, 0, PM_REMOVE ) == TRUE ) { if ( msg.message == WM_QUIT ) break; TranslateMessage( &msg ); DispatchMessage( &msg ); } if ( MAIN_Update() == FALSE ) break; } MAIN_Release(); return msg.wParam;}//=====================================================================// MAIN_Init() - Does some initializations before the main part starts//=====================================================================BOOL MAIN_Init( void ){ if ( LOGGER_Open( "log.txt" ) == FALSE ) return FALSE; if ( WINDOW_Init( GetModuleHandle( NULL ), WS_CAPTION | WS_POPUPWINDOW | WS_VISIBLE, SW_SHOW ) == FALSE ) { LOGGER_Write( "WINDOW_Init() error" ); return FALSE; } enableOpenGL( hMainWnd, &hDC, &hRC ); return TRUE;}//=====================================================================// MAIN_Update() - The main part of the program//=====================================================================BOOL MAIN_Update( void ){ if ( keys[ VK_ESCAPE ] ) return FALSE; glClear( GL_COLOR_BUFFER_BIT ); // Clear The Screen And The Depth Buffer glLoadIdentity(); glBegin( GL_QUADS ); // face 1 (front) glColor3f( 1, 0, 0 ); glVertex3f( 1, 1, 1 ); glVertex3f( 1, -1, 1 ); glVertex3f( -1, -1, 1 ); glVertex3f( -1, 1, 1 ); // face 2 (left) glColor3f( 0, 1, 0 ); glVertex3f( -1, 1, 1 ); glVertex3f( -1, -1, 1 ); glVertex3f( -1, -1, -1 ); glVertex3f( -1, 1, -1 ); // face 3 (back) glColor3f( 0, 0, 1 ); glVertex3f( 1, 1, -1 ); glVertex3f( 1, -1, -1 ); glVertex3f( -1, -1, -1 ); glVertex3f( -1, 1, -1 ); // face 4 (right) glColor3f( 1, 0, 0 ); glVertex3f( 1, 1, 1 ); glVertex3f( 1, -1, 1 ); glVertex3f( 1, -1, -1 ); glVertex3f( 1, 1, -1 ); // face 5 (top) glColor3f( 1, 1, 0 ); glVertex3f( 1, 1, 1 ); glVertex3f( -1, 1, 1 ); glVertex3f( -1, 1, -1 ); glVertex3f( 1, 1, -1 ); // face 6 (bottom) glColor3f( 0, 1, 1 ); glVertex3f( 1, -1, 1 ); glVertex3f( -1, -1, 1 ); glVertex3f( -1, -1, -1 ); glVertex3f( 1, -1, -1 ); glEnd(); SwapBuffers( hDC ); return TRUE;}//=====================================================================// MAIN_Release() - Releases all the subsystems//=====================================================================void MAIN_Release( void ){ disableOpenGL( hMainWnd, hDC, hRC ); LOGGER_Close();}
anything look suspicious? can anyone help me now?
-------------------------------
Did someone say "banana"?
..-=gLaDiAtOr=-..