mirror of
https://github.com/reactos/reactos.git
synced 2025-07-28 12:22:04 +00:00
Implementing OpenGl support
svn path=/trunk/; revision=6000
This commit is contained in:
parent
625bd1a280
commit
81b36f5903
3 changed files with 181 additions and 79 deletions
|
@ -1,4 +1,4 @@
|
|||
# $Id: makefile,v 1.32 2003/08/07 04:03:22 royce Exp $
|
||||
# $Id: makefile,v 1.33 2003/09/06 16:50:10 jimtabor Exp $
|
||||
|
||||
PATH_TO_TOP = ../..
|
||||
|
||||
|
@ -29,6 +29,7 @@ MISC_OBJECTS = \
|
|||
misc/stubs.o \
|
||||
misc/stubsa.o \
|
||||
misc/stubsw.o \
|
||||
misc/wingl.o \
|
||||
misc/win32k.o
|
||||
|
||||
OBJECTS_OBJECTS = \
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: stubs.c,v 1.32 2003/08/28 19:37:00 gvg Exp $
|
||||
/* $Id: stubs.c,v 1.33 2003/09/06 16:50:11 jimtabor Exp $
|
||||
*
|
||||
* reactos/lib/gdi32/misc/stubs.c
|
||||
*
|
||||
|
@ -68,21 +68,6 @@ Chord(
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
*/
|
||||
int
|
||||
STDCALL
|
||||
ChoosePixelFormat(
|
||||
HDC a0,
|
||||
CONST PIXELFORMATDESCRIPTOR *a1
|
||||
)
|
||||
{
|
||||
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
*/
|
||||
|
@ -156,24 +141,6 @@ DeleteMetaFile(
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
*/
|
||||
int
|
||||
STDCALL
|
||||
DescribePixelFormat(
|
||||
HDC a0,
|
||||
int a1,
|
||||
UINT a2,
|
||||
LPPIXELFORMATDESCRIPTOR a3
|
||||
)
|
||||
{
|
||||
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
*/
|
||||
|
@ -461,20 +428,6 @@ GetPixel(
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
*/
|
||||
int
|
||||
STDCALL
|
||||
GetPixelFormat(
|
||||
HDC a0
|
||||
)
|
||||
{
|
||||
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
*/
|
||||
|
@ -824,22 +777,6 @@ SetPixelV(
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
*/
|
||||
BOOL
|
||||
STDCALL
|
||||
SetPixelFormat(
|
||||
HDC a0,
|
||||
int a1,
|
||||
CONST PIXELFORMATDESCRIPTOR *a2
|
||||
)
|
||||
{
|
||||
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
*/
|
||||
|
@ -1905,20 +1842,6 @@ wglShareLists(
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
*/
|
||||
BOOL
|
||||
STDCALL
|
||||
SwapBuffers(
|
||||
HDC a0
|
||||
)
|
||||
{
|
||||
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
*/
|
||||
|
|
178
reactos/lib/gdi32/misc/wingl.c
Normal file
178
reactos/lib/gdi32/misc/wingl.c
Normal file
|
@ -0,0 +1,178 @@
|
|||
/*
|
||||
* ReactOS Gdi32
|
||||
* Copyright (C) 2003 ReactOS Team
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#undef WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#include <ddk/ntddk.h>
|
||||
|
||||
|
||||
#define NDEBUG
|
||||
#include <win32k/debug1.h>
|
||||
|
||||
|
||||
|
||||
typedef int (*CHOOSEPIXELFMT) (HDC, CONST PIXELFORMATDESCRIPTOR *);
|
||||
typedef BOOL (*SETPIXELFMT) (HDC, int, CONST PIXELFORMATDESCRIPTOR *);
|
||||
typedef BOOL (*SWAPBUFFERS) (HDC hdc);
|
||||
typedef int (*DESCRIBEPIXELFMT) (HDC, int, UINT, LPPIXELFORMATDESCRIPTOR);
|
||||
typedef int (*GETPIXELFMT) (HDC);
|
||||
|
||||
|
||||
static CHOOSEPIXELFMT glChoosePixelFormat = NULL;
|
||||
static SETPIXELFMT glSetPixelFormat = NULL;
|
||||
static SWAPBUFFERS glSwapBuffers = NULL;
|
||||
static DESCRIBEPIXELFMT glDescribePixelFormat = NULL;
|
||||
static GETPIXELFMT glGetPixelFormat = NULL;
|
||||
static HINSTANCE hOpenGL = NULL;
|
||||
|
||||
static BOOL OpenGLEnable(void)
|
||||
{
|
||||
if(hOpenGL == NULL)
|
||||
{
|
||||
hOpenGL = LoadLibraryA("OPENGL32.DLL");
|
||||
if(hOpenGL == NULL)
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
if(glChoosePixelFormat == NULL) {
|
||||
glChoosePixelFormat = (CHOOSEPIXELFMT)GetProcAddress(hOpenGL, "wglChoosePixelFormat");
|
||||
if(glChoosePixelFormat == NULL)
|
||||
return(0);
|
||||
}
|
||||
|
||||
if(glSetPixelFormat == NULL) {
|
||||
glSetPixelFormat = (SETPIXELFMT)GetProcAddress(hOpenGL, "wglSetPixelFormat");
|
||||
if(glSetPixelFormat == NULL)
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
if(glSwapBuffers == NULL) {
|
||||
glSwapBuffers = (SWAPBUFFERS)GetProcAddress(hOpenGL, "wglSwapBuffers");
|
||||
if(glSwapBuffers == NULL)
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
if(glDescribePixelFormat == NULL) {
|
||||
glDescribePixelFormat = (DESCRIBEPIXELFMT)GetProcAddress(hOpenGL, "wglDescribePixelFormat");
|
||||
if(glDescribePixelFormat == NULL)
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
if(glGetPixelFormat == NULL) {
|
||||
glGetPixelFormat = (GETPIXELFMT)GetProcAddress(hOpenGL, "wglGetPixelFormat");
|
||||
if(glGetPixelFormat == NULL)
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
return(TRUE); /* OpenGL is initialized and enabled*/
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
INT
|
||||
STDCALL
|
||||
ChoosePixelFormat(HDC hDC,
|
||||
CONST PIXELFORMATDESCRIPTOR * pfd)
|
||||
{
|
||||
if (glChoosePixelFormat == NULL)
|
||||
if (OpenGLEnable() == FALSE)
|
||||
return(0);
|
||||
|
||||
return(glChoosePixelFormat(hDC, pfd));
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
INT
|
||||
STDCALL
|
||||
DescribePixelFormat(HDC hDC,
|
||||
INT PixelFormat,
|
||||
UINT BufSize,
|
||||
LPPIXELFORMATDESCRIPTOR pfd)
|
||||
{
|
||||
if (glDescribePixelFormat == NULL)
|
||||
if (OpenGLEnable() == FALSE)
|
||||
return(0);
|
||||
|
||||
return(glDescribePixelFormat(hDC, PixelFormat, BufSize, pfd));
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
INT
|
||||
STDCALL
|
||||
GetPixelFormat(HDC hDC)
|
||||
{
|
||||
if (glGetPixelFormat == NULL)
|
||||
if (OpenGLEnable() == FALSE)
|
||||
return(0);
|
||||
|
||||
return(glGetPixelFormat(hDC));
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
BOOL
|
||||
STDCALL
|
||||
SetPixelFormat(HDC hDC,
|
||||
INT PixelFormat,
|
||||
CONST PIXELFORMATDESCRIPTOR * pfd)
|
||||
{
|
||||
if (glSetPixelFormat == NULL)
|
||||
if (OpenGLEnable() == FALSE)
|
||||
return(0);
|
||||
|
||||
return(glSetPixelFormat(hDC, PixelFormat, pfd));
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
BOOL
|
||||
STDCALL
|
||||
SwapBuffers(HDC hDC)
|
||||
{
|
||||
if (glSwapBuffers == NULL)
|
||||
if (OpenGLEnable() == FALSE)
|
||||
return(0);
|
||||
|
||||
|
||||
return(glSwapBuffers(hDC));
|
||||
}
|
||||
|
||||
/* EOF */
|
Loading…
Add table
Add a link
Reference in a new issue