[Search for users]
[Overall Top Noters]
[List of all Conferences]
[Download this site]
Title: | open3d |
Notice: | Kits on notes 3 and 4; Documents note 223 |
Moderator: | WRKSYS::COULTER |
|
Created: | Wed Dec 09 1992 |
Last Modified: | Fri Jun 06 1997 |
Last Successful Update: | Fri Jun 06 1997 |
Number of topics: | 1306 |
Total number of notes: | 5260 |
Hi everybody,
My customer is porting a program from an Intergraph machine (NT 3.51) on
- Personal Workstation 433a
- NT 4.0 SP 2
- PowerStorm 4D40T (GSS 4.0)
This program use glBindTexture function. If extension
GL_EXT_texture_object
is present, pointer on glBindTextureEXT is searched using wglGetProcAddress.
On PWS wglGetProcAddress return NULL because function is not find.
We try to call glBindTexture directly, link is ok but execution is not
correct.
Is it possible to use glBindTexture() with NT4.0 and 4D40T graphic card
(GSS4.0) ?
Thanks in advance, Bye.
--------------------------------------------------------------------------
#include <windows.h>
#include <stdio.h>
#include <string.h>
#include <GL/gl.h>
#include <GL/glu.h>
void
printDisplay( HDC hdc )
{
printf("Display: %dx%dx%d bits\n", GetDeviceCaps( hdc, HORZRES ),
GetDev
iceCaps( hdc, VERTRES ),
GetDeviceCaps( hdc, BITSPIXEL ) );
}
int
isExtensionSupported(char *extension)
{
static const GLubyte *extensions = NULL;
const GLubyte *start;
GLubyte *where, *terminator;
/* Extension names should not have spaces. */
where = (GLubyte *) strchr(extension, ' ');
if (where || *extension == '\0')
return 0;
if (!extensions)
extensions = glGetString(GL_EXTENSIONS);
/* It takes a bit of care to be fool-proof about parsing the
OpenGL extensions string. Don't be fooled by sub-strings,
etc. */
start = extensions;
for (;;) {
where = (GLubyte *) strstr((const char *)start, extension);
if (!where)
break;
terminator = where + strlen(extension);
if (where == start || *(where - 1) == ' ') {
if (*terminator == ' ' || *terminator == '\0') {
return 1;
}
}
start = terminator;
}
return 0;
}
void
printOpenGLInfo( HDC hdc )
{
PIXELFORMATDESCRIPTOR pfd, bestPFD;
int bestPixelFormat,i, maxColorBits;
i = 0;
bestPixelFormat = 0;
maxColorBits = GetDeviceCaps( hdc, BITSPIXEL );
if ( maxColorBits > 24 ) maxColorBits = 24;
while ( DescribePixelFormat(hdc, ++i, sizeof(PIXELFORMATDESCRIPTOR),
&pf
d) )
{
if ( !(pfd.dwFlags & PFD_SUPPORT_OPENGL) /* No OpenGL support
*
/
in a window */
|| !(pfd.dwFlags & PFD_DOUBLEBUFFER) /* No double
buffer
ing */
|| pfd.iLayerType != PFD_MAIN_PLANE /* Overlay or
inderl
ay */
|| pfd.iPixelType == PFD_TYPE_COLORINDEX /* No true
colo
r */
// || pfd.cColorBits < maxColorBits /* Color limited */
|| pfd.cColorBits != GetDeviceCaps( hdc, BITSPIXEL )
/*
Color limited */
|| !pfd.cDepthBits ) /* No Z buffer */
continue;
if ( bestPixelFormat )
{
/*
* If they exist, accelerated pixel formats are always preferred over generic
pi
xel formats
* We want to have the widest available range for Z which is compatible with
ste
ncil planes
* ( just one plane is needed ).
*/
if ( (bestPFD.dwFlags & PFD_GENERIC_FORMAT) ==
(pfd.dwFl
ags & PFD_GENERIC_FORMAT) )
{
if ( bestPFD.cStencilBits && !pfd.cStencilBits
)
continue;
else
if ( pfd.cDepthBits <= bestPFD.cDepthBits )
continue;
}
else if ( pfd.dwFlags & PFD_GENERIC_FORMAT ) continue;
}
bestPixelFormat = i;
bestPFD = pfd;
}
if ( bestPixelFormat )
{
HGLRC hglrc;
printf(" Best Pixel Format %d\n",bestPixelFormat);
printf(" ColorBits - %d\n", bestPFD.cColorBits);
printf(" DepthBits - %d\n", bestPFD.cDepthBits);
printf(" StencilBits - %d\n", bestPFD.cStencilBits);
SetPixelFormat( hdc, bestPixelFormat, &pfd );
hglrc = wglCreateContext( hdc );
wglMakeCurrent( hdc, hglrc );
printf("OpenGL Vendor %s\n", glGetString(GL_VENDOR));
printf("OpenGL Version %s\n", glGetString(GL_VERSION));
printf("OpenGL Renderer %s\n", glGetString(GL_RENDERER));
printf("OpenGL Extensions %s\n", glGetString(GL_EXTENSIONS));
#ifdef GLU_VERSION_1_1
printf("GLU Version %s\n", gluGetString(GLU_VERSION));
printf("GLU Extensions %s\n", gluGetString(GLU_EXTENSIONS));
#endif
printf( "\n" );
if ( isExtensionSupported("GL_EXT_texture_object") )
{
if ( !wglGetProcAddress((LPCSTR) "glBindTextureEXT") )
printf( "GL_EXT_texture_object functions not
ava
ilable !\n" );
else
printf( "GL_EXT_texture_object available\n" );
}
else
printf( "GL_EXT_texture_object not available\n" );
}
else
printf("No accelerated OpenGL support\n");
}
static void
PrintMessage( const char *Format, ... )
{
va_list ArgList;
char Buffer[256];
va_start(ArgList, Format);
vsprintf(Buffer, Format, ArgList);
va_end(ArgList);
MessageBox(GetFocus(), Buffer, "Error", MB_OK);
}
long WINAPI
processEvents(HWND hWnd, UINT message, DWORD wParam, LONG lParam)
{
return(DefWindowProc( hWnd, message, wParam, lParam));
}
void
main( void )
{
char *lpszClassName = "Open GL";
WNDCLASS wndclass;
HANDLE hInstance;
ATOM aRegister;
HWND hwnd;
PIXELFORMATDESCRIPTOR pfd;
HDC hdc;
int iPixelFormat;
hInstance = GetModuleHandle(NULL);
wndclass.style = CS_HREDRAW | CS_VREDRAW;
wndclass.lpfnWndProc = (WNDPROC)processEvents;
wndclass.cbClsExtra = 0;
wndclass.cbWndExtra = 0;
wndclass.hInstance = hInstance;
wndclass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
wndclass.hbrBackground = GetStockObject(BLACK_BRUSH);
wndclass.lpszMenuName = NULL;
wndclass.lpszClassName = (LPCSTR)lpszClassName;
aRegister = RegisterClass(&wndclass);
/*
* If the window failed to register, then there's no
* need to continue further.
*/
if(0 == aRegister)
{
PrintMessage("Failed to register window class\n");
return;
}
hwnd = CreateWindow(
lpszClassName,
"PFDList",
WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN | WS_CLIPSIBLINGS,
CW_USEDEFAULT,
CW_USEDEFAULT,
200,
200,
NULL,
NULL,
hInstance,
NULL);
hdc = GetDC( hwnd );
printDisplay( hdc );
printOpenGLInfo( hdc );
// obtain detailed information about
// the device context's nth pixel format
#if 0
iPixelFormat = 1;
while ( DescribePixelFormat(hdc, iPixelFormat,
sizeof(PIXELFORMATDESCRIPTOR), &pfd) )
{
printf("Pixel format %d\n", iPixelFormat);
printf(" dwFlags - 0x%x ", pfd.dwFlags);
if (pfd.dwFlags & PFD_DOUBLEBUFFER) printf("PFD_DOUBLEBUFFER
");
if (pfd.dwFlags & PFD_STEREO) printf("PFD_STEREO ");
if (pfd.dwFlags & PFD_DRAW_TO_WINDOW)
printf("PFD_DRAW_TO_WINDOW
");
if (pfd.dwFlags & PFD_DRAW_TO_BITMAP)
printf("PFD_DRAW_TO_BITMAP
");
if (pfd.dwFlags & PFD_SUPPORT_GDI) printf("PFD_SUPPORT_GDI ");
if (pfd.dwFlags & PFD_SUPPORT_OPENGL)
printf("PFD_SUPPORT_OPENGL
");
if (pfd.dwFlags & PFD_GENERIC_FORMAT)
printf("PFD_GENERIC_FORMAT
");
if (pfd.dwFlags & PFD_NEED_PALETTE) printf("PFD_NEED_PALETTE
");
if (pfd.dwFlags & PFD_NEED_SYSTEM_PALETTE)
printf("PFD_NEED_SYST
EM_PALETTE ");
printf("\n");
printf(" iPixelType - %d ", pfd.iPixelType);
if (pfd.iPixelType == PFD_TYPE_RGBA)
printf("PGD_TYPE_RGBA\n");
if (pfd.iPixelType == PFD_TYPE_COLORINDEX)
printf("PGD_TYPE_COLO
RINDEX\n");
printf(" cColorBits - %d\n", pfd.cColorBits);
printf(" cRedBits - %d\n", pfd.cRedBits);
printf(" cRedShift - %d\n", pfd.cRedShift);
printf(" cGreenBits - %d\n", pfd.cGreenBits);
printf(" cGreenShift - %d\n", pfd.cGreenShift);
printf(" cBlueBits - %d\n", pfd.cBlueBits);
printf(" cBlueShift - %d\n", pfd.cBlueShift);
printf(" cAlphaBits - %d\n", pfd.cAlphaBits);
printf(" cAlphaShift - 0x%x\n", pfd.cAlphaShift);
printf(" cAccumBits - %d\n", pfd.cAccumBits);
printf(" cAccumRedBits - %d\n", pfd.cAccumRedBits);
printf(" cAccumGreenBits - %d\n", pfd.cAccumGreenBits);
printf(" cAccumBlueBits - %d\n", pfd.cAccumBlueBits);
printf(" cAccumAlphaBits - %d\n", pfd.cAccumAlphaBits);
printf(" cDepthBits - %d\n", pfd.cDepthBits);
printf(" cStencilBits - %d\n", pfd.cStencilBits);
printf(" cAuxBuffers - %d\n", pfd.cAuxBuffers);
printf(" iLayerType - %d\n", pfd.iLayerType);
printf(" bReserved - %d\n", pfd.bReserved);
printf(" dwLayerMask - 0x%x\n", pfd.dwLayerMask);
printf(" dwVisibleMask - 0x%x\n", pfd.dwVisibleMask);
printf(" dwDamageMask - 0x%x\n", pfd.dwDamageMask);
MessageBox(GetFocus(), "Press OK to continue", "Continue",
MB_OK
);
iPixelFormat++;
}
MessageBox(GetFocus(), "Press OK to stop", "Stop", MB_OK);
#endif
}
[Posted by WWW Notes gateway]
T.R | Title | User | Personal Name | Date | Lines |
---|
1281.1 | Upgrade GSS | WRKSYS::DOTY | Russ Doty, Graphics and Multimedia | Tue Apr 29 1997 13:29 | 3 |
| I'd recommend upgrading to the GSS 4.1 or 4.2 releases -- prefferably
GSS 4.2 (I believe its available for field test). GSS 4.2 provides
full OpenGL 1.1 compliance, including bind texture.
|
1281.2 | fixewd | BGSDEV::POEGEL | | Wed Apr 30 1997 10:20 | 15 |
|
>> <<< Note 1281.0 by NNTPD::"[email protected]" "Patrick FELIX" >>>
>> -< Problem with glBindTexture >-
This was a bug in the V4.0 driver. It was fixed in the V4.1 driver.
The V4.1 driver and the field test T4.2 driver is available on the
web at www.service.digital.com/open3d/
We found this ourselves when we were trying to get a version of
the game "QUAKE" to run. (It runs now, stay tuned for a version to be
made generally available.)
Garry
|