28 const std::string &name,
34 GraphicsBuffer(engine, pipe, name, fb_prop, win_prop, flags, gsg, host)
37 DCAST_INTO_V(osx_pipe, _pipe);
43 _screenshot_buffer_type = _draw_buffer_type;
50 ~osxGraphicsBuffer() {
51 nassertv(_pbuffer ==
nullptr);
64 begin_frame_spam(mode);
65 if (_gsg ==
nullptr) {
68 nassertr(_pbuffer !=
nullptr,
false);
71 DCAST_INTO_R(osxgsg, _gsg,
false);
72 if (!aglSetPBuffer(osxgsg->get_context(), _pbuffer, 0, 0, 0)) {
73 report_agl_error(
"aglSetPBuffer");
77 if (!aglSetCurrentContext(osxgsg->get_context())) {
78 report_agl_error(
"aglSetCurrentContext");
82 osxgsg->reset_if_new();
84 if (mode == FM_render) {
86 for (
size_t i = 0; i != cdata->_textures.size(); ++i) {
87 const RenderTexture &rt = cdata->_textures[i];
88 RenderTextureMode rtm_mode = rt._rtm_mode;
89 if (rtm_mode == RTM_bind_or_copy) {
90 CDWriter cdataw(_cycler, cdata,
false);
91 nassertr(cdata->_textures.size() == cdataw->_textures.size(),
false);
92 cdataw->_textures[i]._rtm_mode = RTM_copy_texture;
95 clear_cube_map_selection();
98 return _gsg->begin_frame(current_thread);
108 end_frame_spam(mode);
109 nassertv(_gsg !=
nullptr);
111 if (mode == FM_render) {
115 _gsg->end_frame(current_thread);
117 if (mode == FM_render) {
119 clear_cube_map_selection();
126 void osxGraphicsBuffer::
128 if (_gsg !=
nullptr) {
132 if (_pbuffer !=
nullptr) {
133 aglDestroyPBuffer(_pbuffer);
143 bool osxGraphicsBuffer::
149 if (_pbuffer ==
nullptr) {
150 GLenum target = GL_TEXTURE_RECTANGLE_ARB;
155 target = GL_TEXTURE_2D;
157 if (!aglCreatePBuffer(_size.get_x(), _size.get_y(), target, GL_RGBA, 0, &_pbuffer)) {
158 report_agl_error(
"aglCreatePBuffer");
165 DCAST_INTO_R(osxgsg, _gsg,
false);
167 OSStatus stat = osxgsg->
build_gl(
false,
true, _fb_properties);
172 if (!aglSetPBuffer(osxgsg->get_context(), _pbuffer, 0, 0, 0)) {
173 report_agl_error(
"aglSetPBuffer");
178 if (!aglSetCurrentContext(osxgsg->get_context())) {
179 report_agl_error(
"aglSetCurrentContext");
183 osxgsg->reset_if_new();
184 if (!osxgsg->is_valid()) {
virtual void end_frame(FrameMode mode, Thread *current_thread)
This function will be called within the draw thread after rendering is completed for a given frame.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
virtual bool begin_frame(FrameMode mode, Thread *current_thread)
This function will be called within the draw thread before beginning rendering for a given frame.
This graphics pipe represents the interface for creating OpenGL graphics windows on the various OSX's...
A tiny specialization on GLGraphicsStateGuardian to add some wgl-specific information.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A lightweight class that can be used to automatically start and stop a PStatCollector around a sectio...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A container for the various kinds of properties we might ask to have on a graphics window before we o...
An offscreen buffer for rendering into.
An object to create GraphicsOutputs that share a particular 3-D API.
This template class calls PipelineCycler::read() in the constructor and PipelineCycler::release_read(...
OSStatus build_gl(bool full_screen, bool pbuffer, FrameBufferProperties &fb_props)
This function will build up a context for a gsg.
This template class calls PipelineCycler::write() in the constructor and PipelineCycler::release_writ...
This is a base class for the various different classes that represent the result of a frame of render...
static int up_to_power_2(int value)
Returns the smallest power of 2 greater than or equal to value.
A thread; that is, a lightweight process.
Encapsulates all the communication with a particular instance of a given rendering backend.
This class is the main interface to controlling the render process.
TypeHandle is the identifier used to differentiate C++ class types.
A container for the various kinds of properties we might ask to have on a graphics frameBuffer before...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
const FrameBufferProperties & get_fb_properties() const
Returns the framebuffer properties of the window.