split glgsg into glmisc; expand on mesadisplay

This commit is contained in:
David Rose 2004-02-10 18:02:16 +00:00
parent c2778d8716
commit ae685dcf4b
48 changed files with 1318 additions and 4402 deletions

View File

@ -18,7 +18,7 @@
parametrics pnm \ parametrics pnm \
pnmimagetypes pnmimage sgattrib sgmanip sgraph sgraphutil \ pnmimagetypes pnmimage sgattrib sgmanip sgraph sgraphutil \
switchnode pnmtext text tform tiff lerp loader putil \ switchnode pnmtext text tform tiff lerp loader putil \
audio pgui pandabase audio pgui pandabase glstuff

View File

@ -12,7 +12,7 @@
// We don't have any components if we're linking the GL library // We don't have any components if we're linking the GL library
// directly into Panda. // directly into Panda.
#define COMPONENT_LIBS \ #define COMPONENT_LIBS \
glgsg glxdisplay mesadisplay \ glgsg glxdisplay \
wgldisplay wgldisplay
#endif #endif

View File

@ -112,7 +112,7 @@ get_hw_channel(GraphicsOutput *, int) {
PT(GraphicsDevice) GraphicsPipe:: PT(GraphicsDevice) GraphicsPipe::
make_device(void *scrn) { make_device(void *scrn) {
display_cat.error() display_cat.error()
<< "Error: make_device() unimplemented by graphicsPipe!\n"; << "make_device() unimplemented by " << get_type() << "\n";
return NULL; return NULL;
} }
@ -125,8 +125,8 @@ make_device(void *scrn) {
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
PT(GraphicsStateGuardian) GraphicsPipe:: PT(GraphicsStateGuardian) GraphicsPipe::
make_gsg(const FrameBufferProperties &properties) { make_gsg(const FrameBufferProperties &properties) {
// shouldnt this method really be pure virtual? it's an error for a pipe to not implement it display_cat.error()
display_cat.error() << "Error: make_gsg() unimplemented by graphicsPipe!\n"; << "make_gsg() unimplemented by " << get_type() << "\n";
return NULL; return NULL;
} }
@ -155,6 +155,8 @@ close_gsg(GraphicsStateGuardian *gsg) {
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
PT(GraphicsWindow) GraphicsPipe:: PT(GraphicsWindow) GraphicsPipe::
make_window(GraphicsStateGuardian *) { make_window(GraphicsStateGuardian *) {
display_cat.error()
<< get_type() << " cannot create onscreen windows.\n";
return NULL; return NULL;
} }
@ -165,5 +167,7 @@ make_window(GraphicsStateGuardian *) {
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
PT(GraphicsBuffer) GraphicsPipe:: PT(GraphicsBuffer) GraphicsPipe::
make_buffer(GraphicsStateGuardian *, int, int, bool) { make_buffer(GraphicsStateGuardian *, int, int, bool) {
display_cat.error()
<< get_type() << " cannot create offscreen buffers.\n";
return NULL; return NULL;
} }

View File

@ -7,25 +7,15 @@
#begin lib_target #begin lib_target
#define TARGET glgsg #define TARGET glgsg
#define LOCAL_LIBS \ #define LOCAL_LIBS \
gsgmisc gsgbase gobj display \ glstuff gsgmisc gsgbase gobj display \
putil linmath mathutil pnmimage putil linmath mathutil pnmimage
#define COMBINED_SOURCES $[TARGET]_composite1.cxx
#define SOURCES \ #define SOURCES \
glGraphicsStateGuardian.cxx \ config_glgsg.h config_glgsg.cxx \
config_glgsg.h glGraphicsStateGuardian.I \ glgsg.h glgsg.cxx
glGraphicsStateGuardian.h glSavedFrameBuffer.I \
glSavedFrameBuffer.h glTextureContext.I glext.h \
glGeomNodeContext.I glGeomNodeContext.h glTextureContext.h
#define INCLUDED_SOURCES \
config_glgsg.cxx glSavedFrameBuffer.cxx \
glGeomNodeContext.cxx glTextureContext.cxx
#define INSTALL_HEADERS \ #define INSTALL_HEADERS \
config_glgsg.h glGraphicsStateGuardian.I glGraphicsStateGuardian.h config_glgsg.h glgsg.h
#end lib_target #end lib_target

View File

@ -17,77 +17,13 @@
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
#include "config_glgsg.h" #include "config_glgsg.h"
#include "glGraphicsStateGuardian.h" #include "glgsg.h"
#include "glSavedFrameBuffer.h"
#include "glTextureContext.h"
#include "glGeomNodeContext.h"
#include "dconfig.h" #include "dconfig.h"
Configure(config_glgsg); ConfigureDef(config_glgsg);
NotifyCategoryDef(glgsg, ":display:gsg"); NotifyCategoryDef(glgsg, ":display:gsg");
// Configure this true to glHint the textures into the cheapest
// possible mode.
bool gl_cheap_textures = config_glgsg.GetBool("gl-cheap-textures", false);
// Configure this true to ignore texture modes like modulate that
// blend texture color with polygon color (a little cheaper for
// software renderers).
bool gl_always_decal_textures = config_glgsg.GetBool("gl-always-decal-textures", false);
// Configure this true to disable texture clamp mode (all textures
// repeat, a little cheaper for software renderers).
bool gl_ignore_clamp = config_glgsg.GetBool("gl-ignore-clamp", false);
// Configure this true to disable any texture filters at all (forcing
// point sampling).
bool gl_ignore_filters = config_glgsg.GetBool("gl-ignore-filters", false);
// Configure this true to disable mipmapping only.
bool gl_ignore_mipmaps = config_glgsg.GetBool("gl-ignore-mipmaps", false) || gl_ignore_filters;
// Configure this true to enable full trilinear mipmapping on every
// texture, whether it asks for it or not.
bool gl_force_mipmaps = config_glgsg.GetBool("gl-force-mipmaps", false);
// Configure this true to cause mipmaps to be rendered with phony
// colors, using mipmap_level_*.rgb if they are available.
bool gl_show_mipmaps = config_glgsg.GetBool("gl-show-mipmaps", false);
// Configure this true to cause the generated mipmap images to be
// written out to image files on the disk as they are generated.
bool gl_save_mipmaps = config_glgsg.GetBool("gl-save-mipmaps", false);
// Configure this true to cause all lighting normals to automatically
// be normalized by the graphics hardware before rendering. This is
// necessary if you intend to render things under scale transforms and
// expect lighting to work correctly. Maybe one day there will be
// another way to set this at runtime, instead of only as a configure
// variable.
bool gl_auto_normalize_lighting = config_glgsg.GetBool("auto-normalize-lighting", true);
// Configure this true to try to implement decals using a
// DepthOffsetAttrib, false to do them with the more reliable 3-pass
// rendering method instead.
bool gl_depth_offset_decals = config_glgsg.GetBool("depth-offset-decals", false);
// Configure this true to indicate the current version of GL fully
// supports textures with B, G, R ordering; false if it only supports
// R, G, B. false will always work, but true might be faster if the
// implementation supports it.
#ifdef GL_BGR
bool gl_supports_bgr = config_glgsg.GetBool("gl-supports-bgr", false);
#else
// If it's not even defined, we can't use it.
bool gl_supports_bgr = false;
#endif // GL_BGR
// Configure this false if your GL's implementation of glColorMask()
// is broken (some are). This will force the use of a (presumably)
// more expensive blending operation instead.
bool gl_color_mask = config_glgsg.GetBool("gl-color-mask", true);
ConfigureFn(config_glgsg) { ConfigureFn(config_glgsg) {
init_libglgsg(); init_libglgsg();
} }
@ -108,8 +44,5 @@ init_libglgsg() {
} }
initialized = true; initialized = true;
GLGraphicsStateGuardian::init_type(); GLinit_classes();
GLSavedFrameBuffer::init_type();
GLTextureContext::init_type();
GLGeomNodeContext::init_type();
} }

View File

@ -21,23 +21,11 @@
#include "pandabase.h" #include "pandabase.h"
#include "notifyCategoryProxy.h" #include "notifyCategoryProxy.h"
#include "dconfig.h"
ConfigureDecl(config_glgsg, EXPCL_PANDAGL, EXPTP_PANDAGL);
NotifyCategoryDecl(glgsg, EXPCL_PANDAGL, EXPTP_PANDAGL); NotifyCategoryDecl(glgsg, EXPCL_PANDAGL, EXPTP_PANDAGL);
extern bool gl_cheap_textures;
extern bool gl_always_decal_textures;
extern bool gl_ignore_clamp;
extern bool gl_ignore_filters;
extern bool gl_ignore_mipmaps;
extern bool gl_force_mipmaps;
extern bool gl_show_mipmaps;
extern bool gl_save_mipmaps;
extern bool gl_auto_normalize_lighting;
extern bool gl_depth_offset_decals;
extern bool gl_supports_bgr;
extern bool gl_color_mask;
extern EXPCL_PANDAGL void init_libglgsg(); extern EXPCL_PANDAGL void init_libglgsg();
#endif #endif

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,3 @@
#include "config_glgsg.cxx" #include "config_glgsg.cxx"
#include "glSavedFrameBuffer.cxx" #include "glgsg.cxx"
#include "glGeomNodeContext.cxx"
#include "glTextureContext.cxx"

View File

@ -0,0 +1,34 @@
#define OTHER_LIBS interrogatedb:c dconfig:c dtoolconfig:m \
dtoolutil:c dtoolbase:c dtool:m
// Most of the files here are not actually compiled into anything;
// they're just included by various other directories.
#begin lib_target
#define TARGET glstuff
#define LOCAL_LIBS \
gsgmisc gsgbase gobj display \
putil linmath mathutil pnmimage
#define INSTALL_HEADERS \
glstuff_src.cxx \
glstuff_src.h \
glstuff_undef_src.h \
glGraphicsStateGuardian_src.cxx \
glGraphicsStateGuardian_src.I \
glGraphicsStateGuardian_src.h \
glSavedFrameBuffer_src.cxx \
glSavedFrameBuffer_src.I \
glSavedFrameBuffer_src.h \
glTextureContext_src.cxx \
glTextureContext_src.I \
glTextureContext_src.h \
glGeomNodeContext_src.cxx \
glGeomNodeContext_src.I \
glGeomNodeContext_src.h
#define SOURCES \
$[INSTALL_HEADERS] glpure.cxx
#end lib_target

View File

@ -1,4 +1,4 @@
// Filename: glGeomNodeContext.I // Filename: glGeomNodeContext_src.I
// Created by: drose (12Jun01) // Created by: drose (12Jun01)
// //
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
@ -18,12 +18,12 @@
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
// Function: GLGeomNodeContext::Constructor // Function: CLP(GeomNodeContext)::Constructor
// Access: Public // Access: Public
// Description: // Description:
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
INLINE GLGeomNodeContext:: INLINE CLP(GeomNodeContext)::
GLGeomNodeContext(GeomNode *node) : CLP(GeomNodeContext)(GeomNode *node) :
GeomNodeContext(node) GeomNodeContext(node)
{ {
_index = 0; _index = 0;

View File

@ -1,4 +1,4 @@
// Filename: glGeomNodeContext.cxx // Filename: glGeomNodeContext_src.cxx
// Created by: drose (12Jun01) // Created by: drose (12Jun01)
// //
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
@ -16,6 +16,4 @@
// //
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
#include "glGeomNodeContext.h" TypeHandle CLP(GeomNodeContext)::_type_handle;
TypeHandle GLGeomNodeContext::_type_handle;

View File

@ -1,4 +1,4 @@
// Filename: glGeomNodeContext.h // Filename: glGeomNodeContext_src.h
// Created by: drose (12Jun01) // Created by: drose (12Jun01)
// //
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
@ -16,30 +16,18 @@
// //
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
#ifndef GLGEOMNODECONTEXT_H
#define GLGEOMNODECONTEXT_H
#include "pandabase.h" #include "pandabase.h"
#include "geomNodeContext.h" #include "geomNodeContext.h"
#include "geomNode.h" #include "geomNode.h"
#include "pvector.h" #include "pvector.h"
#ifdef WIN32_VC
// Must include windows.h before gl.h on NT
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#undef WIN32_LEAN_AND_MEAN
#endif
#include <GL/gl.h>
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
// Class : GLGeomNodeContext // Class : GLGeomNodeContext
// Description : // Description :
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
class EXPCL_PANDAGL GLGeomNodeContext : public GeomNodeContext { class EXPCL_GL CLP(GeomNodeContext) : public GeomNodeContext {
public: public:
INLINE GLGeomNodeContext(GeomNode *node); INLINE CLP(GeomNodeContext)(GeomNode *node);
// The GL display list index that draws the contents of this // The GL display list index that draws the contents of this
// GeomNode. // GeomNode.
@ -60,7 +48,7 @@ public:
} }
static void init_type() { static void init_type() {
GeomNodeContext::init_type(); GeomNodeContext::init_type();
register_type(_type_handle, "GLGeomNodeContext", register_type(_type_handle, CLASSPREFIX_QUOTED "GeomNodeContext",
GeomNodeContext::get_class_type()); GeomNodeContext::get_class_type());
} }
virtual TypeHandle get_type() const { virtual TypeHandle get_type() const {
@ -72,7 +60,4 @@ private:
static TypeHandle _type_handle; static TypeHandle _type_handle;
}; };
#include "glGeomNodeContext.I" #include "glGeomNodeContext_src.I"
#endif

View File

@ -1,4 +1,4 @@
// Filename: glGraphicsStateGuardian.h // Filename: glGraphicsStateGuardian_src.h
// Created by: drose (02Feb99) // Created by: drose (02Feb99)
// //
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
@ -16,11 +16,6 @@
// //
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
#ifndef GLGRAPHICSSTATEGUARDIAN_H
#define GLGRAPHICSSTATEGUARDIAN_H
//#define GSG_VERBOSE 1
#include "pandabase.h" #include "pandabase.h"
#include "graphicsStateGuardian.h" #include "graphicsStateGuardian.h"
@ -33,38 +28,21 @@
#include "textureApplyAttrib.h" #include "textureApplyAttrib.h"
#include "pointerToArray.h" #include "pointerToArray.h"
#include "fog.h" #include "fog.h"
#include "graphicsWindow.h"
#ifdef WIN32_VC
// Must include windows.h before gl.h on NT
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#undef WIN32_LEAN_AND_MEAN
#endif
#include <GL/gl.h>
class PlaneNode; class PlaneNode;
class Light; class Light;
#if !defined(WIN32) && defined(GSG_VERBOSE)
ostream &output_gl_enum(ostream &out, GLenum v);
INLINE ostream &operator << (ostream &out, GLenum v) {
return output_gl_enum(out, v);
}
#endif
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
// Class : GLGraphicsStateGuardian // Class : GLGraphicsStateGuardian
// Description : A GraphicsStateGuardian specialized for rendering // Description : A GraphicsStateGuardian specialized for rendering
// into OpenGL contexts. There should be no GL calls // into OpenGL contexts. There should be no GL calls
// outside of this object. // outside of this object.
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
class EXPCL_PANDAGL GLGraphicsStateGuardian : public GraphicsStateGuardian { class EXPCL_GL CLP(GraphicsStateGuardian) : public GraphicsStateGuardian {
public: public:
GLGraphicsStateGuardian(const FrameBufferProperties &properties); CLP(GraphicsStateGuardian)(const FrameBufferProperties &properties);
virtual ~GLGraphicsStateGuardian(); virtual ~CLP(GraphicsStateGuardian)();
virtual void reset(); virtual void reset();
@ -332,22 +310,4 @@ private:
static TypeHandle _type_handle; static TypeHandle _type_handle;
}; };
#ifdef DO_PSTATS #include "glGraphicsStateGuardian_src.I"
#define DO_PSTATS_STUFF(XX) XX;
#else
#define DO_PSTATS_STUFF(XX)
#endif
#define ISPOW2(X) (((X) & ((X)-1))==0)
#ifndef NDEBUG
#define report_gl_errors() \
GLGraphicsStateGuardian::report_errors(__LINE__, __FILE__)
#else
#define report_gl_errors()
#endif
#include "glGraphicsStateGuardian.I"
#endif

View File

@ -1,4 +1,4 @@
// Filename: glSavedFrameBuffer.I // Filename: glSavedFrameBuffer_src.I
// Created by: drose (06Oct99) // Created by: drose (06Oct99)
// //
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
@ -18,22 +18,22 @@
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
// Function: GLSavedFrameBuffer::Constructor // Function: CLP(SavedFrameBuffer)::Constructor
// Access: Public // Access: Public
// Description: // Description:
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
INLINE GLSavedFrameBuffer:: INLINE CLP(SavedFrameBuffer)::
GLSavedFrameBuffer(const RenderBuffer &buffer, CPT(DisplayRegion) dr) : CLP(SavedFrameBuffer)(const RenderBuffer &buffer, CPT(DisplayRegion) dr) :
SavedFrameBuffer(buffer, dr) SavedFrameBuffer(buffer, dr)
{ {
} }
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
// Function: GLSavedFrameBuffer::Destructor // Function: CLP(SavedFrameBuffer)::Destructor
// Access: Public // Access: Public
// Description: // Description:
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
INLINE GLSavedFrameBuffer:: INLINE CLP(SavedFrameBuffer)::
~GLSavedFrameBuffer() { ~CLP(SavedFrameBuffer)() {
} }

View File

@ -16,6 +16,4 @@
// //
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
#include "glSavedFrameBuffer.h" TypeHandle CLP(SavedFrameBuffer)::_type_handle;
TypeHandle GLSavedFrameBuffer::_type_handle;

View File

@ -1,4 +1,4 @@
// Filename: glSavedFrameBuffer.h // Filename: glSavedFrameBuffer_src.h
// Created by: drose (06Oct99) // Created by: drose (06Oct99)
// //
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
@ -16,26 +16,23 @@
// //
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
#ifndef GLSAVEDFRAMEBUFFER_H
#define GLSAVEDFRAMEBUFFER_H
#include "pandabase.h" #include "pandabase.h"
#include <savedFrameBuffer.h> #include "savedFrameBuffer.h"
#include <texture.h> #include "texture.h"
#include <textureContext.h> #include "textureContext.h"
#include <pixelBuffer.h> #include "pixelBuffer.h"
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
// Class : GLSavedFrameBuffer // Class : GLSavedFrameBuffer
// Description : // Description :
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
class EXPCL_PANDAGL GLSavedFrameBuffer : public SavedFrameBuffer { class EXPCL_GL CLP(SavedFrameBuffer) : public SavedFrameBuffer {
public: public:
INLINE GLSavedFrameBuffer(const RenderBuffer &buffer, INLINE CLP(SavedFrameBuffer)(const RenderBuffer &buffer,
CPT(DisplayRegion) dr); CPT(DisplayRegion) dr);
INLINE ~GLSavedFrameBuffer(); INLINE ~CLP(SavedFrameBuffer)();
PT(Texture) _back_rgba; PT(Texture) _back_rgba;
PT(PixelBuffer) _depth; PT(PixelBuffer) _depth;
@ -46,7 +43,7 @@ public:
} }
static void init_type() { static void init_type() {
SavedFrameBuffer::init_type(); SavedFrameBuffer::init_type();
register_type(_type_handle, "GLSavedFrameBuffer", register_type(_type_handle, CLASSPREFIX_QUOTED "SavedFrameBuffer",
SavedFrameBuffer::get_class_type()); SavedFrameBuffer::get_class_type());
} }
virtual TypeHandle get_type() const { virtual TypeHandle get_type() const {
@ -58,7 +55,5 @@ private:
static TypeHandle _type_handle; static TypeHandle _type_handle;
}; };
#include "glSavedFrameBuffer.I" #include "glSavedFrameBuffer_src.I"
#endif

View File

@ -1,4 +1,4 @@
// Filename: glTextureContext.I // Filename: glTextureContext_src.I
// Created by: drose (07Oct99) // Created by: drose (07Oct99)
// //
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
@ -18,12 +18,12 @@
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
// Function: GLTextureContext::Constructor // Function: CLP(TextureContext)::Constructor
// Access: Public // Access: Public
// Description: // Description:
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
INLINE GLTextureContext:: INLINE CLP(TextureContext)::
GLTextureContext(Texture *tex) : CLP(TextureContext)(Texture *tex) :
TextureContext(tex) TextureContext(tex)
{ {
_index = 0; _index = 0;

View File

@ -16,6 +16,4 @@
// //
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
#include "glTextureContext.h" TypeHandle CLP(TextureContext)::_type_handle;
TypeHandle GLTextureContext::_type_handle;

View File

@ -1,4 +1,4 @@
// Filename: glTextureContext.h // Filename: glTextureContext_src.h
// Created by: drose (07Oct99) // Created by: drose (07Oct99)
// //
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
@ -16,28 +16,16 @@
// //
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
#ifndef GLTEXTURECONTEXT_H
#define GLTEXTURECONTEXT_H
#include "pandabase.h" #include "pandabase.h"
#include "textureContext.h"
#ifdef WIN32_VC
// Must include windows.h before gl.h on NT
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#undef WIN32_LEAN_AND_MEAN
#endif
#include <GL/gl.h>
#include <textureContext.h>
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
// Class : GLTextureContext // Class : GLTextureContext
// Description : // Description :
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
class EXPCL_PANDAGL GLTextureContext : public TextureContext { class EXPCL_GL CLP(TextureContext) : public TextureContext {
public: public:
INLINE GLTextureContext(Texture *tex); INLINE CLP(TextureContext)(Texture *tex);
// This is the GL "name" of the texture object. // This is the GL "name" of the texture object.
GLuint _index; GLuint _index;
@ -51,7 +39,7 @@ public:
} }
static void init_type() { static void init_type() {
TextureContext::init_type(); TextureContext::init_type();
register_type(_type_handle, "GLTextureContext", register_type(_type_handle, CLASSPREFIX_QUOTED "TextureContext",
TextureContext::get_class_type()); TextureContext::get_class_type());
} }
virtual TypeHandle get_type() const { virtual TypeHandle get_type() const {
@ -63,7 +51,5 @@ private:
static TypeHandle _type_handle; static TypeHandle _type_handle;
}; };
#include "glTextureContext.I" #include "glTextureContext_src.I"
#endif

View File

@ -0,0 +1,87 @@
// Filename: glmisc_src.cxx
// Created by: drose (09Feb04)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved
//
// All use of this software is subject to the terms of the Panda 3d
// Software license. You should have received a copy of this license
// along with this source code; you will also find a current copy of
// the license at http://www.panda3d.org/license.txt .
//
// To contact the maintainers of this program write to
// panda3d@yahoogroups.com .
//
////////////////////////////////////////////////////////////////////
// Configure this true to GLP(Hint) the textures into the cheapest
// possible mode.
bool CLP(cheap_textures) = CONFIGOBJ.GetBool("gl-cheap-textures", false);
// Configure this true to ignore texture modes like modulate that
// blend texture color with polygon color (a little cheaper for
// software renderers).
bool CLP(always_decal_textures) = CONFIGOBJ.GetBool("gl-always-decal-textures", false);
// Configure this true to disable texture clamp mode (all textures
// repeat, a little cheaper for software renderers).
bool CLP(ignore_clamp) = CONFIGOBJ.GetBool("gl-ignore-clamp", false);
// Configure this true to disable any texture filters at all (forcing
// point sampling).
bool CLP(ignore_filters) = CONFIGOBJ.GetBool("gl-ignore-filters", false);
// Configure this true to disable mipmapping only.
bool CLP(ignore_mipmaps) = CONFIGOBJ.GetBool("gl-ignore-mipmaps", false) || CLP(ignore_filters);
// Configure this true to enable full trilinear mipmapping on every
// texture, whether it asks for it or not.
bool CLP(force_mipmaps) = CONFIGOBJ.GetBool("gl-force-mipmaps", false);
// Configure this true to cause mipmaps to be rendered with phony
// colors, using mipmap_level_*.rgb if they are available.
bool CLP(show_mipmaps) = CONFIGOBJ.GetBool("gl-show-mipmaps", false);
// Configure this true to cause the generated mipmap images to be
// written out to image files on the disk as they are generated.
bool CLP(save_mipmaps) = CONFIGOBJ.GetBool("gl-save-mipmaps", false);
// Configure this true to cause all lighting normals to automatically
// be normalized by the graphics hardware before rendering. This is
// necessary if you intend to render things under scale transforms and
// expect lighting to work correctly. Maybe one day there will be
// another way to set this at runtime, instead of only as a configure
// variable.
bool CLP(auto_normalize_lighting) = CONFIGOBJ.GetBool("auto-normalize-lighting", true);
// Configure this true to try to implement decals using a
// DepthOffsetAttrib, false to do them with the more reliable 3-pass
// rendering method instead.
bool CLP(depth_offset_decals) = CONFIGOBJ.GetBool("depth-offset-decals", false);
// Configure this true to indicate the current version of GL fully
// supports textures with B, G, R ordering; false if it only supports
// R, G, B. false will always work, but true might be faster if the
// implementation supports it.
#ifdef GL_BGR
bool CLP(supports_bgr) = CONFIGOBJ.GetBool("gl-supports-bgr", false);
#else
// If it's not even defined, we can't use it.
bool CLP(supports_bgr) = false;
#endif // GL_BGR
// Configure this false if your GL's implementation of GLP(ColorMask)()
// is broken (some are). This will force the use of a (presumably)
// more expensive blending operation instead.
bool CLP(color_mask) = CONFIGOBJ.GetBool("gl-color-mask", true);
void CLP(init_classes)() {
CLP(GraphicsStateGuardian)::init_type();
CLP(SavedFrameBuffer)::init_type();
CLP(TextureContext)::init_type();
CLP(GeomNodeContext)::init_type();
}

View File

@ -0,0 +1,60 @@
// Filename: glmisc_src.h
// Created by: drose (09Feb04)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved
//
// All use of this software is subject to the terms of the Panda 3d
// Software license. You should have received a copy of this license
// along with this source code; you will also find a current copy of
// the license at http://www.panda3d.org/license.txt .
//
// To contact the maintainers of this program write to
// panda3d@yahoogroups.com .
//
////////////////////////////////////////////////////////////////////
#include "pandabase.h"
//#define GSG_VERBOSE 1
extern bool CLP(cheap_textures);
extern bool CLP(always_decal_textures);
extern bool CLP(ignore_clamp);
extern bool CLP(ignore_filters);
extern bool CLP(ignore_mipmaps);
extern bool CLP(force_mipmaps);
extern bool CLP(show_mipmaps);
extern bool CLP(save_mipmaps);
extern bool CLP(auto_normalize_lighting);
extern bool CLP(depth_offset_decals);
extern bool CLP(supports_bgr);
extern bool CLP(color_mask);
extern EXPCL_GL void CLP(init_classes)();
#if !defined(WIN32) && defined(GSG_VERBOSE)
ostream &output_gl_enum(ostream &out, GLenum v);
INLINE ostream &operator << (ostream &out, GLenum v) {
return output_gl_enum(out, v);
}
#endif
#ifdef DO_PSTATS
#define DO_PSTATS_STUFF(XX) XX;
#else
#define DO_PSTATS_STUFF(XX)
#endif
#define ISPOW2(X) (((X) & ((X)-1))==0)
#ifndef NDEBUG
#define report_gl_errors() \
CLP(GraphicsStateGuardian)::report_errors(__LINE__, __FILE__)
#else
#define report_gl_errors()
#endif

View File

@ -0,0 +1,26 @@
// Filename: glpure.cxx
// Created by: drose (09Feb04)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved
//
// All use of this software is subject to the terms of the Panda 3d
// Software license. You should have received a copy of this license
// along with this source code; you will also find a current copy of
// the license at http://www.panda3d.org/license.txt .
//
// To contact the maintainers of this program write to
// panda3d@yahoogroups.com .
//
////////////////////////////////////////////////////////////////////
#include "pandabase.h"
// This is the one file in this directory which is actually compiled.
// It exists just so we can have some symbols and make the compiler
// happy.
int glpure;

View File

@ -0,0 +1,29 @@
// Filename: glstuff_src.cxx
// Created by: drose (09Feb04)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved
//
// All use of this software is subject to the terms of the Panda 3d
// Software license. You should have received a copy of this license
// along with this source code; you will also find a current copy of
// the license at http://www.panda3d.org/license.txt .
//
// To contact the maintainers of this program write to
// panda3d@yahoogroups.com .
//
////////////////////////////////////////////////////////////////////
// This .cxx file includes all of the gl-related .cxx files in this
// directory. It works just like glstuff_src.h; see the comments in
// that file for an explanation for what you're supposed to declare in
// order to include this file.
#include "glmisc_src.cxx"
#include "glGeomNodeContext_src.cxx"
#include "glTextureContext_src.cxx"
#include "glSavedFrameBuffer_src.cxx"
#include "glGraphicsStateGuardian_src.cxx"

View File

@ -0,0 +1,44 @@
// Filename: glstuff_src.h
// Created by: drose (09Feb04)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved
//
// All use of this software is subject to the terms of the Panda 3d
// Software license. You should have received a copy of this license
// along with this source code; you will also find a current copy of
// the license at http://www.panda3d.org/license.txt .
//
// To contact the maintainers of this program write to
// panda3d@yahoogroups.com .
//
////////////////////////////////////////////////////////////////////
// This header file includes all of the gl-related header files in
// this directory. To include a CLP(GraphicsStateGuardian)-like thing of
// some kind (e.g., "true" GL calls, or Mesa-prefixed GL calls, or
// some such), define the following symbols and #include this header
// file.
// #define GLP(name): returns name prefixed by the gl prefix, e.g. gl##name
// #define CLP(name): returns name prefixed by the class prefix, e.g. GL##name
// #define CLASSPREFIX_QUOTED: the quoted prefix of CLP, e.g. "GL"
// #define CONFIGOBJ: a Configrc object, e.g. config_glgsg
// #define GLCAT: a Notify category, e.g. glgsg_cat
// #define EXPCL_GL, EXPTP_GL: according to the DLL currently being compiled.
// Also, be sure you include the appropriate GL.h header file to get
// all the GL symbols declared.
// This file is not protected from multiple inclusion; it may need to
// be included multiple times.
#include "glmisc_src.h"
#include "glGeomNodeContext_src.h"
#include "glTextureContext_src.h"
#include "glSavedFrameBuffer_src.h"
#include "glGraphicsStateGuardian_src.h"

View File

@ -0,0 +1,29 @@
// Filename: glstuff_undef_src.h
// Created by: drose (09Feb04)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved
//
// All use of this software is subject to the terms of the Panda 3d
// Software license. You should have received a copy of this license
// along with this source code; you will also find a current copy of
// the license at http://www.panda3d.org/license.txt .
//
// To contact the maintainers of this program write to
// panda3d@yahoogroups.com .
//
////////////////////////////////////////////////////////////////////
// This header file #undefs all the stuff you had to #define to
// include glstuff_src.h or glstuff_src.cxx.
#undef GLP
#undef CLP
#undef CLASSPREFIX_QUOTED
#undef CONFIGOBJ
#undef GLCAT
#undef EXPCL
#undef EXPTP

View File

@ -22,7 +22,7 @@
#include "glxGraphicsPipe.h" #include "glxGraphicsPipe.h"
#include "graphicsPipe.h" #include "graphicsPipe.h"
#include "glGraphicsStateGuardian.h" #include "glgsg.h"
TypeHandle glxGraphicsBuffer::_type_handle; TypeHandle glxGraphicsBuffer::_type_handle;

View File

@ -21,7 +21,7 @@
#include "pandabase.h" #include "pandabase.h"
#include "glGraphicsStateGuardian.h" #include "glgsg.h"
#include "glxGraphicsPipe.h" #include "glxGraphicsPipe.h"
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////

View File

@ -24,7 +24,7 @@
#include "graphicsPipe.h" #include "graphicsPipe.h"
#include "keyboardButton.h" #include "keyboardButton.h"
#include "mouseButton.h" #include "mouseButton.h"
#include "glGraphicsStateGuardian.h" #include "glgsg.h"
#include "clockObject.h" #include "clockObject.h"
#include <errno.h> #include <errno.h>

View File

@ -1,22 +1,25 @@
#define BUILD_DIRECTORY $[HAVE_MESA] #define BUILD_DIRECTORY $[HAVE_MESA]
#define BUILDING_DLL BUILDING_PANDAMESA
#define OTHER_LIBS interrogatedb:c dconfig:c dtoolconfig:m \ #define OTHER_LIBS interrogatedb:c dconfig:c dtoolconfig:m \
dtoolutil:c dtoolbase:c dtool:m dtoolutil:c dtoolbase:c dtool:m
#define USE_PACKAGES gl mesa #define USE_PACKAGES mesa
#begin lib_target #begin lib_target
#define TARGET mesadisplay #define TARGET mesadisplay
#define LOCAL_LIBS \ #define LOCAL_LIBS \
glgsg glstuff gsgmisc gsgbase gobj display \
putil linmath mathutil pnmimage
#define SOURCES \ #define SOURCES \
config_mesadisplay.cxx config_mesadisplay.h \ config_mesadisplay.cxx config_mesadisplay.h \
mesaGraphicsBuffer.I mesaGraphicsBuffer.cxx mesaGraphicsBuffer.h \ mesagsg.h mesagsg.cxx \
mesaGraphicsPipe.I mesaGraphicsPipe.cxx mesaGraphicsPipe.h \ osMesaGraphicsBuffer.I osMesaGraphicsBuffer.cxx osMesaGraphicsBuffer.h \
mesaGraphicsStateGuardian.h mesaGraphicsStateGuardian.cxx \ osMesaGraphicsPipe.I osMesaGraphicsPipe.cxx osMesaGraphicsPipe.h \
mesaGraphicsStateGuardian.I osMesaGraphicsStateGuardian.h osMesaGraphicsStateGuardian.cxx \
osMesaGraphicsStateGuardian.I
#define IGATESCAN mesaGraphicsPipe.h #define IGATESCAN osMesaGraphicsPipe.h
#end lib_target #end lib_target

View File

@ -17,13 +17,14 @@
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
#include "config_mesadisplay.h" #include "config_mesadisplay.h"
#include "mesaGraphicsBuffer.h" #include "osMesaGraphicsBuffer.h"
#include "mesaGraphicsPipe.h" #include "osMesaGraphicsPipe.h"
#include "mesaGraphicsStateGuardian.h" #include "osMesaGraphicsStateGuardian.h"
#include "graphicsPipeSelection.h" #include "graphicsPipeSelection.h"
#include "dconfig.h" #include "dconfig.h"
#include "mesagsg.h"
Configure(config_mesadisplay); ConfigureDef(config_mesadisplay);
NotifyCategoryDef(mesadisplay, "display"); NotifyCategoryDef(mesadisplay, "display");
ConfigureFn(config_mesadisplay) { ConfigureFn(config_mesadisplay) {
@ -46,12 +47,13 @@ init_libmesadisplay() {
} }
initialized = true; initialized = true;
MesaGraphicsBuffer::init_type(); OsMesaGraphicsBuffer::init_type();
MesaGraphicsPipe::init_type(); OsMesaGraphicsPipe::init_type();
MesaGraphicsStateGuardian::init_type(); OSMesaGraphicsStateGuardian::init_type();
cerr << "Adding MesaGraphicsPipe\n";
GraphicsPipeSelection *selection = GraphicsPipeSelection::get_global_ptr(); GraphicsPipeSelection *selection = GraphicsPipeSelection::get_global_ptr();
selection->add_pipe_type(MesaGraphicsPipe::get_class_type(), selection->add_pipe_type(OsMesaGraphicsPipe::get_class_type(),
MesaGraphicsPipe::pipe_constructor); OsMesaGraphicsPipe::pipe_constructor);
Mesainit_classes();
} }

View File

@ -21,9 +21,11 @@
#include "pandabase.h" #include "pandabase.h"
#include "notifyCategoryProxy.h" #include "notifyCategoryProxy.h"
#include "dconfig.h"
NotifyCategoryDecl(mesadisplay, EXPCL_PANDAGL, EXPTP_PANDAGL); ConfigureDecl(config_mesadisplay, EXPCL_PANDAMESA, EXPTP_PANDAMESA);
NotifyCategoryDecl(mesadisplay, EXPCL_PANDAMESA, EXPTP_PANDAMESA);
extern EXPCL_PANDAGL void init_libmesadisplay(); extern EXPCL_PANDAMESA void init_libmesadisplay();
#endif #endif

View File

@ -0,0 +1,24 @@
// Filename: mesagsg.cxx
// Created by: drose (09Feb04)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved
//
// All use of this software is subject to the terms of the Panda 3d
// Software license. You should have received a copy of this license
// along with this source code; you will also find a current copy of
// the license at http://www.panda3d.org/license.txt .
//
// To contact the maintainers of this program write to
// panda3d@yahoogroups.com .
//
////////////////////////////////////////////////////////////////////
// This is the actual .cxx file to include if you want to pick up
// any or all of the header files in this directory as compiled to use
// the Mesa library.
#include "mesagsg.h"
#include "glstuff_src.cxx"

View File

@ -0,0 +1,46 @@
// Filename: mesagsg.h
// Created by: drose (09Feb04)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved
//
// All use of this software is subject to the terms of the Panda 3d
// Software license. You should have received a copy of this license
// along with this source code; you will also find a current copy of
// the license at http://www.panda3d.org/license.txt .
//
// To contact the maintainers of this program write to
// panda3d@yahoogroups.com .
//
////////////////////////////////////////////////////////////////////
#ifndef MESAGSG_H
#define MESAGSG_H
// This is the actual header file to include if you want to pick up
// any or all of the header files in this directory as compiled to use
// the Mesa library.
#include "pandabase.h"
#include "config_mesadisplay.h"
#ifdef USE_MGL_NAMESPACE
#define GLP(name) mgl##name
#else
#define GLP(name) gl##name
#endif
#define CLP(name) Mesa##name
#define CLASSPREFIX_QUOTED "Mesa"
#define CONFIGOBJ config_mesadisplay
#define GLCAT mesadisplay_cat
#define EXPCL_GL EXPCL_PANDAMESA
#define EXPTP_GL EXPTP_PANDAMESA
#include <GL/gl.h>
#include <GL/glu.h>
#include "glstuff_src.h"
#endif // MESAGSG_H

View File

@ -1,4 +1,4 @@
// Filename: mesaGraphicsPipe.I // Filename: osMesaGraphicsBuffer.I
// Created by: drose (09Feb04) // Created by: drose (09Feb04)
// //
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////

View File

@ -1,4 +1,4 @@
// Filename: mesaGraphicsBuffer.cxx // Filename: osMesaGraphicsBuffer.cxx
// Created by: drose (09Feb04) // Created by: drose (09Feb04)
// //
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
@ -16,20 +16,20 @@
// //
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
#include "mesaGraphicsBuffer.h" #include "osMesaGraphicsBuffer.h"
#include "config_mesadisplay.h" #include "config_mesadisplay.h"
#include "mesaGraphicsPipe.h" #include "osMesaGraphicsPipe.h"
#include "mesaGraphicsStateGuardian.h" #include "osMesaGraphicsStateGuardian.h"
TypeHandle MesaGraphicsBuffer::_type_handle; TypeHandle OsMesaGraphicsBuffer::_type_handle;
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
// Function: MesaGraphicsBuffer::Constructor // Function: OsMesaGraphicsBuffer::Constructor
// Access: Public // Access: Public
// Description: // Description:
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
MesaGraphicsBuffer:: OsMesaGraphicsBuffer::
MesaGraphicsBuffer(GraphicsPipe *pipe, GraphicsStateGuardian *gsg, OsMesaGraphicsBuffer(GraphicsPipe *pipe, GraphicsStateGuardian *gsg,
int x_size, int y_size, bool want_texture) : int x_size, int y_size, bool want_texture) :
GraphicsBuffer(pipe, gsg, x_size, y_size, want_texture) GraphicsBuffer(pipe, gsg, x_size, y_size, want_texture)
{ {
@ -37,24 +37,24 @@ MesaGraphicsBuffer(GraphicsPipe *pipe, GraphicsStateGuardian *gsg,
} }
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
// Function: MesaGraphicsBuffer::Destructor // Function: OsMesaGraphicsBuffer::Destructor
// Access: Public, Virtual // Access: Public, Virtual
// Description: // Description:
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
MesaGraphicsBuffer:: OsMesaGraphicsBuffer::
~MesaGraphicsBuffer() { ~OsMesaGraphicsBuffer() {
} }
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
// Function: MesaGraphicsBuffer::make_current // Function: OsMesaGraphicsBuffer::make_current
// Access: Public, Virtual // Access: Public, Virtual
// Description: This function will be called within the draw thread // Description: This function will be called within the draw thread
// during begin_frame() to ensure the graphics context // during begin_frame() to ensure the graphics context
// is ready for drawing. // is ready for drawing.
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
void MesaGraphicsBuffer:: void OsMesaGraphicsBuffer::
make_current() { make_current() {
MesaGraphicsStateGuardian *mesagsg; OSMesaGraphicsStateGuardian *mesagsg;
DCAST_INTO_V(mesagsg, _gsg); DCAST_INTO_V(mesagsg, _gsg);
OSMesaMakeCurrent(mesagsg->_context, _image.p(), _type, OSMesaMakeCurrent(mesagsg->_context, _image.p(), _type,
_x_size, _y_size); _x_size, _y_size);
@ -63,7 +63,7 @@ make_current() {
} }
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
// Function: MesaGraphicsBuffer::begin_flip // Function: OsMesaGraphicsBuffer::begin_flip
// Access: Public, Virtual // Access: Public, Virtual
// Description: This function will be called within the draw thread // Description: This function will be called within the draw thread
// after end_frame() has been called on all windows, to // after end_frame() has been called on all windows, to
@ -76,7 +76,7 @@ make_current() {
// end_flip(), to make it easier to flip all of the // end_flip(), to make it easier to flip all of the
// windows at the same time. // windows at the same time.
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
void MesaGraphicsBuffer:: void OsMesaGraphicsBuffer::
begin_flip() { begin_flip() {
if (has_texture()) { if (has_texture()) {
// Use glCopyTexImage2D to copy the framebuffer to the texture. // Use glCopyTexImage2D to copy the framebuffer to the texture.
@ -89,25 +89,25 @@ begin_flip() {
} }
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
// Function: MesaGraphicsBuffer::close_buffer // Function: OsMesaGraphicsBuffer::close_buffer
// Access: Protected, Virtual // Access: Protected, Virtual
// Description: Closes the buffer right now. Called from the window // Description: Closes the buffer right now. Called from the window
// thread. // thread.
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
void MesaGraphicsBuffer:: void OsMesaGraphicsBuffer::
close_buffer() { close_buffer() {
_image.clear(); _image.clear();
_is_valid = false; _is_valid = false;
} }
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
// Function: MesaGraphicsBuffer::open_buffer // Function: OsMesaGraphicsBuffer::open_buffer
// Access: Protected, Virtual // Access: Protected, Virtual
// Description: Opens the buffer right now. Called from the window // Description: Opens the buffer right now. Called from the window
// thread. Returns true if the buffer is successfully // thread. Returns true if the buffer is successfully
// opened, or false if there was a problem. // opened, or false if there was a problem.
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
bool MesaGraphicsBuffer:: bool OsMesaGraphicsBuffer::
open_buffer() { open_buffer() {
_image = PTA_uchar::empty_array(_x_size * _y_size * 4); _image = PTA_uchar::empty_array(_x_size * _y_size * 4);
_is_valid = true; _is_valid = true;

View File

@ -1,4 +1,4 @@
// Filename: mesaGraphicsBuffer.h // Filename: osMesaGraphicsBuffer.h
// Created by: drose (09Feb04) // Created by: drose (09Feb04)
// //
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
@ -16,26 +16,26 @@
// //
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
#ifndef MESAGRAPHICSBUFFER_H #ifndef OSMESAGRAPHICSBUFFER_H
#define MESAGRAPHICSBUFFER_H #define OSMESAGRAPHICSBUFFER_H
#include "pandabase.h" #include "pandabase.h"
#include "mesaGraphicsPipe.h" #include "osMesaGraphicsPipe.h"
#include "graphicsBuffer.h" #include "graphicsBuffer.h"
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
// Class : MesaGraphicsBuffer // Class : OsMesaGraphicsBuffer
// Description : An offscreen buffer using direct calls to Mesa. This // Description : An offscreen buffer using direct calls to Mesa. This
// is the only kind of graphics output supported by // is the only kind of graphics output supported by
// osmesa.h. // osmesa.h.
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
class MesaGraphicsBuffer : public GraphicsBuffer { class EXPCL_PANDAMESA OsMesaGraphicsBuffer : public GraphicsBuffer {
public: public:
MesaGraphicsBuffer(GraphicsPipe *pipe, GraphicsStateGuardian *gsg, OsMesaGraphicsBuffer(GraphicsPipe *pipe, GraphicsStateGuardian *gsg,
int x_size, int y_size, bool want_texture); int x_size, int y_size, bool want_texture);
virtual ~MesaGraphicsBuffer(); virtual ~OsMesaGraphicsBuffer();
virtual void make_current(); virtual void make_current();
@ -55,7 +55,7 @@ public:
} }
static void init_type() { static void init_type() {
GraphicsBuffer::init_type(); GraphicsBuffer::init_type();
register_type(_type_handle, "MesaGraphicsBuffer", register_type(_type_handle, "OsMesaGraphicsBuffer",
GraphicsBuffer::get_class_type()); GraphicsBuffer::get_class_type());
} }
virtual TypeHandle get_type() const { virtual TypeHandle get_type() const {
@ -67,6 +67,6 @@ private:
static TypeHandle _type_handle; static TypeHandle _type_handle;
}; };
#include "mesaGraphicsBuffer.I" #include "osMesaGraphicsBuffer.I"
#endif #endif

View File

@ -1,4 +1,4 @@
// Filename: mesaGraphicsBuffer.I // Filename: osMesaGraphicsPipe.I
// Created by: drose (09Feb04) // Created by: drose (09Feb04)
// //
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////

View File

@ -1,5 +1,5 @@
// Filename: mesaGraphicsPipe.cxx // Filename: osMesaGraphicsPipe.cxx
// Created by: mike (09Jan97) // Created by: drose (09Feb04)
// //
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
// //
@ -16,37 +16,37 @@
// //
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
#include "mesaGraphicsPipe.h" #include "osMesaGraphicsPipe.h"
#include "mesaGraphicsBuffer.h" #include "osMesaGraphicsBuffer.h"
#include "mesaGraphicsStateGuardian.h" #include "osMesaGraphicsStateGuardian.h"
#include "config_mesadisplay.h" #include "config_mesadisplay.h"
#include "frameBufferProperties.h" #include "frameBufferProperties.h"
#include "mutexHolder.h" #include "mutexHolder.h"
TypeHandle MesaGraphicsPipe::_type_handle; TypeHandle OsMesaGraphicsPipe::_type_handle;
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
// Function: MesaGraphicsPipe::Constructor // Function: OsMesaGraphicsPipe::Constructor
// Access: Public // Access: Public
// Description: // Description:
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
MesaGraphicsPipe:: OsMesaGraphicsPipe::
MesaGraphicsPipe() { OsMesaGraphicsPipe() {
_supported_types = OT_buffer | OT_texture_buffer; _supported_types = OT_buffer | OT_texture_buffer;
_is_valid = true; _is_valid = true;
} }
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
// Function: MesaGraphicsPipe::Destructor // Function: OsMesaGraphicsPipe::Destructor
// Access: Public, Virtual // Access: Public, Virtual
// Description: // Description:
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
MesaGraphicsPipe:: OsMesaGraphicsPipe::
~MesaGraphicsPipe() { ~OsMesaGraphicsPipe() {
} }
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
// Function: MesaGraphicsPipe::get_interface_name // Function: OsMesaGraphicsPipe::get_interface_name
// Access: Published, Virtual // Access: Published, Virtual
// Description: Returns the name of the rendering interface // Description: Returns the name of the rendering interface
// associated with this GraphicsPipe. This is used to // associated with this GraphicsPipe. This is used to
@ -55,41 +55,41 @@ MesaGraphicsPipe::
// particular platform, so the name should be meaningful // particular platform, so the name should be meaningful
// and unique for a given platform. // and unique for a given platform.
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
string MesaGraphicsPipe:: string OsMesaGraphicsPipe::
get_interface_name() const { get_interface_name() const {
return "Offscreen Mesa"; return "Offscreen Mesa";
} }
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
// Function: MesaGraphicsPipe::pipe_constructor // Function: OsMesaGraphicsPipe::pipe_constructor
// Access: Public, Static // Access: Public, Static
// Description: This function is passed to the GraphicsPipeSelection // Description: This function is passed to the GraphicsPipeSelection
// object to allow the user to make a default // object to allow the user to make a default
// MesaGraphicsPipe. // OsMesaGraphicsPipe.
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
PT(GraphicsPipe) MesaGraphicsPipe:: PT(GraphicsPipe) OsMesaGraphicsPipe::
pipe_constructor() { pipe_constructor() {
return new MesaGraphicsPipe; return new OsMesaGraphicsPipe;
} }
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
// Function: MesaGraphicsPipe::make_gsg // Function: OsMesaGraphicsPipe::make_gsg
// Access: Protected, Virtual // Access: Protected, Virtual
// Description: Creates a new GSG to use the pipe (but no windows // Description: Creates a new GSG to use the pipe (but no windows
// have been created yet for the GSG). This method will // have been created yet for the GSG). This method will
// be called in the draw thread for the GSG. // be called in the draw thread for the GSG.
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
PT(GraphicsStateGuardian) MesaGraphicsPipe:: PT(GraphicsStateGuardian) OsMesaGraphicsPipe::
make_gsg(const FrameBufferProperties &properties) { make_gsg(const FrameBufferProperties &properties) {
return new MesaGraphicsStateGuardian(properties); return new OSMesaGraphicsStateGuardian(properties);
} }
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
// Function: MesaGraphicsPipe::make_buffer // Function: OsMesaGraphicsPipe::make_buffer
// Access: Protected, Virtual // Access: Protected, Virtual
// Description: Creates a new offscreen buffer on the pipe, if possible. // Description: Creates a new offscreen buffer on the pipe, if possible.
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
PT(GraphicsBuffer) MesaGraphicsPipe:: PT(GraphicsBuffer) OsMesaGraphicsPipe::
make_buffer(GraphicsStateGuardian *gsg, int x_size, int y_size, bool want_texture) { make_buffer(GraphicsStateGuardian *gsg, int x_size, int y_size, bool want_texture) {
return new MesaGraphicsBuffer(this, gsg, x_size, y_size, want_texture); return new OsMesaGraphicsBuffer(this, gsg, x_size, y_size, want_texture);
} }

View File

@ -1,4 +1,4 @@
// Filename: mesaGraphicsPipe.h // Filename: osMesaGraphicsPipe.h
// Created by: drose (09Feb04) // Created by: drose (09Feb04)
// //
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
@ -16,8 +16,8 @@
// //
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
#ifndef MESAGRAPHICSPIPE_H #ifndef OSMESAGRAPHICSPIPE_H
#define MESAGRAPHICSPIPE_H #define OSMESAGRAPHICSPIPE_H
#include "pandabase.h" #include "pandabase.h"
#include "graphicsWindow.h" #include "graphicsWindow.h"
@ -28,7 +28,7 @@
class FrameBufferProperties; class FrameBufferProperties;
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
// Class : MesaGraphicsPipe // Class : OsMesaGraphicsPipe
// Description : This graphics pipe represents the interface for // Description : This graphics pipe represents the interface for
// rendering with direct calls to the Mesa open-source // rendering with direct calls to the Mesa open-source
// software-only implementation of OpenGL. // software-only implementation of OpenGL.
@ -38,10 +38,10 @@ class FrameBufferProperties;
// buffers without having any X server or other // buffers without having any X server or other
// operating system infrastructure in place. // operating system infrastructure in place.
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
class MesaGraphicsPipe : public GraphicsPipe { class EXPCL_PANDAMESA OsMesaGraphicsPipe : public GraphicsPipe {
public: public:
MesaGraphicsPipe(); OsMesaGraphicsPipe();
virtual ~MesaGraphicsPipe(); virtual ~OsMesaGraphicsPipe();
virtual string get_interface_name() const; virtual string get_interface_name() const;
static PT(GraphicsPipe) pipe_constructor(); static PT(GraphicsPipe) pipe_constructor();
@ -59,7 +59,7 @@ public:
} }
static void init_type() { static void init_type() {
GraphicsPipe::init_type(); GraphicsPipe::init_type();
register_type(_type_handle, "MesaGraphicsPipe", register_type(_type_handle, "OsMesaGraphicsPipe",
GraphicsPipe::get_class_type()); GraphicsPipe::get_class_type());
} }
virtual TypeHandle get_type() const { virtual TypeHandle get_type() const {
@ -71,6 +71,6 @@ private:
static TypeHandle _type_handle; static TypeHandle _type_handle;
}; };
#include "mesaGraphicsPipe.I" #include "osMesaGraphicsPipe.I"
#endif #endif

View File

@ -1,5 +1,5 @@
// Filename: glxGraphicsStateGuardian.I // Filename: osMesaGraphicsStateGuardian.I
// Created by: drose (27Jan03) // Created by: drose (09Feb04)
// //
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
// //

View File

@ -1,4 +1,4 @@
// Filename: mesaGraphicsStateGuardian.cxx // Filename: osMesaGraphicsStateGuardian.cxx
// Created by: drose (09Feb04) // Created by: drose (09Feb04)
// //
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
@ -16,29 +16,29 @@
// //
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
#include "mesaGraphicsStateGuardian.h" #include "osMesaGraphicsStateGuardian.h"
TypeHandle MesaGraphicsStateGuardian::_type_handle; TypeHandle OSMesaGraphicsStateGuardian::_type_handle;
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
// Function: MesaGraphicsStateGuardian::Constructor // Function: OSMesaGraphicsStateGuardian::Constructor
// Access: Public // Access: Public
// Description: // Description:
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
MesaGraphicsStateGuardian:: OSMesaGraphicsStateGuardian::
MesaGraphicsStateGuardian(const FrameBufferProperties &properties) : OSMesaGraphicsStateGuardian(const FrameBufferProperties &properties) :
GLGraphicsStateGuardian(properties) MesaGraphicsStateGuardian(properties)
{ {
_context = OSMesaCreateContext(OSMESA_RGBA, NULL); _context = OSMesaCreateContext(OSMESA_RGBA, NULL);
} }
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
// Function: MesaGraphicsStateGuardian::Destructor // Function: OSMesaGraphicsStateGuardian::Destructor
// Access: Public // Access: Public
// Description: // Description:
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
MesaGraphicsStateGuardian:: OSMesaGraphicsStateGuardian::
~MesaGraphicsStateGuardian() { ~OSMesaGraphicsStateGuardian() {
if (_context != (OSMesaContext)NULL) { if (_context != (OSMesaContext)NULL) {
OSMesaDestroyContext(_context); OSMesaDestroyContext(_context);
_context = (OSMesaContext)NULL; _context = (OSMesaContext)NULL;

View File

@ -1,4 +1,4 @@
// Filename: mesaGraphicsStateGuardian.h // Filename: osMesaGraphicsStateGuardian.h
// Created by: drose (09Feb04) // Created by: drose (09Feb04)
// //
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
@ -16,23 +16,23 @@
// //
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
#ifndef MESAGRAPHICSSTATEGUARDIAN_H #ifndef OSMESAGRAPHICSSTATEGUARDIAN_H
#define MESAGRAPHICSSTATEGUARDIAN_H #define OSMESAGRAPHICSSTATEGUARDIAN_H
#include "pandabase.h" #include "pandabase.h"
#include "mesagsg.h"
#include "glGraphicsStateGuardian.h" #include <GL/osmesa.h>
#include "mesaGraphicsPipe.h"
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
// Class : MesaGraphicsStateGuardian // Class : OSMesaGraphicsStateGuardian
// Description : A tiny specialization on GLGraphicsStateGuardian to // Description : A tiny specialization on MesaGraphicsStateGuardian to
// add some Mesa-specific information. // add a reference to the OSMesaContext.
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
class MesaGraphicsStateGuardian : public GLGraphicsStateGuardian { class EXPCL_PANDAMESA OSMesaGraphicsStateGuardian : public MesaGraphicsStateGuardian {
public: public:
MesaGraphicsStateGuardian(const FrameBufferProperties &properties); OSMesaGraphicsStateGuardian(const FrameBufferProperties &properties);
virtual ~MesaGraphicsStateGuardian(); virtual ~OSMesaGraphicsStateGuardian();
OSMesaContext _context; OSMesaContext _context;
@ -41,9 +41,9 @@ public:
return _type_handle; return _type_handle;
} }
static void init_type() { static void init_type() {
GLGraphicsStateGuardian::init_type(); MesaGraphicsStateGuardian::init_type();
register_type(_type_handle, "MesaGraphicsStateGuardian", register_type(_type_handle, "OSMesaGraphicsStateGuardian",
GLGraphicsStateGuardian::get_class_type()); MesaGraphicsStateGuardian::get_class_type());
} }
virtual TypeHandle get_type() const { virtual TypeHandle get_type() const {
return get_class_type(); return get_class_type();
@ -54,6 +54,6 @@ private:
static TypeHandle _type_handle; static TypeHandle _type_handle;
}; };
#include "mesaGraphicsStateGuardian.I" #include "osMesaGraphicsStateGuardian.I"
#endif #endif

View File

@ -124,6 +124,14 @@
#define EXPTP_PANDAGLUT extern #define EXPTP_PANDAGLUT extern
#endif #endif
#ifdef BUILDING_PANDAMESA
#define EXPCL_PANDAMESA __declspec(dllexport)
#define EXPTP_PANDAMESA
#else
#define EXPCL_PANDAMESA __declspec(dllimport)
#define EXPTP_PANDAMESA extern
#endif
#ifdef BUILDING_PANDAPHYSICS #ifdef BUILDING_PANDAPHYSICS
#define EXPCL_PANDAPHYSICS __declspec(dllexport) #define EXPCL_PANDAPHYSICS __declspec(dllexport)
#define EXPTP_PANDAPHYSICS #define EXPTP_PANDAPHYSICS
@ -194,6 +202,9 @@
#define EXPCL_PANDAGLUT #define EXPCL_PANDAGLUT
#define EXPTP_PANDAGLUT #define EXPTP_PANDAGLUT
#define EXPCL_PANDAMESA
#define EXPTP_PANDAMESA
#define EXPCL_PANDAPHYSICS #define EXPCL_PANDAPHYSICS
#define EXPTP_PANDAPHYSICS #define EXPTP_PANDAPHYSICS

View File

@ -19,7 +19,7 @@
#include "wglGraphicsBuffer.h" #include "wglGraphicsBuffer.h"
#include "config_wgldisplay.h" #include "config_wgldisplay.h"
#include "wglGraphicsPipe.h" #include "wglGraphicsPipe.h"
#include "glGraphicsStateGuardian.h" #include "glgsg.h"
#include "frameBufferProperties.h" #include "frameBufferProperties.h"
#include <wingdi.h> #include <wingdi.h>

View File

@ -22,7 +22,7 @@
#include "pandabase.h" #include "pandabase.h"
#include "wglExtensions.h" #include "wglExtensions.h"
#include "glGraphicsStateGuardian.h" #include "glgsg.h"
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
// Class : wglGraphicsStateGuardian // Class : wglGraphicsStateGuardian

View File

@ -20,7 +20,7 @@
#include "config_wgldisplay.h" #include "config_wgldisplay.h"
#include "config_windisplay.h" #include "config_windisplay.h"
#include "wglGraphicsPipe.h" #include "wglGraphicsPipe.h"
#include "glGraphicsStateGuardian.h" #include "glgsg.h"
#include <wingdi.h> #include <wingdi.h>
#include <ddraw.h> #include <ddraw.h>