Panda3D

Loading...
Searching...
No Matches
wglGraphicsBuffer.h
Go to the documentation of this file.
1/**
2 * PANDA 3D SOFTWARE
3 * Copyright (c) Carnegie Mellon University. All rights reserved.
4 *
5 * All use of this software is subject to the terms of the revised BSD
6 * license. You should have received a copy of this license along
7 * with this source code in a file named "LICENSE."
8 *
9 * @file wglGraphicsBuffer.h
10 * @author drose
11 * @date 2004-02-08
12 */
13
14#ifndef WGLGRAPHICSBUFFER_H
15#define WGLGRAPHICSBUFFER_H
16
17#include "pandabase.h"
18#include "graphicsBuffer.h"
19#include "glgsg.h"
20
21// This must be included after we have included glgsg.h (which includes gl.h).
22#include "wglext.h"
23#ifndef WIN32_LEAN_AND_MEAN
24#define WIN32_LEAN_AND_MEAN 1
25#endif
26#include <windows.h>
27
28/**
29 * An offscreen render buffer. In OpenGL under Windows, this simply renders
30 * into a window that is never made visible. There's a Windows interface for
31 * rendering into a DIB, but this puts restrictions on the kind of pixelformat
32 * we can use, and thus makes it difficult to support one GSG rendering into
33 * an offscreen buffer and also into a window.
34 */
35 class EXPCL_PANDA_WGLDISPLAY wglGraphicsBuffer : public GraphicsBuffer {
36 public:
37 wglGraphicsBuffer(GraphicsEngine *engine, GraphicsPipe *pipe,
38 const std::string &name,
39 const FrameBufferProperties &fb_prop,
40 const WindowProperties &win_prop,
41 int flags,
42 GraphicsStateGuardian *gsg,
43 GraphicsOutput *host);
44 virtual ~wglGraphicsBuffer();
45
46 virtual bool begin_frame(FrameMode mode, Thread *current_thread);
47 virtual void end_frame(FrameMode mode, Thread *current_thread);
48
49 virtual void select_target_tex_page(int page);
50
51 virtual void process_events();
52
53 virtual bool get_supports_render_texture() const;
54
55 protected:
56 virtual void close_buffer();
57 virtual bool open_buffer();
58
59 private:
60 void bind_texture_to_pbuffer();
61 bool rebuild_bitplanes();
62 void release_pbuffer();
63
64 static void process_1_event();
65
66 HPBUFFERARB _pbuffer;
67 HDC _pbuffer_dc;
68 bool _pbuffer_mipmap;
69 Texture::TextureType _pbuffer_type;
70 int _pbuffer_sizex;
71 int _pbuffer_sizey;
72 PT(Texture) _pbuffer_bound;
73
74 public:
75 static TypeHandle get_class_type() {
76 return _type_handle;
77 }
78 static void init_type() {
79 GraphicsBuffer::init_type();
80 register_type(_type_handle, "wglGraphicsBuffer",
81 GraphicsBuffer::get_class_type());
82 }
83 virtual TypeHandle get_type() const {
84 return get_class_type();
85 }
86 virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
87
88 private:
89 static TypeHandle _type_handle;
90
91 friend class wglGraphicsStateGuardian;
92};
93
94#include "wglGraphicsBuffer.I"
95
96#endif
FrameBufferProperties
A container for the various kinds of properties we might ask to have on a graphics frameBuffer before...
Definition frameBufferProperties.h:26
GraphicsBuffer::process_events
virtual void process_events()
Honor any requests recently made via request_open() or request_close().
Definition graphicsBuffer.cxx:103
GraphicsOutput::end_frame
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.
Definition graphicsOutput.cxx:1180
GraphicsOutput::get_supports_render_texture
get_supports_render_texture
Returns true if this particular GraphicsOutput can render directly into a texture,...
Definition graphicsOutput.h:249
GraphicsOutput::begin_frame
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.
Definition graphicsOutput.cxx:1170
GraphicsOutput::select_target_tex_page
virtual void select_target_tex_page(int page)
Called internally when the window is in render-to-a-texture mode and we are in the process of renderi...
Definition graphicsOutput.cxx:1267
GraphicsStateGuardian
Encapsulates all the communication with a particular instance of a given rendering backend.
Definition graphicsStateGuardian.h:65
Texture
Represents a texture object, which is typically a single 2-d image but may also represent a 1-d or 3-...
Definition texture.h:72
Thread
A thread; that is, a lightweight process.
Definition thread.h:46
TypeHandle
TypeHandle is the identifier used to differentiate C++ class types.
Definition typeHandle.h:81
WindowProperties
A container for the various kinds of properties we might ask to have on a graphics window before we o...
Definition windowProperties.h:29
glgsg.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
graphicsBuffer.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
pandabase.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
register_type
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...
Definition register_type.I:22
wglGraphicsBuffer.I
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.