30 const std::string &name,
36 GraphicsBuffer(engine, pipe, name, fb_prop, win_prop, flags, gsg, host)
39 DCAST_INTO_V(glx_pipe, _pipe);
45 _screenshot_buffer_type = _draw_buffer_type;
52 ~glxGraphicsBuffer() {
53 nassertv(_pbuffer == None);
64 PStatTimer timer(_make_current_pcollector, current_thread);
66 begin_frame_spam(mode);
67 if (_gsg ==
nullptr ||
73 DCAST_INTO_R(glxgsg, _gsg,
false);
76 glXMakeCurrent(_display, _pbuffer, glxgsg->_context);
83 glxgsg->reset_if_new();
85 if (mode == FM_render) {
87 for (
size_t i = 0; i != cdata->_textures.size(); ++i) {
88 const RenderTexture &rt = cdata->_textures[i];
89 RenderTextureMode rtm_mode = rt._rtm_mode;
90 if (rtm_mode == RTM_bind_or_copy) {
91 CDWriter cdataw(_cycler, cdata,
false);
92 nassertr(cdata->_textures.size() == cdataw->_textures.size(),
false);
93 cdataw->_textures[i]._rtm_mode = RTM_copy_texture;
96 clear_cube_map_selection();
100 return _gsg->begin_frame(current_thread);
110 end_frame_spam(mode);
111 nassertv(_gsg !=
nullptr);
113 if (mode == FM_render) {
117 _gsg->end_frame(current_thread);
119 if (mode == FM_render) {
121 clear_cube_map_selection();
128 void glxGraphicsBuffer::
130 if (_gsg !=
nullptr) {
132 glXMakeCurrent(_display, None,
nullptr);
134 if (_pbuffer != None) {
136 DCAST_INTO_V(glxgsg, _gsg);
137 glxgsg->_glXDestroyPbuffer(_display, _pbuffer);
152 bool glxGraphicsBuffer::
155 DCAST_INTO_R(glx_pipe, _pipe,
false);
159 if (_gsg ==
nullptr) {
167 DCAST_INTO_R(glxgsg, _gsg,
false);
169 if (!glxgsg->_context_has_pbuffer ||
178 if (glxgsg->_fbconfig == None || !glxgsg->_context_has_pbuffer) {
184 nassertr(glxgsg->_supports_pbuffer,
false);
188 static const int max_attrib_list = 32;
189 int attrib_list[max_attrib_list];
192 if (glxgsg->_uses_sgix_pbuffer) {
194 nassertr(n < max_attrib_list,
false);
195 attrib_list[n] = (int)None;
196 _pbuffer = glxgsg->_glXCreateGLXPbufferSGIX(glxgsg->_display, glxgsg->_fbconfig,
200 attrib_list[n++] = GLX_PBUFFER_WIDTH;
202 attrib_list[n++] = GLX_PBUFFER_HEIGHT;
205 nassertr(n < max_attrib_list,
false);
206 attrib_list[n] = (int)None;
207 _pbuffer = glxgsg->_glXCreatePbuffer(glxgsg->_display, glxgsg->_fbconfig,
211 if (_pbuffer == None) {
212 glxdisplay_cat.error()
213 <<
"failed to create GLX pbuffer.\n";
217 glXMakeCurrent(_display, _pbuffer, glxgsg->_context);
218 glxgsg->reset_if_new();
219 if (!glxgsg->is_valid()) {
224 (_fb_properties, glxgsg->get_gl_renderer())) {
This graphics pipe represents the interface for creating OpenGL graphics windows on an X-based (e....
A tiny specialization on GLGraphicsStateGuardian to add some glx-specific information.
void choose_pixel_format(const FrameBufferProperties &properties, X11_Display *_display, int _screen, bool need_pbuffer, bool need_pixmap)
Selects a visual or fbconfig for all the windows and buffers that use this gsg.
const FrameBufferProperties & get_fb_properties() const
Gets the FrameBufferProperties for all windows and buffers that use this GSG.
int get_y_size() const
Returns the visible height of the window or buffer, if it is known.
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...
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.
An offscreen buffer for rendering into.
int get_screen() const
Returns the X screen number associated with the pipe.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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(...
X11_Display * get_display() const
Returns a pointer to the X display associated with the pipe: the display on which to create the windo...
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...
bool verify_hardware_software(const FrameBufferProperties &props, const std::string &renderer) const
Validates that the properties represent the desired kind of renderer (hardware or software).
Similar to MutexHolder, but for a light reentrant mutex.
int get_x_size() const
Returns the visible width of the window or buffer, if it is known.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A thread; that is, a lightweight process.
Encapsulates all the communication with a particular instance of a given rendering backend.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
bool subsumes(const FrameBufferProperties &other) const
Returns true if this set of properties makes strictly greater or equal demands of the framebuffer tha...
This class is the main interface to controlling the render process.
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.
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.
const FrameBufferProperties & get_fb_properties() const
Returns the framebuffer properties of the window.