summaryrefslogtreecommitdiff
path: root/beos/beos_gl.cpp
blob: df6058ab17847742a01f3b8ef491bb6e3078cc8d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
//
// BeOS OpenGL functions
//

#include <stdio.h>
#include <be/kernel/image.h>
#include "opengl.h"

static image_id gl_image;

// =============================================================================
// Function pointers

// =============================================================================
// Global functions

void* Sys_GLGetProc (const char *symbol)
{
  void *func;
  
  if (get_image_symbol (gl_image, symbol, B_SYMBOL_TYPE_TEXT, &func) == B_OK)
  	return func;

  printf ("Error loading OpenGL function %s.\n", symbol);
  return NULL;
}

void* Sys_GLGetExtension (const char *symbol)
{
/*
  if (pfnglXGetProcAddressARB == NULL)
    return NULL;
  else
    return pfnglXGetProcAddressARB ((GLubyte*)symbol);
    */
    return NULL;
}

bool Sys_GLOpenLibrary (const char* libname)
{
  if (libname)
  {
    gl_image = load_add_on (libname);
    if (gl_image <= 0)
	  printf ("Error loading OpenGL library %s\n", libname);
  }

  if (gl_image <= 0)
  {
  	libname = "/beos/beos/system/lib/libGL.so";
    gl_image = load_add_on (libname);
    if (gl_image <= 0)
	  printf ("Error loading OpenGL library %s\n", libname);
  }

  if (gl_image <= 0)
    return false;

//  pfnglXChooseVisual = (PFNGLXCHOOSEVISUAL) Sys_GLGetProc ("glXChooseVisual");

  return true;
}

void Sys_GLCloseLibrary ()
{
  if (gl_image <= 0)
  {
  	unload_add_on (gl_image);
    gl_image = (image_id)NULL;
  }

 // pfnglXChooseVisual = NULL;
}