FreeWRL / FreeX3D 4.3.0
display.c
1/*
2
3 FreeWRL support library.
4 Display (X11/Motif or OSX/Aqua) initialization.
5
6*/
7
8/****************************************************************************
9 This file is part of the FreeWRL/FreeX3D Distribution.
10
11 Copyright 2009 CRC Canada. (http://www.crc.gc.ca)
12
13 FreeWRL/FreeX3D is free software: you can redistribute it and/or modify
14 it under the terms of the GNU Lesser Public License as published by
15 the Free Software Foundation, either version 3 of the License, or
16 (at your option) any later version.
17
18 FreeWRL/FreeX3D is distributed in the hope that it will be useful,
19 but WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 GNU General Public License for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with FreeWRL/FreeX3D. If not, see <http://www.gnu.org/licenses/>.
25****************************************************************************/
26
27#include <config.h>
28#include <system.h>
29#include <system_threads.h>
30#include <internal.h>
31#include <display.h>
32#include <threads.h>
33#include <libFreeWRL.h>
34
35#include "vrml_parser/Structs.h"
36#include "opengl/RasterFont.h"
37#include "opengl/OpenGL_Utils.h"
38#include "opengl/Textures.h"
39//JAS #include "scenegraph/Collision.h"
40
41#include "ui/common.h"
42
43#if defined(FREEWRL_PLUGIN) && (defined(TARGET_X11) || defined(TARGET_MOTIF))
44#include "plugin/pluginUtils.h"
45#endif
46
47
48// OLD_IPHONE_AQUA #if defined (TARGET_AQUA)
49// OLD_IPHONE_AQUA #ifndef IPHONE
50// OLD_IPHONE_AQUA int PaneClipnpx;
51// OLD_IPHONE_AQUA int PaneClipnpy;
52// OLD_IPHONE_AQUA
53// OLD_IPHONE_AQUA int PaneClipct;
54// OLD_IPHONE_AQUA int PaneClipcb;
55// OLD_IPHONE_AQUA int PaneClipcr;
56// OLD_IPHONE_AQUA int PaneClipcl;
57// OLD_IPHONE_AQUA int PaneClipwidth;
58// OLD_IPHONE_AQUA int PaneClipheight;
59// OLD_IPHONE_AQUA int PaneClipChanged = FALSE;
60// OLD_IPHONE_AQUA #endif
61// OLD_IPHONE_AQUA #endif
62
63//static Stack *_vpstack = NULL; //ivec4 in y-down pixel coords - viewport stack used for clipping drawing
64
65typedef struct ivec4 {int X; int Y; int W; int H;} ivec4;
66typedef struct ivec2 {int X; int Y;} ivec2;
67ivec4 ivec4_init(int x, int y, int w, int h){
68 ivec4 ret;
69 ret.X = x, ret.Y = y; ret.W = w; ret.H = h;
70 return ret;
71}
72
73ivec2 ivec2_init(int x, int y){
74 ivec2 ret;
75 ret.X = x, ret.Y = y;
76 return ret;
77}
78
79#define MAXSTAT 200
80typedef struct pdisplay{
81 freewrl_params_t params; //pre-allocated
83 char myMenuStatus[MAXSTAT];
84 int multi_window_capable;
85}* ppdisplay;
86void *display_constructor(){
87 void *v = MALLOCV(sizeof(struct pdisplay));
88 memset(v,0,sizeof(struct pdisplay));
89 return v;
90}
91void display_init(struct tdisplay* t)
92{
93 //public
94 //freewrl_params_t p = d->params;
95
96 t->display_initialized = FALSE;
97
98 t->screenWidth = 0; /* screen */
99 t->screenHeight = 0;
100 t->window_title = NULL;
101
102 t->shutterGlasses = 0; /* stereo shutter glasses */
103 t->prv = display_constructor();
104 {
105 ppdisplay p = (ppdisplay)t->prv;
106 memset(&p->rdr_caps,0,sizeof(s_renderer_capabilities_t));
107 t->rdr_caps = &p->rdr_caps;
108 /*
109 p->params.height = 0; // window
110 p->params.width = 0;
111 p->params.winToEmbedInto = INT_ID_UNDEFINED;
112 p->params.fullscreen = FALSE;
113 p->params.xpos = 0;
114 p->params.ypos = 0;
115 p->params.frontend_handles_display_thread = FALSE;
116 */
117// OLD_IPHONE_AQUA #if defined(ANGLEPROJECT) || defined(_ANDROID) || defined(QNX) || defined(IPHONE)
118#if defined(ANGLEPROJECT) || defined(_ANDROID) || defined(QNX)
119 p->multi_window_capable = 0; //single-window EGL/ANGLEPROJECT(GLES2)/MOBILE
120#else
121 p->multi_window_capable = 1; //desktop opengl __linux__, _MSC_VER
122#endif
123 t->params = (void*)&p->params;
124 }
125}
126
127
128
129/* simple display initialize for Android (and, probably, iPhones, too)
130 Nov 2015: now used for desktop backend opengl initialization
131*/
132
133int fv_display_initialize()
134{
135 struct tdisplay* d = &gglobal()->display;
136#ifdef HAVE_OPENCL
137 struct tOpenCL_Utils *cl = &gglobal()->OpenCL_Utils;
138#endif //HAVE_OPENCL
139
140
141 //printf ("fv_display_initialize called\n");
142 if (d->display_initialized) {
143 //ConsoleMessage ("fv_display_initialized re-called for a second time");
144 return TRUE;
145 }
146
147 if (!fwl_initialize_GL()) {
148 return FALSE;
149 }
150
151 /* Display full initialized :P cool ! */
152 d->display_initialized = TRUE;
153
154#ifdef HAVE_OPENCL
155
156 if (!cl->OpenCL_Initialized) {
157 printf ("doing fwl_OpenCL_startup here in fv_display_inintialize\n");
158 fwl_OpenCL_startup(cl);
159 }
160
161#endif
162
163 PRINT_GL_ERROR_IF_ANY ("end of fv_display_initialize");
164
165 return TRUE;
166}
167
168//void fv_swapbuffers(freewrl_params_t *d);
169#ifdef WINRT
170void fv_swapbuffers(freewrl_params_t *d){
171 return;
172}
173#endif
174
175//void fv_change_GLcontext(freewrl_params_t* d);
176// each config needs to populate:
177// ANGLEPROJECT(stub) and WIN32(wglSetContext) done in src/lib/ui/fwWindow32.c
178//void fv_change_GLcontext(freewrl_params_t* d){
179// return; //stub for ANLGEPROJECT, EGL/GLES2, mobile which don't change context but need to link
180//}
181#if defined(WINRT) || defined(_ANDROID) || defined(ANDROIDNDK) || defined(IOS)
182void fv_change_GLcontext(freewrl_params_t* d){
183 //stub for non-desktop configs (they can't do multiple windows anyway)
184}
185#elif _MSC_VER
186//win32 in fwWindow32.c
187#elif __linux__ //LINUX
188//void fv_change_GLcontext(freewrl_params_t* d){
189// glXMakeCurrent(d->display,d->surface,d->context);
190//}
191
192// OLD_IPHONE_AQUA #elif AQUA
193// OLD_IPHONE_AQUA void fv_change_GLcontext(freewrl_params_t* d){
194// OLD_IPHONE_AQUA aglSetCurrentContext(d->context);
195// OLD_IPHONE_AQUA }
196
197#else
198void fv_change_GLcontext(freewrl_params_t* d){
199 //stub for non-desktop configs (they can't do multiple windows anyway)
200}
201#endif
202
203#if !defined(_ANDROID) && !defined(ANDROIDNDK) && !defined(WINRT)
204int fv_create_window_and_context(freewrl_params_t *params, freewrl_params_t *share);
205//#if defined (__linux__)
206//int fv_create_window_and_context(freewrl_params_t *params, freewrl_params_t *share){
207// /* make the window, create the OpenGL context, share the context if necessary
208// Nov 2015: linux desktop is still single windowed, with static GLXContext etc, no sharing
209// - to get sharing, you need to populate params during creation of window and gl context
210// d->display = Display *Xdpy;
211// d->surface = Drawable or ???
212// d->context = GLXContext GLcx;
213// so when the targetwindow changes, there's enough info to do glXMakeCurrent and glXSwapBuffers
214// - and when doing glCreateContext you have the previous window's GLXcontext to use as a shareList
215// */
216//
217// if (!fv_open_display()) {
218// printf("open_display failed\n");
219// return FALSE;
220// }
221//
222// if (!fv_create_GLcontext()) {
223// printf("create_GLcontext failed\n");
224// return FALSE;
225// }
226// fv_bind_GLcontext();
227// return TRUE;
228//}
229//#endif //__linux__
230
231#ifdef _MSC_VER
232int fv_create_window_and_context(freewrl_params_t *params, freewrl_params_t *share){
233 if (!fv_create_main_window2(params,share)){ //0 /*argc*/, NULL /*argv*/)) {
234 return FALSE;
235 }
236 return TRUE;
237}
238#endif //_MSC_VER
239#ifdef AQUA
240int fv_create_window_and_context(freewrl_params_t *params, freewrl_params_t *share){
241 if (!fv_create_main_window(params)){ //0 /*argc*/, NULL /*argv*/)) {
242 return FALSE;
243 }
244 fv_bind_GLcontext();
245 return TRUE;
246}
247#endif //AQUA
248
249// OLD_IPHONE_AQUA #ifdef AQUA
250// OLD_IPHONE_AQUA int fv_create_window_and_context(freewrl_params_t *params, freewrl_params_t *share){
251// OLD_IPHONE_AQUA /* make the window, create the OpenGL context, share the context if necessary
252// OLD_IPHONE_AQUA Nov 2015: OSX desktop is still single windowed, with static AGLcontext etc, no sharing
253// OLD_IPHONE_AQUA - to get sharing, you need to populate params during creation of window and gl context
254// OLD_IPHONE_AQUA d->display = (don't need)
255// OLD_IPHONE_AQUA d->surface = (don't need)
256// OLD_IPHONE_AQUA d->context = AGLContext
257// OLD_IPHONE_AQUA so when the targetwindow changes, there's enough info to do aglSetCurrentContext and aglSwapBuffers
258// OLD_IPHONE_AQUA - and when doing aglCreateContext you have the previous window's AGLContext to use as a share
259// OLD_IPHONE_AQUA
260// OLD_IPHONE_AQUA */
261// OLD_IPHONE_AQUA
262// OLD_IPHONE_AQUA if (!fv_create_main_window(params)){ //0 /*argc*/, NULL /*argv*/)) {
263// OLD_IPHONE_AQUA return FALSE;
264// OLD_IPHONE_AQUA }
265// OLD_IPHONE_AQUA fv_bind_GLcontext();
266// OLD_IPHONE_AQUA return TRUE;
267// OLD_IPHONE_AQUA }
268// OLD_IPHONE_AQUA #endif
269
270void targetwindow_set_params(int itargetwindow, freewrl_params_t* params);
271freewrl_params_t* targetwindow_get_params(int itargetwindow);
279int fv_display_initialize_desktop(){
280 int nwindows;
281 struct tdisplay* d;
283 ppdisplay p;
284 ttglobal tg = gglobal();
285 d = &tg->display;
286 p = (ppdisplay)tg->display.prv;
287
288 dp = (freewrl_params_t*)d->params;
289 if(dp->frontend_handles_display_thread){
290 //all configs are technically frontend handles display thread now,
291 // as seen by the backend (not including desktop.c which is a frontend)
292 // the flag frontend_handles_display_thread here really means
293 // frontend_handles_window_creation_and_opengl_context_creation
294 // for example: winGLES2.exe which uses an EGL kit for window/glcontext
295 return fv_display_initialize(); //display_initialize now really means initialize generic backend opengl
296 }
297
298 nwindows = 1; //1 is normal freewrl, 2 or 3 is freaky 2,3 windowed freewrl for experiments, search targetwindow and windex
299 if(!p->multi_window_capable) nwindows = 1;
300 /* make the window, get the OpenGL context */
301 if(!fv_create_window_and_context(dp, NULL)){
302 return FALSE;
303 }
304 d->display_initialized = fwl_initialize_GL();
305 targetwindow_set_params(0,dp);
306 if(nwindows > 1){
307 //2nd fun window! to challenge us!
309 dp->winToEmbedInto = -1;
310 p0 = targetwindow_get_params(0);
311 if(!fv_create_window_and_context(dp,p0)){
312 return FALSE;
313 }
314 targetwindow_set_params(1,dp);
315 fwl_initialize_GL(); //has context-specific initializations -like GL_BLEND- so repeat per-context
316 }
317 if(nwindows > 2){
319 dp->winToEmbedInto = -1;
320 p1 = targetwindow_get_params(1);
321 if(!fv_create_window_and_context(dp, p1)){
322 return FALSE;
323 }
324 targetwindow_set_params(2,dp);
325 fwl_initialize_GL();
326 }
327 setWindowTitle0();
328
329 /* lets make sure everything is sync'd up */
330#if defined(TARGET_X11) || defined(TARGET_MOTIF)
331 XFlush(Xdpy);
332#endif
333
334 gglobal()->display.display_initialized = d->display_initialized;
335
336 DEBUG_MSG("FreeWRL: running as a plugin: %s\n", BOOL_STR(isBrowserPlugin));
337
338 PRINT_GL_ERROR_IF_ANY ("end of fv_display_initialize");
339
340// OLD_IPHONE_AQUA #if !(defined(TARGET_AQUA) || defined(_MSC_VER) || defined(_ANDROID))
341#if !(defined(TARGET_AQUA) || defined(_MSC_VER) || defined(_ANDROID))
342
343 if (RUNNINGASPLUGIN) {
344#if defined(FREEWRL_PLUGIN) && (defined(TARGET_X11) || defined(TARGET_MOTIF))
345 sendXwinToPlugin();
346#endif
347 } else {
348 XMapWindow(Xdpy, Xwin);
349 }
350#endif
351 return TRUE;
352}
353#endif
354
355
360int fwl_parse_geometry_string(const char *geometry, int *out_width, int *out_height,
361 int *out_xpos, int *out_ypos)
362{
363 int width, height, xpos, ypos;
364 int c;
365
366 width = height = xpos = ypos = 0;
367
368 c = sscanf(geometry, "%dx%d+%d+%d",
369 &width, &height, &xpos, &ypos);
370
371 if (out_width) *out_width = width;
372 if (out_height) *out_height = height;
373 if (out_xpos) *out_xpos = xpos;
374 if (out_ypos) *out_ypos = ypos;
375
376 if (c > 0)
377 return TRUE;
378 return FALSE;
379}
380
381void fv_setScreenDim(int wi, int he) { fwl_setScreenDim(wi,he); }
382
383void fwl_setScreenDim1(int wi, int he, int windex);
384void fwl_setScreenDim0(int wi, int he)
385{
386 //this one just sets the tg->display.screenWidth and is called in the targetwindow rendering loop
387 //this allows legacy code use of display.screenWidth etc to work normally in the render functions
388 ttglobal tg = gglobal();
389
390 tg->display.screenWidth = wi; //width of the whole opengl surface in pixels
391 tg->display.screenHeight = he; //height of the whole opengl surface in pixels
392}
396void fwl_setScreenDim(int wi, int he)
397{
398 //this one is called from platform-specific window event handling code, and
399 //by default assumes there's only one window, windex=0
400 //and sets a windowtarget-specific viewport as well as tg.display.screenwidth/height
401 fwl_setScreenDim0(wi,he);
402 fwl_setScreenDim1(wi,he,0);
403}
404double display_screenRatio(){
405 ttglobal tg = gglobal();
406 double ratio = 1.5;
407 if (tg->display.screenHeight != 0) ratio = (double) tg->display.screenWidth/(double) tg->display.screenHeight;
408 return ratio;
409}
410void fwl_setClipPlane(int height)
411{
412 //this should be 2 numbers, one for top and bottom
413 //right now the statusbarHud -which shares the opengl window with the scene- takes 16 pixels on the bottom
414 gglobal()->Mainloop.clipPlane = height;
415}
419GLvoid resize_GL(GLsizei width, GLsizei height)
420{
421 FW_GL_VIEWPORT( 0, 0, width, height );
422 printf("resize_GL\n");
423}
424
425void fwl_updateScreenDim(int wi, int he)
426{
427 fwl_setScreenDim(wi, he);
428
429 resize_GL(wi, he);
430}
431
432
433
438bool initialize_rdr_caps()
439{
440 //s_renderer_capabilities_t *rdr_caps;
441 /* Max texture size */
442 GLint tmp; /* ensures that we pass pointers of same size across all platforms */
443 ppdisplay p = (ppdisplay)gglobal()->display.prv;
444
445#if defined(HAVE_GLEW_H) && !defined(ANGLEPROJECT)
446 /* Initialize GLEW */
447 {
448 GLenum err;
449 err = glewInit();
450 if (GLEW_OK != err) {
451 /* Problem: glewInit failed, something is seriously wrong. */
452 ERROR_MSG("GLEW initialization error: %s\n", glewGetErrorString(err));
453 return FALSE;
454 }
455 TRACE_MSG("GLEW initialization: version %s\n", glewGetString(GLEW_VERSION));
456 }
457#endif
458
459 /* OpenGL is initialized, context is created,
460 get some info, for later use ...*/
461 p->rdr_caps.renderer = (char *) FW_GL_GETSTRING(GL_RENDERER);
462 p->rdr_caps.version = (char *) FW_GL_GETSTRING(GL_VERSION);
463 p->rdr_caps.vendor = (char *) FW_GL_GETSTRING(GL_VENDOR);
464 p->rdr_caps.extensions = (char *) FW_GL_GETSTRING(GL_EXTENSIONS);
465 FW_GL_GETBOOLEANV(GL_STEREO,&(p->rdr_caps.quadBuffer));
466 //if (rdr_caps.quadBuffer) ConsoleMessage("INIT HAVE QUADBUFFER"); else ConsoleMessage("INIT_ NO QUADBUFFER");
467 ConsoleMessage("openGL version %s\n",p->rdr_caps.version);
468
469 /* rdr_caps.version = "1.5.7"; //"1.4.1"; //for testing */
470 if (p->rdr_caps.version)
471 p->rdr_caps.versionf = (float) atof(p->rdr_caps.version);
472 if (p->rdr_caps.versionf == 0) // can't parse output of GL_VERSION, generally in case it is smth. like "OpenGL ES 3.0 V@66.0 AU@ (CL@)". probably 3.x or bigger.
473 {
474 const char *openGLPrefix = "OpenGL ES ";
475 if (NULL != p->rdr_caps.version && strstr(p->rdr_caps.version, openGLPrefix))
476 {
477 char version[256], *versionPTR;
478 sprintf(version, "%s", p->rdr_caps.version);
479 versionPTR = version + strlen(openGLPrefix);
480 p->rdr_caps.versionf = (float) atof(versionPTR);
481 //free(version);
482 }
483#if defined(GL_ES_VERSION_2_0) && !defined(ANGLEPROJECT)
484 if (0 == p->rdr_caps.version)
485 {
486 //Try define version with 3.x api
487 GLint major = 0, minor = 0;
488 #if defined(GL_MAJOR_VERSION) && defined(GL_MINOR_VERSION)
489 FW_GL_GETINTEGERV(GL_MAJOR_VERSION, &major);
490 FW_GL_GETINTEGERV(GL_MINOR_VERSION, &minor);
491 #else
492 major = 2;
493 minor = 1;
494 #endif
495 char *version;
496 asprintf(&version, "%d.%d", major, minor);
497 p->rdr_caps.version = version;
498 p->rdr_caps.versionf = (float) atof(p->rdr_caps.version);
499 free(version);
500 }
501#endif
502 }
503 /* atof technique: http://www.opengl.org/resources/faq/technical/extensions.htm */
504 p->rdr_caps.have_GL_VERSION_1_1 = p->rdr_caps.versionf >= 1.1f;
505 p->rdr_caps.have_GL_VERSION_1_2 = p->rdr_caps.versionf >= 1.2f;
506 p->rdr_caps.have_GL_VERSION_1_3 = p->rdr_caps.versionf >= 1.3f;
507 p->rdr_caps.have_GL_VERSION_1_4 = p->rdr_caps.versionf >= 1.4f;
508 p->rdr_caps.have_GL_VERSION_1_5 = p->rdr_caps.versionf >= 1.5f;
509 p->rdr_caps.have_GL_VERSION_2_0 = p->rdr_caps.versionf >= 2.0f;
510 p->rdr_caps.have_GL_VERSION_2_1 = p->rdr_caps.versionf >= 2.1f;
511 p->rdr_caps.have_GL_VERSION_3_0 = p->rdr_caps.versionf >= 3.0f;
512
513
514 /* Initialize renderer capabilities without GLEW */
515
516 /* Multitexturing */
517 if (p->rdr_caps.extensions){
518 p->rdr_caps.av_multitexture = (strstr(p->rdr_caps.extensions, "GL_ARB_multitexture") != 0);
519
520 /* Occlusion Queries */
521 p->rdr_caps.av_occlusion_q = ((strstr(p->rdr_caps.extensions, "GL_ARB_occlusion_query") != 0) ||
522 (strstr(p->rdr_caps.extensions, "GL_EXT_occlusion_query_boolean") != 0) ||
523 p->rdr_caps.have_GL_VERSION_3_0);
524
525
526 /* Non-power-of-two textures */
527 p->rdr_caps.av_npot_texture = (strstr(p->rdr_caps.extensions, "GL_ARB_texture_non_power_of_two") != 0);
528
529 /* Texture rectangle (x != y) */
530 p->rdr_caps.av_texture_rect = (strstr(p->rdr_caps.extensions, "GL_ARB_texture_rectangle") != 0);
531 }
532 /* if we are doing our own shading, force the powers of 2, because otherwise mipmaps are not possible. */
533 p->rdr_caps.av_npot_texture=FALSE;
534
535 /* attempting multi-texture */
536 p->rdr_caps.av_multitexture = 1;
537
538 FW_GL_GETINTEGERV(GL_MAX_TEXTURE_SIZE, &tmp);
539 p->rdr_caps.system_max_texture_size = (int) tmp;
540 ConsoleMessage("maximum texture size system/gpu: %d ",p->rdr_caps.system_max_texture_size);
541#ifdef _MSC_VER
542 //Jan 2018 desktop windows:
543 // we're having problems with black textures with intel and nvidia, when at max reported texture size
544 if(tmp > 8192) tmp = tmp/2;
545#endif
546 p->rdr_caps.runtime_max_texture_size = (int) tmp;
547 ConsoleMessage("runtime/freewrl: %d\n",tmp);
548 ConsoleMessage("processor architecture %s\n",sizeof(void*)>4?"x64":"x86");
549 // GL_MAX_TEXTURE_UNITS is for fixed function, and should be deprecated.
550 // use GL_MAX_TEXTURE_IMAGE_UNITS now, according to the OpenGL.org wiki
551
552
553 #if defined (GL_MAX_TEXTURE_IMAGE_UNITS)
554 FW_GL_GETINTEGERV(GL_MAX_TEXTURE_IMAGE_UNITS, &tmp);
555 #else
556 FW_GL_GETINTEGERV(GL_MAX_TEXTURE_UNITS, &tmp);
557 #endif
558
559 p->rdr_caps.texture_units = (int) tmp;
560 ConsoleMessage("maxiumum image texture units %d \n",p->rdr_caps.texture_units);
561
562 /* max supported texturing anisotropicDegree- can be changed in TextureProperties */
563#ifdef GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT
564 FW_GL_GETFLOATV (GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &p->rdr_caps.anisotropicDegree);
565#endif
566 /* User settings in environment */
567
568 //ConsoleMessage ("Environment set texture size: %d", gglobal()->internalc.user_request_texture_size);
569 if (gglobal()->internalc.user_request_texture_size > 0) {
570 DEBUG_MSG("Environment set texture size: %d", gglobal()->internalc.user_request_texture_size);
571 p->rdr_caps.runtime_max_texture_size = gglobal()->internalc.user_request_texture_size;
572 }
573
574 /* Special drivers settings */
575 if (p->rdr_caps.renderer)
576 if (
577 strstr(p->rdr_caps.renderer, "Intel GMA 9") != NULL ||
578 strstr(p->rdr_caps.renderer, "Intel(R) 9") != NULL ||
579 strstr(p->rdr_caps.renderer, "i915") != NULL ||
580 strstr(p->rdr_caps.renderer, "NVIDIA GeForce2") != NULL
581 ) {
582 if (p->rdr_caps.runtime_max_texture_size > 1024) p->rdr_caps.runtime_max_texture_size = 1024;
583 }
584 if(1){
585 int actualbits;
586 glGetIntegerv(GL_DEPTH_BITS, &actualbits);
587 ConsoleMessage("depth bits %d\n",actualbits);
588 }
589 /* print some debug infos */
590 rdr_caps_dump(&p->rdr_caps);
591
592 //make this the renderer caps for this thread.
593 //memcpy(&gglobal()->display.rdr_caps,&rdr_caps,sizeof(rdr_caps));
594 return TRUE;
595}
596
597void initialize_rdr_functions()
598{
611}
612
613void rdr_caps_dump(s_renderer_capabilities_t *rdr_caps)
614{
615#ifdef VERBOSE
616 {
617 char *p, *pp;
618 p = pp = STRDUP(rdr_caps->extensions);
619 while (*pp != '\0') {
620 if (*pp == ' ') *pp = '\n';
621 pp++;
622 }
623 DEBUG_MSG ("OpenGL extensions : %s\n", p);
624 FREE(p);
625 }
626#endif //VERBOSE
627
628 DEBUG_MSG ("Multitexture support: %s\n", BOOL_STR(rdr_caps->av_multitexture));
629 DEBUG_MSG ("Occlusion support: %s\n", BOOL_STR(rdr_caps->av_occlusion_q));
630 DEBUG_MSG ("Max texture size %d\n", rdr_caps->runtime_max_texture_size);
631 DEBUG_MSG ("Max texture size %d\n", rdr_caps->system_max_texture_size);
632 DEBUG_MSG ("Texture units %d\n", rdr_caps->texture_units);
633}
Initialization.
Definition libFreeWRL.h:72