compile on Linux

This commit is contained in:
David Rose 2004-03-03 01:29:08 +00:00
parent 587de59ae8
commit 5832df65ce
6 changed files with 81 additions and 14 deletions

View File

@ -227,7 +227,45 @@ appear before they are referenced.
This defines a set of material attributes that may later be
referenced with <MRef> { name }.
At present, no material attributes have been implemented.
The following attributes may appear within the material block:
<Scalar> diffr { number }
<Scalar> diffg { number }
<Scalar> diffb { number }
<Scalar> diffa { number }
<Scalar> ambr { number }
<Scalar> ambg { number }
<Scalar> ambb { number }
<Scalar> amba { number }
<Scalar> emitr { number }
<Scalar> emitg { number }
<Scalar> emitb { number }
<Scalar> emita { number }
<Scalar> specr { number }
<Scalar> specg { number }
<Scalar> specb { number }
<Scalar> speca { number }
<Scalar> shininess { number }
<Scalar> local { flag }
These properties collectively define a "material" that controls the
lighting effects that are applied to a surface; a material is only
in effect in the presence of lighting.
The four color groups, diff*, amb*, emit*, and spec* specify the
diffuse, ambient, emission, and specular components of the lighting
equation, respectively. Any of them may be omitted; the omitted
component(s) take their color from the native color of the
primitive, otherwise the primitive color is replaced with the
material color.
The shininess property controls the size of the specular highlight,
and the value ranges from 0 to 128. A larger value creates a
smaller highlight (creating the appearance of a shinier surface).
<VertexPool> name { vertices }

View File

@ -2783,14 +2783,15 @@ has_extension(const string &extension) const {
// least the indicated value, false otherwise.
////////////////////////////////////////////////////////////////////
bool CLP(GraphicsStateGuardian)::
is_at_least_version(int major, int minor, int release) const {
if (_gl_version_major < major) {
is_at_least_version(int major_version, int minor_version,
int release_version) const {
if (_gl_version_major < major_version) {
return false;
}
if (_gl_version_minor < minor) {
if (_gl_version_minor < minor_version) {
return false;
}
if (_gl_version_release < release) {
if (_gl_version_release < release_version) {
return false;
}
return true;

View File

@ -138,7 +138,7 @@ protected:
virtual void get_extra_extensions();
void report_extensions() const;
bool has_extension(const string &extension) const;
bool is_at_least_version(int major, int minor, int release = 0) const;
bool is_at_least_version(int major_version, int minor_version, int release_version = 0) const;
virtual bool slot_new_light(int light_id);
virtual void enable_lighting(bool enable);

View File

@ -1,5 +1,10 @@
#ifndef __glext_h_
#define __glext_h_
/* Additions by drose to re-include this glext.h even if an older
version has previously been included. */
#if defined(GL_GLEXT_VERSION) && GL_GLEXT_VERSION < 21
#undef GL_GLEXT_VERSION
#endif
#ifndef GL_GLEXT_VERSION
#ifdef __cplusplus
extern "C" {

View File

@ -68,6 +68,34 @@ glxGraphicsWindow::
~glxGraphicsWindow() {
}
////////////////////////////////////////////////////////////////////
// Function: glxGraphicsWindow::make_context
// Access: Public, Virtual
// Description: If _needs_context is true, this will be called
// in the draw thread prior to rendering into the
// window. It should attempt to create a graphics
// context, and return true if successful, false
// otherwise. If it returns false the window will be
// considered failed.
////////////////////////////////////////////////////////////////////
bool glxGraphicsWindow::
make_context() {
PStatTimer timer(_make_current_pcollector);
glxGraphicsStateGuardian *glxgsg;
DCAST_INTO_R(glxgsg, _gsg, false);
glXMakeCurrent(_display, _xwindow, glxgsg->_context);
_needs_context = false;
// Now that we have made the context current to a window, we can
// reset the GSG state if this is the first time it has been used.
// (We can't just call reset() when we construct the GSG, because
// reset() requires having a current context.)
glxgsg->reset_if_new();
return true;
}
////////////////////////////////////////////////////////////////////
// Function: glxGraphicsWindow::make_current
// Access: Public, Virtual
@ -82,12 +110,6 @@ make_current() {
glxGraphicsStateGuardian *glxgsg;
DCAST_INTO_V(glxgsg, _gsg);
glXMakeCurrent(_display, _xwindow, glxgsg->_context);
// Now that we have made the context current to a window, we can
// reset the GSG state if this is the first time it has been used.
// (We can't just call reset() when we construct the GSG, because
// reset() requires having a current context.)
glxgsg->reset_if_new();
}
////////////////////////////////////////////////////////////////////

View File

@ -36,6 +36,7 @@ public:
const string &name);
virtual ~glxGraphicsWindow();
virtual bool make_context();
virtual void make_current();
virtual void release_gsg();