1 | /* $Id: oglrender.h 98103 2023-01-17 14:15:46Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * OpenGL testcase. Interface for OpenGL tests.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2019-2023 Oracle and/or its affiliates.
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox base platform packages, as
|
---|
10 | * available from https://www.virtualbox.org.
|
---|
11 | *
|
---|
12 | * This program is free software; you can redistribute it and/or
|
---|
13 | * modify it under the terms of the GNU General Public License
|
---|
14 | * as published by the Free Software Foundation, in version 3 of the
|
---|
15 | * License.
|
---|
16 | *
|
---|
17 | * This program is distributed in the hope that it will be useful, but
|
---|
18 | * WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
20 | * General Public License for more details.
|
---|
21 | *
|
---|
22 | * You should have received a copy of the GNU General Public License
|
---|
23 | * along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
24 | *
|
---|
25 | * SPDX-License-Identifier: GPL-3.0-only
|
---|
26 | */
|
---|
27 |
|
---|
28 | #ifndef GA_INCLUDED_SRC_WINNT_Graphics_Video_disp_wddm_gallium_ogltest_oglrender_h
|
---|
29 | #define GA_INCLUDED_SRC_WINNT_Graphics_Video_disp_wddm_gallium_ogltest_oglrender_h
|
---|
30 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
31 | # pragma once
|
---|
32 | #endif
|
---|
33 |
|
---|
34 | #ifdef VBOX
|
---|
35 | #include <iprt/win/windows.h>
|
---|
36 | #else
|
---|
37 | #include <windows.h>
|
---|
38 | #endif
|
---|
39 | #include <GL/gl.h>
|
---|
40 | #include <GL/glu.h>
|
---|
41 | #include <glext.h>
|
---|
42 |
|
---|
43 | inline void TestShowError(HRESULT hr, const char *pszString)
|
---|
44 | {
|
---|
45 | (void)hr;
|
---|
46 | MessageBoxA(0, pszString, 0, 0);
|
---|
47 | }
|
---|
48 | /* Expand __LINE__ number to a string. */
|
---|
49 | #define OGLTEST_S(n) #n
|
---|
50 | #define OGLTEST_N2S(n) OGLTEST_S(n)
|
---|
51 |
|
---|
52 | #define GL_CHECK_ERROR() do { if (glGetError() != GL_NO_ERROR) TestShowError((E_FAIL), __FILE__ "@" OGLTEST_N2S(__LINE__)); } while(0)
|
---|
53 |
|
---|
54 | class OGLRender
|
---|
55 | {
|
---|
56 | public:
|
---|
57 | OGLRender() {}
|
---|
58 | virtual ~OGLRender() {}
|
---|
59 | virtual HRESULT InitRender() = 0;
|
---|
60 | virtual HRESULT DoRender() = 0;
|
---|
61 | virtual void TimeAdvance(float dt) { (void)dt; return; }
|
---|
62 | };
|
---|
63 |
|
---|
64 | OGLRender *CreateRender(int iRenderId);
|
---|
65 | void DeleteRender(OGLRender *pRender);
|
---|
66 |
|
---|
67 | extern PFNGLBINDBUFFERPROC glBindBuffer;
|
---|
68 | extern PFNGLDELETEBUFFERSPROC glDeleteBuffers;
|
---|
69 | extern PFNGLGENBUFFERSPROC glGenBuffers;
|
---|
70 | extern PFNGLBUFFERDATAPROC glBufferData;
|
---|
71 | extern PFNGLMAPBUFFERPROC glMapBuffer;
|
---|
72 | extern PFNGLUNMAPBUFFERPROC glUnmapBuffer;
|
---|
73 | extern PFNGLENABLEVERTEXATTRIBARRAYPROC glEnableVertexAttribArray;
|
---|
74 | extern PFNGLDISABLEVERTEXATTRIBARRAYPROC glDisableVertexAttribArray;
|
---|
75 | extern PFNGLVERTEXATTRIBPOINTERPROC glVertexAttribPointer;
|
---|
76 | extern PFNGLCREATESHADERPROC glCreateShader;
|
---|
77 | extern PFNGLATTACHSHADERPROC glAttachShader;
|
---|
78 | extern PFNGLCOMPILESHADERPROC glCompileShader;
|
---|
79 | extern PFNGLCREATEPROGRAMPROC glCreateProgram;
|
---|
80 | extern PFNGLDELETEPROGRAMPROC glDeleteProgram;
|
---|
81 | extern PFNGLDELETESHADERPROC glDeleteShader;
|
---|
82 | extern PFNGLDETACHSHADERPROC glDetachShader;
|
---|
83 | extern PFNGLLINKPROGRAMPROC glLinkProgram;
|
---|
84 | extern PFNGLSHADERSOURCEPROC glShaderSource;
|
---|
85 | extern PFNGLUSEPROGRAMPROC glUseProgram;
|
---|
86 | extern PFNGLGETPROGRAMIVPROC glGetProgramiv;
|
---|
87 | extern PFNGLGETPROGRAMINFOLOGPROC glGetProgramInfoLog;
|
---|
88 | extern PFNGLGETSHADERIVPROC glGetShaderiv;
|
---|
89 | extern PFNGLGETSHADERINFOLOGPROC glGetShaderInfoLog;
|
---|
90 | extern PFNGLVERTEXATTRIBDIVISORPROC glVertexAttribDivisor;
|
---|
91 | extern PFNGLDRAWARRAYSINSTANCEDPROC glDrawArraysInstanced;
|
---|
92 |
|
---|
93 | #endif /* !GA_INCLUDED_SRC_WINNT_Graphics_Video_disp_wddm_gallium_ogltest_oglrender_h */
|
---|