mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 10:54:24 -04:00
support multisamples properly
This commit is contained in:
parent
4a70282208
commit
64a8ebfb02
@ -47,11 +47,6 @@ get_extension_func(const char *prefix, const char *name) {
|
|||||||
symbol = NSLookupAndBindSymbol (fullname.c_str());
|
symbol = NSLookupAndBindSymbol (fullname.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (osxdisplay_cat.is_debug()) {
|
|
||||||
osxdisplay_cat.debug()
|
|
||||||
<< "Looking up symbol " << fullname << "\n" ;
|
|
||||||
}
|
|
||||||
|
|
||||||
return symbol ? NSAddressOfSymbol(symbol) : NULL;
|
return symbol ? NSAddressOfSymbol(symbol) : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -68,7 +63,7 @@ osxGraphicsStateGuardian(GraphicsEngine *engine, GraphicsPipe *pipe,
|
|||||||
_aglPixFmt(NULL),
|
_aglPixFmt(NULL),
|
||||||
_aglcontext(NULL)
|
_aglcontext(NULL)
|
||||||
{
|
{
|
||||||
SharedBuffer = 1011;
|
_shared_buffer = 1011;
|
||||||
get_gamma_table();
|
get_gamma_table();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -215,8 +210,13 @@ build_gl(bool full_screen, bool pbuffer, FrameBufferProperties &fb_props) {
|
|||||||
attrib.push_back(fb_props.get_depth_bits());
|
attrib.push_back(fb_props.get_depth_bits());
|
||||||
attrib.push_back(AGL_STENCIL_SIZE);
|
attrib.push_back(AGL_STENCIL_SIZE);
|
||||||
attrib.push_back(fb_props.get_stencil_bits());
|
attrib.push_back(fb_props.get_stencil_bits());
|
||||||
|
if (fb_props.get_multisamples() != 0) {
|
||||||
|
attrib.push_back(AGL_MULTISAMPLE);
|
||||||
|
attrib.push_back(AGL_SAMPLE_BUFFERS_ARB);
|
||||||
|
attrib.push_back(1);
|
||||||
attrib.push_back(AGL_SAMPLES_ARB);
|
attrib.push_back(AGL_SAMPLES_ARB);
|
||||||
attrib.push_back(fb_props.get_multisamples());
|
attrib.push_back(fb_props.get_multisamples());
|
||||||
|
}
|
||||||
|
|
||||||
if (fb_props.is_stereo()) {
|
if (fb_props.is_stereo()) {
|
||||||
attrib.push_back(AGL_STEREO);
|
attrib.push_back(AGL_STEREO);
|
||||||
@ -247,29 +247,29 @@ build_gl(bool full_screen, bool pbuffer, FrameBufferProperties &fb_props) {
|
|||||||
// build context
|
// build context
|
||||||
_aglcontext = NULL;
|
_aglcontext = NULL;
|
||||||
_aglPixFmt = aglChoosePixelFormat(&display, 1, &attrib[0]);
|
_aglPixFmt = aglChoosePixelFormat(&display, 1, &attrib[0]);
|
||||||
err = report_agl_error ("aglChoosePixelFormat");
|
err = report_agl_error("aglChoosePixelFormat");
|
||||||
if (_aglPixFmt) {
|
if (_aglPixFmt) {
|
||||||
if(_share_with == NULL) {
|
if(_share_with == NULL) {
|
||||||
_aglcontext = aglCreateContext(_aglPixFmt, NULL);
|
_aglcontext = aglCreateContext(_aglPixFmt, NULL);
|
||||||
} else {
|
} else {
|
||||||
_aglcontext = aglCreateContext(_aglPixFmt, ((osxGraphicsStateGuardian *)_share_with)->_aglcontext);
|
_aglcontext = aglCreateContext(_aglPixFmt, ((osxGraphicsStateGuardian *)_share_with)->_aglcontext);
|
||||||
}
|
}
|
||||||
err = report_agl_error ("aglCreateContext");
|
err = report_agl_error("aglCreateContext");
|
||||||
|
|
||||||
if (_aglcontext == NULL) {
|
if (_aglcontext == NULL) {
|
||||||
osxdisplay_cat.error()
|
osxdisplay_cat.error()
|
||||||
<< "osxGraphicsStateGuardian::buildG Error Getting Gl Context \n" ;
|
<< "osxGraphicsStateGuardian::build_gl Error Getting GL Context \n" ;
|
||||||
if(err == noErr) {
|
if(err == noErr) {
|
||||||
err = -1;
|
err = -1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
aglSetInteger (_aglcontext, AGL_BUFFER_NAME, &SharedBuffer);
|
aglSetInteger(_aglcontext, AGL_BUFFER_NAME, &_shared_buffer);
|
||||||
err = report_agl_error("aglSetInteger AGL_BUFFER_NAME");
|
err = report_agl_error("aglSetInteger AGL_BUFFER_NAME");
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
osxdisplay_cat.error()
|
osxdisplay_cat.error()
|
||||||
<< "osxGraphicsStateGuardian::buildG Error Getting Pixel Format\n" ;
|
<< "osxGraphicsStateGuardian::build_gl Error Getting Pixel Format\n" ;
|
||||||
osxdisplay_cat.error()
|
osxdisplay_cat.error()
|
||||||
<< fb_props << "\n";
|
<< fb_props << "\n";
|
||||||
if(err == noErr) {
|
if(err == noErr) {
|
||||||
|
@ -51,7 +51,7 @@ protected:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
OSStatus build_gl(bool full_screen, bool pbuffer, FrameBufferProperties &fb_props);
|
OSStatus build_gl(bool full_screen, bool pbuffer, FrameBufferProperties &fb_props);
|
||||||
AGLContext get_context(void) { return _aglcontext; };
|
AGLContext get_context() { return _aglcontext; };
|
||||||
|
|
||||||
const AGLPixelFormat get_agl_pixel_format() const { return _aglPixFmt; };
|
const AGLPixelFormat get_agl_pixel_format() const { return _aglPixFmt; };
|
||||||
|
|
||||||
@ -71,7 +71,7 @@ private:
|
|||||||
CGDisplayErr _cgErr;
|
CGDisplayErr _cgErr;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
GLint SharedBuffer;
|
GLint _shared_buffer;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static TypeHandle get_class_type() {
|
static TypeHandle get_class_type() {
|
||||||
|
@ -568,14 +568,14 @@ release_system_resources() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (_osx_window != NULL) {
|
if (_osx_window != NULL) {
|
||||||
SetWRefCon (_osx_window, (long int) NULL);
|
SetWRefCon(_osx_window, (long int) NULL);
|
||||||
HideWindow (_osx_window);
|
HideWindow(_osx_window);
|
||||||
DisposeWindow(_osx_window);
|
DisposeWindow(_osx_window);
|
||||||
_osx_window = NULL;
|
_osx_window = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_holder_aglcontext) {
|
if (_holder_aglcontext) {
|
||||||
aglDestroyContext (_holder_aglcontext);
|
aglDestroyContext(_holder_aglcontext);
|
||||||
_holder_aglcontext = NULL;
|
_holder_aglcontext = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -714,7 +714,7 @@ build_gl(bool full_screen) {
|
|||||||
OSStatus err = noErr;
|
OSStatus err = noErr;
|
||||||
|
|
||||||
if (osxgsg->get_agl_pixel_format()) {
|
if (osxgsg->get_agl_pixel_format()) {
|
||||||
_holder_aglcontext = aglCreateContext(osxgsg->get_agl_pixel_format(),NULL);
|
_holder_aglcontext = aglCreateContext(osxgsg->get_agl_pixel_format(), NULL);
|
||||||
|
|
||||||
err = report_agl_error("aglCreateContext");
|
err = report_agl_error("aglCreateContext");
|
||||||
if (_holder_aglcontext == NULL) {
|
if (_holder_aglcontext == NULL) {
|
||||||
@ -724,7 +724,7 @@ build_gl(bool full_screen) {
|
|||||||
err = -1;
|
err = -1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
aglSetInteger(_holder_aglcontext, AGL_BUFFER_NAME, &osxgsg->SharedBuffer);
|
aglSetInteger(_holder_aglcontext, AGL_BUFFER_NAME, &osxgsg->_shared_buffer);
|
||||||
err = report_agl_error ("aglSetInteger AGL_BUFFER_NAME");
|
err = report_agl_error ("aglSetInteger AGL_BUFFER_NAME");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -1216,8 +1216,8 @@ os_open_window(WindowProperties &req_properties) {
|
|||||||
osxdisplay_cat.error()
|
osxdisplay_cat.error()
|
||||||
<< "Error in build_gl\n";
|
<< "Error in build_gl\n";
|
||||||
|
|
||||||
HideWindow (_osx_window);
|
HideWindow(_osx_window);
|
||||||
SetWRefCon (_osx_window, (long int) NULL);
|
SetWRefCon(_osx_window, (long int) NULL);
|
||||||
DisposeWindow(_osx_window);
|
DisposeWindow(_osx_window);
|
||||||
_osx_window = NULL;
|
_osx_window = NULL;
|
||||||
return false;
|
return false;
|
||||||
@ -1227,10 +1227,10 @@ os_open_window(WindowProperties &req_properties) {
|
|||||||
<< "build_gl complete, set properties\n";
|
<< "build_gl complete, set properties\n";
|
||||||
|
|
||||||
//
|
//
|
||||||
// atach the holder context to the window..
|
// attach the holder context to the window..
|
||||||
//
|
//
|
||||||
|
|
||||||
if (!aglSetDrawable(_holder_aglcontext, GetWindowPort (_osx_window))) {
|
if (!aglSetDrawable(_holder_aglcontext, GetWindowPort(_osx_window))) {
|
||||||
err = report_agl_error("aglSetDrawable");
|
err = report_agl_error("aglSetDrawable");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user