Merge lp:~unity-team/nux/nux.depth-texture-detection-support into lp:nux
- nux.depth-texture-detection-support
- Merge into trunk
Status: | Merged |
---|---|
Approved by: | Jay Taoko |
Approved revision: | 724 |
Merged at revision: | 726 |
Proposed branch: | lp:~unity-team/nux/nux.depth-texture-detection-support |
Merge into: | lp:nux |
Diff against target: |
535 lines (+174/-64) 8 files modified
Nux/WindowCompositor.cpp (+28/-5) Nux/WindowCompositor.h (+3/-0) NuxGraphics/GpuDevice.cpp (+48/-19) NuxGraphics/GpuDevice.h (+3/-1) NuxGraphics/GpuDeviceTexture.cpp (+46/-10) NuxGraphics/GraphicsEngine.cpp (+15/-12) NuxGraphics/IOpenGLFrameBufferObject.cpp (+30/-17) NuxGraphics/IOpenGLFrameBufferObject.h (+1/-0) |
To merge this branch: | bzr merge lp:~unity-team/nux/nux.depth-texture-detection-support |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Tim Penhey (community) | Approve | ||
PS Jenkins bot | continuous-integration | Pending | |
Review via email: mp+134729@code.launchpad.net |
Commit message
* Added depth texture support detection.
* Disable use of depth textures if support not available.
Description of the change
* Added depth texture support detection.
* Disable use of depth textures if support not available.
- 709. By MC Return
-
Performance:
Check for emptiness instead of calculating the size as this might be inefficient.
xxxx.size() can take linear time while xxxx.empty() is guaranteed to take constant time.Approved by Michi Henning.
- 710. By MC Return
-
Performance: Do not create unnecessary string copies by converting const char* to std::string, instead use those directly.
Approved by Michi Henning.
- 711. By Michael Terry
-
Enable headless tests during build.
Approved by Didier Roche.
- 712. By Brandon Schaefer
-
Adds a input area proximity class which takes an input area and the proximity.
It has 3 signals, mouse_near, mouse_approaching, and mouse_beyond. They depend on the CheckMousePosition function. The default function expands each side of the InputArea by the proximity and checks if the mouse is within that geo. If true then emit mouse_near, if the mouse then is moved from that geo mouse_beyond will emit. (Some what like enter/leave). If the mouse is near, but not yet inside the input area then the mouse_approaching signal emits the mouses position and the distance to the input area. Fixes: https:/
/bugs.launchpad .net/bugs/ 608124. Approved by Jay Taoko, Marco Trevisan (Treviño).
- 713. By Tim Penhey
-
- Introducing improvements for ARM build.
- Resolved build failures
- Added --enable-x-support option
- Added --enable-minimal- build option [Tests] Covered by existing tests.
Approved by Brandon Schaefer, Jay Taoko.
- 714. By Ricardo Salveti
-
make check-headless should respect DEB_BUILD_
OPTIONS= nocheck
.Approved by Didier Roche.
- 715. By Brandon Schaefer
-
Check the position of mouse events for InputAreaProxim
ities if an event type is NUX_WINDOW_ MOUSE_LEAVE. Approved by Jay Taoko.
- 716. By Tim Penhey
-
Make tests/gtest-nuxcore only depend on NuxCore libs.
Approved by Brandon Schaefer.
- 717. By Michi Henning
-
Fixes random color generation (which left the green component always at zero) in RandomColorINT().
Approved by Michi Henning.
- 718. By Albert Astals Cid
-
Make GetPosition const.
Approved by Marco Trevisan (Treviño), Neil J. Patel.
- 719. By Michi Henning
-
Added unit test for RandomColor().
Approved by .
- 720. By Brandon Schaefer
-
Fixes multi monitor issue with input area prox.
Approved by Andrea Azzarone.
- 721. By Marco Trevisan (Treviño)
-
AnimationValue: add Reverse and CurrentTimePosition methods
The first allow to revert the "direction" of an animation, while the second returns the current elapsed time since the animation has started.
Approved by Tim Penhey.
- 722. By Daniel d'Andrada
-
Fix build when geis is located outside /usr.
Approved by Stephen M. Webb.
- 723. By Jay Taoko
-
* Merged with lp:nux
- 724. By Jay Taoko
-
* Fixed ARM build error [-Werror=
unused- but-set- variable]
Sean Feole (sfeole) wrote : | # |
Last night I successfully installed and tested nux4.0 and unity 6.12 built by Lucasz (sil2100) in the unity-team/ppa targeted for Quantal. All of the packages appeared to work as expected.
If Jay is rebasing this patch to the nux trunk and I would be happy to retest once that finishes.
Preview Diff
1 | === modified file 'Nux/WindowCompositor.cpp' | |||
2 | --- Nux/WindowCompositor.cpp 2012-11-22 00:48:56 +0000 | |||
3 | +++ Nux/WindowCompositor.cpp 2012-11-28 15:20:28 +0000 | |||
4 | @@ -61,6 +61,8 @@ | |||
5 | 61 | on_menu_closure_continue_with_event_ = false; | 61 | on_menu_closure_continue_with_event_ = false; |
6 | 62 | _mouse_position_on_owner = Point(0, 0); | 62 | _mouse_position_on_owner = Point(0, 0); |
7 | 63 | 63 | ||
8 | 64 | platform_support_for_depth_texture_ = GetGraphicsDisplay()->GetGpuDevice()->GetGpuInfo().Support_Depth_Buffer(); | ||
9 | 65 | |||
10 | 64 | m_FrameBufferObject = GetGraphicsDisplay()->GetGpuDevice()->CreateFrameBufferObject(); | 66 | m_FrameBufferObject = GetGraphicsDisplay()->GetGpuDevice()->CreateFrameBufferObject(); |
11 | 65 | // Do not leave the Fbo binded. Deactivate it. | 67 | // Do not leave the Fbo binded. Deactivate it. |
12 | 66 | m_FrameBufferObject->Deactivate(); | 68 | m_FrameBufferObject->Deactivate(); |
13 | @@ -68,7 +70,11 @@ | |||
14 | 68 | // At this stage, the size of the window may not be known yet. | 70 | // At this stage, the size of the window may not be known yet. |
15 | 69 | // FormatRenderTargets will be called the first time runtime gets into WindowThread::ExecutionLoop | 71 | // FormatRenderTargets will be called the first time runtime gets into WindowThread::ExecutionLoop |
16 | 70 | m_MainColorRT = GetGraphicsDisplay()->GetGpuDevice()->CreateSystemCapableDeviceTexture(2, 2, 1, BITFMT_R8G8B8A8, NUX_TRACKER_LOCATION); | 72 | m_MainColorRT = GetGraphicsDisplay()->GetGpuDevice()->CreateSystemCapableDeviceTexture(2, 2, 1, BITFMT_R8G8B8A8, NUX_TRACKER_LOCATION); |
18 | 71 | m_MainDepthRT = GetGraphicsDisplay()->GetGpuDevice()->CreateSystemCapableDeviceTexture(2, 2, 1, BITFMT_D24S8, NUX_TRACKER_LOCATION); | 73 | |
19 | 74 | if (platform_support_for_depth_texture_) | ||
20 | 75 | { | ||
21 | 76 | m_MainDepthRT = GetGraphicsDisplay()->GetGpuDevice()->CreateSystemCapableDeviceTexture(2, 2, 1, BITFMT_D24S8, NUX_TRACKER_LOCATION); | ||
22 | 77 | } | ||
23 | 72 | 78 | ||
24 | 73 | #if !defined(NUX_MINIMAL) | 79 | #if !defined(NUX_MINIMAL) |
25 | 74 | _mouse_over_menu_page = NULL; | 80 | _mouse_over_menu_page = NULL; |
26 | @@ -1625,10 +1631,17 @@ | |||
27 | 1625 | buffer_width = window_thread_->GetGraphicsEngine().GetWindowWidth(); | 1631 | buffer_width = window_thread_->GetGraphicsEngine().GetWindowWidth(); |
28 | 1626 | buffer_height = window_thread_->GetGraphicsEngine().GetWindowHeight(); | 1632 | buffer_height = window_thread_->GetGraphicsEngine().GetWindowHeight(); |
29 | 1627 | 1633 | ||
31 | 1628 | if ((!m_MainColorRT.IsValid()) || (!m_MainDepthRT.IsValid()) || (m_MainColorRT->GetWidth() != buffer_width) || (m_MainColorRT->GetHeight() != buffer_height)) | 1634 | if ((!m_MainColorRT.IsValid()) || (m_MainColorRT->GetWidth() != buffer_width) || (m_MainColorRT->GetHeight() != buffer_height)) |
32 | 1629 | { | 1635 | { |
33 | 1630 | m_MainColorRT = GetGraphicsDisplay()->GetGpuDevice()->CreateSystemCapableDeviceTexture(buffer_width, buffer_height, 1, BITFMT_R8G8B8A8, NUX_TRACKER_LOCATION); | 1636 | m_MainColorRT = GetGraphicsDisplay()->GetGpuDevice()->CreateSystemCapableDeviceTexture(buffer_width, buffer_height, 1, BITFMT_R8G8B8A8, NUX_TRACKER_LOCATION); |
35 | 1631 | m_MainDepthRT = GetGraphicsDisplay()->GetGpuDevice()->CreateSystemCapableDeviceTexture(buffer_width, buffer_height, 1, BITFMT_D24S8, NUX_TRACKER_LOCATION); | 1637 | } |
36 | 1638 | |||
37 | 1639 | if (platform_support_for_depth_texture_) | ||
38 | 1640 | { | ||
39 | 1641 | if ((!m_MainDepthRT.IsValid()) || (m_MainDepthRT->GetWidth() != buffer_width) || (m_MainDepthRT->GetHeight() != buffer_height)) | ||
40 | 1642 | { | ||
41 | 1643 | m_MainDepthRT = GetGraphicsDisplay()->GetGpuDevice()->CreateSystemCapableDeviceTexture(buffer_width, buffer_height, 1, BITFMT_D24S8, NUX_TRACKER_LOCATION); | ||
42 | 1644 | } | ||
43 | 1632 | } | 1645 | } |
44 | 1633 | 1646 | ||
45 | 1634 | m_FrameBufferObject->FormatFrameBufferObject(buffer_width, buffer_height, BITFMT_R8G8B8A8); | 1647 | m_FrameBufferObject->FormatFrameBufferObject(buffer_width, buffer_height, BITFMT_R8G8B8A8); |
46 | @@ -2050,7 +2063,10 @@ | |||
47 | 2050 | nuxAssert(buffer_height >= 1); | 2063 | nuxAssert(buffer_height >= 1); |
48 | 2051 | 2064 | ||
49 | 2052 | m_MainColorRT = GetGraphicsDisplay()->GetGpuDevice()->CreateSystemCapableDeviceTexture(buffer_width, buffer_height, 1, BITFMT_R8G8B8A8, NUX_TRACKER_LOCATION); | 2065 | m_MainColorRT = GetGraphicsDisplay()->GetGpuDevice()->CreateSystemCapableDeviceTexture(buffer_width, buffer_height, 1, BITFMT_R8G8B8A8, NUX_TRACKER_LOCATION); |
51 | 2053 | m_MainDepthRT = GetGraphicsDisplay()->GetGpuDevice()->CreateSystemCapableDeviceTexture(buffer_width, buffer_height, 1, BITFMT_D24S8, NUX_TRACKER_LOCATION); | 2066 | if (platform_support_for_depth_texture_) |
52 | 2067 | { | ||
53 | 2068 | m_MainDepthRT = GetGraphicsDisplay()->GetGpuDevice()->CreateSystemCapableDeviceTexture(buffer_width, buffer_height, 1, BITFMT_D24S8, NUX_TRACKER_LOCATION); | ||
54 | 2069 | } | ||
55 | 2054 | 2070 | ||
56 | 2055 | // Clear the buffer the first time... | 2071 | // Clear the buffer the first time... |
57 | 2056 | m_FrameBufferObject->FormatFrameBufferObject(buffer_width, buffer_height, BITFMT_R8G8B8A8); | 2072 | m_FrameBufferObject->FormatFrameBufferObject(buffer_width, buffer_height, BITFMT_R8G8B8A8); |
58 | @@ -2093,7 +2109,14 @@ | |||
59 | 2093 | if ((rt.color_rt->GetWidth() != buffer_width) || (rt.color_rt->GetHeight() != buffer_height)) | 2109 | if ((rt.color_rt->GetWidth() != buffer_width) || (rt.color_rt->GetHeight() != buffer_height)) |
60 | 2094 | { | 2110 | { |
61 | 2095 | rt.color_rt = GetGraphicsDisplay()->GetGpuDevice()->CreateSystemCapableDeviceTexture(buffer_width, buffer_height, 1, BITFMT_R8G8B8A8, NUX_TRACKER_LOCATION); | 2111 | rt.color_rt = GetGraphicsDisplay()->GetGpuDevice()->CreateSystemCapableDeviceTexture(buffer_width, buffer_height, 1, BITFMT_R8G8B8A8, NUX_TRACKER_LOCATION); |
63 | 2096 | rt.depth_rt = GetGraphicsDisplay()->GetGpuDevice()->CreateSystemCapableDeviceTexture(buffer_width, buffer_height, 1, BITFMT_D24S8, NUX_TRACKER_LOCATION); | 2112 | } |
64 | 2113 | |||
65 | 2114 | if (platform_support_for_depth_texture_) | ||
66 | 2115 | { | ||
67 | 2116 | if ((rt.depth_rt->GetWidth() != buffer_width) || (rt.depth_rt->GetHeight() != buffer_height)) | ||
68 | 2117 | { | ||
69 | 2118 | rt.depth_rt = GetGraphicsDisplay()->GetGpuDevice()->CreateSystemCapableDeviceTexture(buffer_width, buffer_height, 1, BITFMT_D24S8, NUX_TRACKER_LOCATION); | ||
70 | 2119 | } | ||
71 | 2097 | } | 2120 | } |
72 | 2098 | 2121 | ||
73 | 2099 | m_FrameBufferObject->FormatFrameBufferObject(buffer_width, buffer_height, BITFMT_R8G8B8A8); | 2122 | m_FrameBufferObject->FormatFrameBufferObject(buffer_width, buffer_height, BITFMT_R8G8B8A8); |
74 | 2100 | 2123 | ||
75 | === modified file 'Nux/WindowCompositor.h' | |||
76 | --- Nux/WindowCompositor.h 2012-11-20 22:13:38 +0000 | |||
77 | +++ Nux/WindowCompositor.h 2012-11-28 15:20:28 +0000 | |||
78 | @@ -536,6 +536,9 @@ | |||
79 | 536 | unsigned int reference_fbo_; | 536 | unsigned int reference_fbo_; |
80 | 537 | Geometry reference_fbo_geometry_; | 537 | Geometry reference_fbo_geometry_; |
81 | 538 | 538 | ||
82 | 539 | //! True if the platform has support for depth textures. | ||
83 | 540 | bool platform_support_for_depth_texture_; | ||
84 | 541 | |||
85 | 539 | //! Pointer grab stack. | 542 | //! Pointer grab stack. |
86 | 540 | /*! | 543 | /*! |
87 | 541 | The head of the list is the top of the stack. | 544 | The head of the list is the top of the stack. |
88 | 542 | 545 | ||
89 | === modified file 'NuxGraphics/GpuDevice.cpp' | |||
90 | --- NuxGraphics/GpuDevice.cpp 2012-11-12 20:59:56 +0000 | |||
91 | +++ NuxGraphics/GpuDevice.cpp 2012-11-28 15:20:28 +0000 | |||
92 | @@ -187,26 +187,49 @@ | |||
93 | 187 | STREAMSOURCE GpuDevice::_StreamSource[MAX_NUM_STREAM]; | 187 | STREAMSOURCE GpuDevice::_StreamSource[MAX_NUM_STREAM]; |
94 | 188 | 188 | ||
95 | 189 | GpuInfo::GpuInfo() | 189 | GpuInfo::GpuInfo() |
102 | 190 | : _opengl_max_texture_size(0) | 190 | : _support_opengl_version_11(false) |
103 | 191 | , _opengl_max_texture_units(0) | 191 | , _support_opengl_version_12(false) |
104 | 192 | , _opengl_max_texture_coords(0) | 192 | , _support_opengl_version_13(false) |
105 | 193 | , _opengl_max_texture_image_units(0) | 193 | , _support_opengl_version_14(false) |
106 | 194 | , _opengl_max_fb_attachment(0) | 194 | , _support_opengl_version_15(false) |
107 | 195 | , _opengl_max_vertex_attributes(0) | 195 | , _support_opengl_version_20(false) |
108 | 196 | , _support_opengl_version_21(false) | ||
109 | 197 | , _support_opengl_version_30(false) | ||
110 | 198 | , _support_opengl_version_31(false) | ||
111 | 199 | , _support_opengl_version_32(false) | ||
112 | 200 | , _support_opengl_version_33(false) | ||
113 | 201 | , _support_opengl_version_40(false) | ||
114 | 202 | , _support_opengl_version_41(false) | ||
115 | 203 | , _opengl_max_texture_size(0) | ||
116 | 204 | , _opengl_max_texture_units(0) | ||
117 | 205 | , _opengl_max_texture_coords(0) | ||
118 | 206 | , _opengl_max_texture_image_units(0) | ||
119 | 207 | , _opengl_max_fb_attachment(0) | ||
120 | 208 | , _opengl_max_vertex_attributes(0) | ||
121 | 209 | , _support_ext_swap_control(false) | ||
122 | 210 | , _support_arb_vertex_program(false) | ||
123 | 211 | , _support_arb_fragment_program(false) | ||
124 | 212 | , _support_arb_shader_objects(false) | ||
125 | 213 | , _support_arb_vertex_shader(false) | ||
126 | 214 | , _support_arb_fragment_shader(false) | ||
127 | 215 | , _support_arb_vertex_buffer_object(false) | ||
128 | 216 | , _support_arb_texture_non_power_of_two(false) | ||
129 | 217 | , _support_ext_framebuffer_object(false) | ||
130 | 218 | , _support_ext_draw_range_elements(false) | ||
131 | 219 | , _support_ext_stencil_two_side(false) | ||
132 | 220 | , _support_ext_texture_rectangle(false) | ||
133 | 221 | , _support_arb_texture_rectangle(false) | ||
134 | 222 | , _support_nv_texture_rectangle(false) | ||
135 | 223 | , _support_arb_pixel_buffer_object(false) | ||
136 | 224 | , _support_ext_blend_equation_separate(false) | ||
137 | 225 | , _support_depth_buffer(false) | ||
138 | 226 | #ifndef NUX_OPENGLES_20 | ||
139 | 227 | , _support_ext_texture_srgb(false) | ||
140 | 228 | , _support_ext_texture_srgb_decode(false) | ||
141 | 229 | , _support_ext_framebuffer_srgb(false) | ||
142 | 230 | , _support_arb_framebuffer_srgb(false) | ||
143 | 231 | #endif | ||
144 | 196 | { | 232 | { |
145 | 197 | _support_opengl_version_11 = false; | ||
146 | 198 | _support_opengl_version_12 = false; | ||
147 | 199 | _support_opengl_version_13 = false; | ||
148 | 200 | _support_opengl_version_14 = false; | ||
149 | 201 | _support_opengl_version_15 = false; | ||
150 | 202 | _support_opengl_version_20 = false; | ||
151 | 203 | _support_opengl_version_21 = false; | ||
152 | 204 | _support_opengl_version_30 = false; | ||
153 | 205 | _support_opengl_version_31 = false; | ||
154 | 206 | _support_opengl_version_32 = false; | ||
155 | 207 | _support_opengl_version_33 = false; | ||
156 | 208 | _support_opengl_version_40 = false; | ||
157 | 209 | _support_opengl_version_41 = false; | ||
158 | 210 | } | 233 | } |
159 | 211 | 234 | ||
160 | 212 | void GpuInfo::Setup() | 235 | void GpuInfo::Setup() |
161 | @@ -234,6 +257,7 @@ | |||
162 | 234 | CHECKGL(glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS_ARB, &_opengl_max_texture_image_units)); | 257 | CHECKGL(glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS_ARB, &_opengl_max_texture_image_units)); |
163 | 235 | CHECKGL(glGetIntegerv(GL_MAX_VERTEX_ATTRIBS, &_opengl_max_vertex_attributes)); | 258 | CHECKGL(glGetIntegerv(GL_MAX_VERTEX_ATTRIBS, &_opengl_max_vertex_attributes)); |
164 | 236 | CHECKGL(glGetIntegerv(GL_MAX_COLOR_ATTACHMENTS_EXT, &_opengl_max_fb_attachment)); | 259 | CHECKGL(glGetIntegerv(GL_MAX_COLOR_ATTACHMENTS_EXT, &_opengl_max_fb_attachment)); |
165 | 260 | _support_depth_buffer = true; | ||
166 | 237 | #else | 261 | #else |
167 | 238 | // By opengl es 2.0 standard, GL_MAX_TEXTURE_SIZE should return a minimum of 64. | 262 | // By opengl es 2.0 standard, GL_MAX_TEXTURE_SIZE should return a minimum of 64. |
168 | 239 | CHECKGL(glGetIntegerv(GL_MAX_TEXTURE_SIZE, &_opengl_max_texture_size)); | 263 | CHECKGL(glGetIntegerv(GL_MAX_TEXTURE_SIZE, &_opengl_max_texture_size)); |
169 | @@ -242,6 +266,11 @@ | |||
170 | 242 | CHECKGL(glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS, &_opengl_max_texture_image_units)); | 266 | CHECKGL(glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS, &_opengl_max_texture_image_units)); |
171 | 243 | // GL_MAX_COLOR_ATTACHMENTS_EXT is not supported under opengl es 2.0. | 267 | // GL_MAX_COLOR_ATTACHMENTS_EXT is not supported under opengl es 2.0. |
172 | 244 | _opengl_max_fb_attachment = 1; | 268 | _opengl_max_fb_attachment = 1; |
173 | 269 | |||
174 | 270 | if (glGetString(GL_OES_depth_texture)) | ||
175 | 271 | { | ||
176 | 272 | _support_depth_buffer = true; | ||
177 | 273 | } | ||
178 | 245 | #endif | 274 | #endif |
179 | 246 | 275 | ||
180 | 247 | #if defined(NUX_OS_WINDOWS) | 276 | #if defined(NUX_OS_WINDOWS) |
181 | 248 | 277 | ||
182 | === modified file 'NuxGraphics/GpuDevice.h' | |||
183 | --- NuxGraphics/GpuDevice.h 2012-11-12 20:59:56 +0000 | |||
184 | +++ NuxGraphics/GpuDevice.h 2012-11-28 15:20:28 +0000 | |||
185 | @@ -84,8 +84,8 @@ | |||
186 | 84 | bool SupportOpenGL21() const {return _support_opengl_version_21;} | 84 | bool SupportOpenGL21() const {return _support_opengl_version_21;} |
187 | 85 | bool SupportOpenGL30() const {return _support_opengl_version_30;} | 85 | bool SupportOpenGL30() const {return _support_opengl_version_30;} |
188 | 86 | bool SupportOpenGL31() const {return _support_opengl_version_31;} | 86 | bool SupportOpenGL31() const {return _support_opengl_version_31;} |
189 | 87 | bool SupportOpenGL32() const {return _support_opengl_version_32;} | ||
190 | 87 | bool SupportOpenGL33() const {return _support_opengl_version_33;} | 88 | bool SupportOpenGL33() const {return _support_opengl_version_33;} |
191 | 88 | bool SupportOpenGL32() const {return _support_opengl_version_32;} | ||
192 | 89 | bool SupportOpenGL40() const {return _support_opengl_version_40;} | 89 | bool SupportOpenGL40() const {return _support_opengl_version_40;} |
193 | 90 | bool SupportOpenGL41() const {return _support_opengl_version_41;} | 90 | bool SupportOpenGL41() const {return _support_opengl_version_41;} |
194 | 91 | 91 | ||
195 | @@ -105,6 +105,7 @@ | |||
196 | 105 | bool Support_NV_Texture_Rectangle() const {return _support_nv_texture_rectangle;} | 105 | bool Support_NV_Texture_Rectangle() const {return _support_nv_texture_rectangle;} |
197 | 106 | bool Support_ARB_Pixel_Buffer_Object() const {return _support_arb_pixel_buffer_object;} | 106 | bool Support_ARB_Pixel_Buffer_Object() const {return _support_arb_pixel_buffer_object;} |
198 | 107 | bool Support_EXT_Blend_Equation_Separate() const {return _support_ext_blend_equation_separate;} | 107 | bool Support_EXT_Blend_Equation_Separate() const {return _support_ext_blend_equation_separate;} |
199 | 108 | bool Support_Depth_Buffer() const {return _support_depth_buffer;} | ||
200 | 108 | 109 | ||
201 | 109 | #ifndef NUX_OPENGLES_20 | 110 | #ifndef NUX_OPENGLES_20 |
202 | 110 | bool Support_EXT_Texture_sRGB() const {return _support_ext_texture_srgb;} | 111 | bool Support_EXT_Texture_sRGB() const {return _support_ext_texture_srgb;} |
203 | @@ -157,6 +158,7 @@ | |||
204 | 157 | bool _support_nv_texture_rectangle; | 158 | bool _support_nv_texture_rectangle; |
205 | 158 | bool _support_arb_pixel_buffer_object; | 159 | bool _support_arb_pixel_buffer_object; |
206 | 159 | bool _support_ext_blend_equation_separate; | 160 | bool _support_ext_blend_equation_separate; |
207 | 161 | bool _support_depth_buffer; | ||
208 | 160 | 162 | ||
209 | 161 | #ifndef NUX_OPENGLES_20 | 163 | #ifndef NUX_OPENGLES_20 |
210 | 162 | bool _support_ext_texture_srgb; | 164 | bool _support_ext_texture_srgb; |
211 | 163 | 165 | ||
212 | === modified file 'NuxGraphics/GpuDeviceTexture.cpp' | |||
213 | --- NuxGraphics/GpuDeviceTexture.cpp 2012-11-05 21:31:06 +0000 | |||
214 | +++ NuxGraphics/GpuDeviceTexture.cpp 2012-11-28 15:20:28 +0000 | |||
215 | @@ -36,9 +36,15 @@ | |||
216 | 36 | int Width | 36 | int Width |
217 | 37 | , int Height | 37 | , int Height |
218 | 38 | , int Levels | 38 | , int Levels |
220 | 39 | , BitmapFormat PixelFormat | 39 | , BitmapFormat pixel_format |
221 | 40 | , NUX_FILE_LINE_DECL) | 40 | , NUX_FILE_LINE_DECL) |
222 | 41 | { | 41 | { |
223 | 42 | if ((pixel_format == BITFMT_D24S8) && (!GetGpuInfo().Support_Depth_Buffer())) | ||
224 | 43 | { | ||
225 | 44 | // No support for depth buffers | ||
226 | 45 | return ObjectPtr<IOpenGLTexture2D>(); | ||
227 | 46 | } | ||
228 | 47 | |||
229 | 42 | GpuInfo gpu_info = GetGpuInfo(); | 48 | GpuInfo gpu_info = GetGpuInfo(); |
230 | 43 | int msz = gpu_info.GetMaxTextureSize(); | 49 | int msz = gpu_info.GetMaxTextureSize(); |
231 | 44 | if(Width <= 0 || Height <= 0 || Width > msz || Height > msz) | 50 | if(Width <= 0 || Height <= 0 || Width > msz || Height > msz) |
232 | @@ -63,7 +69,7 @@ | |||
233 | 63 | } | 69 | } |
234 | 64 | 70 | ||
235 | 65 | ObjectPtr<IOpenGLTexture2D> result; | 71 | ObjectPtr<IOpenGLTexture2D> result; |
237 | 66 | result.Adopt(new IOpenGLTexture2D(Width, Height, NumMipLevel, PixelFormat, false, NUX_FILE_LINE_PARAM)); | 72 | result.Adopt(new IOpenGLTexture2D(Width, Height, NumMipLevel, pixel_format, false, NUX_FILE_LINE_PARAM)); |
238 | 67 | return result; | 73 | return result; |
239 | 68 | } | 74 | } |
240 | 69 | 75 | ||
241 | @@ -74,6 +80,12 @@ | |||
242 | 74 | , BitmapFormat pixel_format | 80 | , BitmapFormat pixel_format |
243 | 75 | , NUX_FILE_LINE_DECL) | 81 | , NUX_FILE_LINE_DECL) |
244 | 76 | { | 82 | { |
245 | 83 | if ((pixel_format == BITFMT_D24S8) && (!GetGpuInfo().Support_Depth_Buffer())) | ||
246 | 84 | { | ||
247 | 85 | // No support for depth buffers | ||
248 | 86 | return ObjectPtr<IOpenGLTexture2D>(); | ||
249 | 87 | } | ||
250 | 88 | |||
251 | 77 | GpuInfo gpu_info = GetGpuInfo(); | 89 | GpuInfo gpu_info = GetGpuInfo(); |
252 | 78 | int msz = gpu_info.GetMaxTextureSize(); | 90 | int msz = gpu_info.GetMaxTextureSize(); |
253 | 79 | if(width <= 0 || height <=0 || width > msz || height > msz) | 91 | if(width <= 0 || height <=0 || width > msz || height > msz) |
254 | @@ -90,9 +102,15 @@ | |||
255 | 90 | int Width | 102 | int Width |
256 | 91 | , int Height | 103 | , int Height |
257 | 92 | , int Levels | 104 | , int Levels |
259 | 93 | , BitmapFormat PixelFormat | 105 | , BitmapFormat pixel_format |
260 | 94 | , NUX_FILE_LINE_DECL) | 106 | , NUX_FILE_LINE_DECL) |
261 | 95 | { | 107 | { |
262 | 108 | if ((pixel_format == BITFMT_D24S8) && (!GetGpuInfo().Support_Depth_Buffer())) | ||
263 | 109 | { | ||
264 | 110 | // No support for depth buffers | ||
265 | 111 | return ObjectPtr<IOpenGLRectangleTexture>(); | ||
266 | 112 | } | ||
267 | 113 | |||
268 | 96 | GpuInfo gpu_info = GetGpuInfo(); | 114 | GpuInfo gpu_info = GetGpuInfo(); |
269 | 97 | int msz = gpu_info.GetMaxTextureSize(); | 115 | int msz = gpu_info.GetMaxTextureSize(); |
270 | 98 | if(Width <= 0 || Height <= 0 || Width > msz || Height > msz) | 116 | if(Width <= 0 || Height <= 0 || Width > msz || Height > msz) |
271 | @@ -117,17 +135,23 @@ | |||
272 | 117 | } | 135 | } |
273 | 118 | 136 | ||
274 | 119 | ObjectPtr<IOpenGLRectangleTexture> result; | 137 | ObjectPtr<IOpenGLRectangleTexture> result; |
276 | 120 | result.Adopt(new IOpenGLRectangleTexture(Width, Height, NumMipLevel, PixelFormat, false, NUX_FILE_LINE_PARAM)); | 138 | result.Adopt(new IOpenGLRectangleTexture(Width, Height, NumMipLevel, pixel_format, false, NUX_FILE_LINE_PARAM)); |
277 | 121 | return result; | 139 | return result; |
278 | 122 | } | 140 | } |
279 | 123 | 141 | ||
280 | 124 | ObjectPtr<IOpenGLCubeTexture> GpuDevice::CreateCubeTexture( | 142 | ObjectPtr<IOpenGLCubeTexture> GpuDevice::CreateCubeTexture( |
281 | 125 | int EdgeLength | 143 | int EdgeLength |
282 | 126 | , int Levels | 144 | , int Levels |
284 | 127 | , BitmapFormat PixelFormat | 145 | , BitmapFormat pixel_format |
285 | 128 | , const char * /* __Nux_FileName__ */ | 146 | , const char * /* __Nux_FileName__ */ |
286 | 129 | , int /* __Nux_LineNumber__ */) | 147 | , int /* __Nux_LineNumber__ */) |
287 | 130 | { | 148 | { |
288 | 149 | if ((pixel_format == BITFMT_D24S8) && (!GetGpuInfo().Support_Depth_Buffer())) | ||
289 | 150 | { | ||
290 | 151 | // No support for depth buffers | ||
291 | 152 | return ObjectPtr<IOpenGLCubeTexture>(); | ||
292 | 153 | } | ||
293 | 154 | |||
294 | 131 | unsigned int NumTotalMipLevel = 1 + floorf(Log2(EdgeLength)); | 155 | unsigned int NumTotalMipLevel = 1 + floorf(Log2(EdgeLength)); |
295 | 132 | unsigned int NumMipLevel = 0; | 156 | unsigned int NumMipLevel = 0; |
296 | 133 | 157 | ||
297 | @@ -145,7 +169,7 @@ | |||
298 | 145 | } | 169 | } |
299 | 146 | 170 | ||
300 | 147 | ObjectPtr<IOpenGLCubeTexture> result; | 171 | ObjectPtr<IOpenGLCubeTexture> result; |
302 | 148 | result.Adopt(new IOpenGLCubeTexture(EdgeLength, NumMipLevel, PixelFormat)); | 172 | result.Adopt(new IOpenGLCubeTexture(EdgeLength, NumMipLevel, pixel_format)); |
303 | 149 | return result; | 173 | return result; |
304 | 150 | } | 174 | } |
305 | 151 | 175 | ||
306 | @@ -154,10 +178,16 @@ | |||
307 | 154 | , int Height | 178 | , int Height |
308 | 155 | , int Depth | 179 | , int Depth |
309 | 156 | , int Levels | 180 | , int Levels |
311 | 157 | , BitmapFormat PixelFormat | 181 | , BitmapFormat pixel_format |
312 | 158 | , const char * /* __Nux_FileName__ */ | 182 | , const char * /* __Nux_FileName__ */ |
313 | 159 | , int /* __Nux_LineNumber__ */) | 183 | , int /* __Nux_LineNumber__ */) |
314 | 160 | { | 184 | { |
315 | 185 | if ((pixel_format == BITFMT_D24S8) && (!GetGpuInfo().Support_Depth_Buffer())) | ||
316 | 186 | { | ||
317 | 187 | // No support for depth buffers | ||
318 | 188 | return ObjectPtr<IOpenGLVolumeTexture>(); | ||
319 | 189 | } | ||
320 | 190 | |||
321 | 161 | GpuInfo gpu_info = GetGpuInfo(); | 191 | GpuInfo gpu_info = GetGpuInfo(); |
322 | 162 | int msz = gpu_info.GetMaxTextureSize(); | 192 | int msz = gpu_info.GetMaxTextureSize(); |
323 | 163 | if(Width <= 0 || Height <= 0 || Width > msz || Height > msz) | 193 | if(Width <= 0 || Height <= 0 || Width > msz || Height > msz) |
324 | @@ -182,7 +212,7 @@ | |||
325 | 182 | } | 212 | } |
326 | 183 | 213 | ||
327 | 184 | ObjectPtr<IOpenGLVolumeTexture> result; | 214 | ObjectPtr<IOpenGLVolumeTexture> result; |
329 | 185 | result.Adopt(new IOpenGLVolumeTexture(Width, Height, Depth, NumMipLevel, PixelFormat)); | 215 | result.Adopt(new IOpenGLVolumeTexture(Width, Height, Depth, NumMipLevel, pixel_format)); |
330 | 186 | return result; | 216 | return result; |
331 | 187 | } | 217 | } |
332 | 188 | 218 | ||
333 | @@ -190,8 +220,14 @@ | |||
334 | 190 | int Width | 220 | int Width |
335 | 191 | , int Height | 221 | , int Height |
336 | 192 | , int Depth | 222 | , int Depth |
338 | 193 | , BitmapFormat PixelFormat) | 223 | , BitmapFormat pixel_format) |
339 | 194 | { | 224 | { |
340 | 225 | if ((pixel_format == BITFMT_D24S8) && (!GetGpuInfo().Support_Depth_Buffer())) | ||
341 | 226 | { | ||
342 | 227 | // No support for depth buffers | ||
343 | 228 | return ObjectPtr<IOpenGLAnimatedTexture>(); | ||
344 | 229 | } | ||
345 | 230 | |||
346 | 195 | GpuInfo gpu_info = GetGpuInfo(); | 231 | GpuInfo gpu_info = GetGpuInfo(); |
347 | 196 | int msz = gpu_info.GetMaxTextureSize(); | 232 | int msz = gpu_info.GetMaxTextureSize(); |
348 | 197 | if(Width <= 0 || Height <= 0 || Width > msz || Height > msz) | 233 | if(Width <= 0 || Height <= 0 || Width > msz || Height > msz) |
349 | @@ -200,7 +236,7 @@ | |||
350 | 200 | } | 236 | } |
351 | 201 | 237 | ||
352 | 202 | ObjectPtr<IOpenGLAnimatedTexture> result; | 238 | ObjectPtr<IOpenGLAnimatedTexture> result; |
354 | 203 | result.Adopt(new IOpenGLAnimatedTexture(Width, Height, Depth, PixelFormat)); | 239 | result.Adopt(new IOpenGLAnimatedTexture(Width, Height, Depth, pixel_format)); |
355 | 204 | return result; | 240 | return result; |
356 | 205 | } | 241 | } |
357 | 206 | 242 | ||
358 | 207 | 243 | ||
359 | === modified file 'NuxGraphics/GraphicsEngine.cpp' | |||
360 | --- NuxGraphics/GraphicsEngine.cpp 2012-11-20 22:13:38 +0000 | |||
361 | +++ NuxGraphics/GraphicsEngine.cpp 2012-11-28 15:20:28 +0000 | |||
362 | @@ -195,21 +195,23 @@ | |||
363 | 195 | SetScissor(0, 0, _graphics_display.GetWindowWidth(), _graphics_display.GetWindowHeight()); | 195 | SetScissor(0, 0, _graphics_display.GetWindowWidth(), _graphics_display.GetWindowHeight()); |
364 | 196 | EnableScissoring(true); | 196 | EnableScissoring(true); |
365 | 197 | 197 | ||
366 | 198 | GpuDevice* gpu_device = _graphics_display.GetGpuDevice(); | ||
367 | 199 | const GpuInfo& gpu_info = gpu_device->GetGpuInfo(); | ||
368 | 200 | |||
369 | 198 | if (create_rendering_data) | 201 | if (create_rendering_data) |
370 | 199 | { | 202 | { |
371 | 200 | #ifndef NUX_OPENGLES_20 | 203 | #ifndef NUX_OPENGLES_20 |
372 | 201 | bool opengl_14_support = true; | 204 | bool opengl_14_support = true; |
376 | 202 | 205 | if ((gpu_device->GetOpenGLMajorVersion() == 1) && | |
377 | 203 | if ((_graphics_display.GetGpuDevice()->GetOpenGLMajorVersion() == 1) && | 206 | (gpu_device->GetOpenGLMinorVersion() < 4)) |
375 | 204 | (_graphics_display.GetGpuDevice()->GetOpenGLMinorVersion() < 4)) | ||
378 | 205 | { | 207 | { |
379 | 206 | // OpenGL version is less than OpenGL 1.4 | 208 | // OpenGL version is less than OpenGL 1.4 |
380 | 207 | opengl_14_support = false; | 209 | opengl_14_support = false; |
381 | 208 | } | 210 | } |
386 | 209 | 211 | ||
387 | 210 | if (_graphics_display.GetGpuDevice()->GetGpuInfo().Support_ARB_Fragment_Shader() && | 212 | if (gpu_info.Support_ARB_Fragment_Shader() && |
388 | 211 | _graphics_display.GetGpuDevice()->GetGpuInfo().Support_ARB_Vertex_Program() && | 213 | gpu_info.Support_ARB_Vertex_Program() && |
389 | 212 | opengl_14_support) | 214 | opengl_14_support) |
390 | 213 | { | 215 | { |
391 | 214 | InitAsmColorShader(); | 216 | InitAsmColorShader(); |
392 | 215 | InitAsmTextureShader(); | 217 | InitAsmTextureShader(); |
393 | @@ -229,8 +231,6 @@ | |||
394 | 229 | } | 231 | } |
395 | 230 | #endif | 232 | #endif |
396 | 231 | 233 | ||
397 | 232 | const GpuInfo& gpu_info = _graphics_display.GetGpuDevice()->GetGpuInfo(); | ||
398 | 233 | |||
399 | 234 | if ((gpu_info.Support_ARB_Vertex_Program() && gpu_info.Support_ARB_Fragment_Program()) | 234 | if ((gpu_info.Support_ARB_Vertex_Program() && gpu_info.Support_ARB_Fragment_Program()) |
400 | 235 | || (gpu_info.Support_ARB_Vertex_Shader() && gpu_info.Support_ARB_Fragment_Shader())) | 235 | || (gpu_info.Support_ARB_Vertex_Shader() && gpu_info.Support_ARB_Fragment_Shader())) |
401 | 236 | { | 236 | { |
402 | @@ -238,7 +238,7 @@ | |||
403 | 238 | } | 238 | } |
404 | 239 | 239 | ||
405 | 240 | if (gpu_info.Support_EXT_Framebuffer_Object()) | 240 | if (gpu_info.Support_EXT_Framebuffer_Object()) |
407 | 241 | _offscreen_fbo = _graphics_display.GetGpuDevice()->CreateFrameBufferObject(); | 241 | _offscreen_fbo = gpu_device->CreateFrameBufferObject(); |
408 | 242 | 242 | ||
409 | 243 | _offscreen_color_rt0 = _graphics_display.GetGpuDevice()->CreateTexture(2, 2, 1, BITFMT_R8G8B8A8, NUX_TRACKER_LOCATION); | 243 | _offscreen_color_rt0 = _graphics_display.GetGpuDevice()->CreateTexture(2, 2, 1, BITFMT_R8G8B8A8, NUX_TRACKER_LOCATION); |
410 | 244 | _offscreen_color_rt1 = _graphics_display.GetGpuDevice()->CreateTexture(2, 2, 1, BITFMT_R8G8B8A8, NUX_TRACKER_LOCATION); | 244 | _offscreen_color_rt1 = _graphics_display.GetGpuDevice()->CreateTexture(2, 2, 1, BITFMT_R8G8B8A8, NUX_TRACKER_LOCATION); |
411 | @@ -1312,7 +1312,10 @@ | |||
412 | 1312 | colorbuffer = _graphics_display.GetGpuDevice()->CreateTexture(width, height, 1, BITFMT_R8G8B8A8, NUX_TRACKER_LOCATION); | 1312 | colorbuffer = _graphics_display.GetGpuDevice()->CreateTexture(width, height, 1, BITFMT_R8G8B8A8, NUX_TRACKER_LOCATION); |
413 | 1313 | } | 1313 | } |
414 | 1314 | 1314 | ||
416 | 1315 | if ((depthbuffer.IsValid()) && ((depthbuffer->GetWidth() != width) || (depthbuffer->GetHeight() != height))) | 1315 | bool use_depth_buffer = _graphics_display.GetGpuDevice()->GetGpuInfo().Support_Depth_Buffer(); |
417 | 1316 | if (use_depth_buffer && | ||
418 | 1317 | depthbuffer.IsValid() && | ||
419 | 1318 | ((depthbuffer->GetWidth() != width) || (depthbuffer->GetHeight() != height))) | ||
420 | 1316 | { | 1319 | { |
421 | 1317 | // Generate a new depth texture only if a valid one was passed to this function. | 1320 | // Generate a new depth texture only if a valid one was passed to this function. |
422 | 1318 | depthbuffer = _graphics_display.GetGpuDevice()->CreateTexture(width, height, 1, BITFMT_D24S8, NUX_TRACKER_LOCATION); | 1321 | depthbuffer = _graphics_display.GetGpuDevice()->CreateTexture(width, height, 1, BITFMT_D24S8, NUX_TRACKER_LOCATION); |
423 | @@ -1321,7 +1324,7 @@ | |||
424 | 1321 | fbo->FormatFrameBufferObject(width, height, BITFMT_R8G8B8A8); | 1324 | fbo->FormatFrameBufferObject(width, height, BITFMT_R8G8B8A8); |
425 | 1322 | fbo->SetRenderTarget(0, colorbuffer->GetSurfaceLevel(0)); | 1325 | fbo->SetRenderTarget(0, colorbuffer->GetSurfaceLevel(0)); |
426 | 1323 | 1326 | ||
428 | 1324 | if (depthbuffer.IsValid()) | 1327 | if (use_depth_buffer && depthbuffer.IsValid()) |
429 | 1325 | fbo->SetDepthSurface(depthbuffer->GetSurfaceLevel(0)); | 1328 | fbo->SetDepthSurface(depthbuffer->GetSurfaceLevel(0)); |
430 | 1326 | else | 1329 | else |
431 | 1327 | fbo->SetDepthSurface(ObjectPtr<IOpenGLSurface>(NULL)); | 1330 | fbo->SetDepthSurface(ObjectPtr<IOpenGLSurface>(NULL)); |
432 | 1328 | 1331 | ||
433 | === modified file 'NuxGraphics/IOpenGLFrameBufferObject.cpp' | |||
434 | --- NuxGraphics/IOpenGLFrameBufferObject.cpp 2012-11-17 21:44:54 +0000 | |||
435 | +++ NuxGraphics/IOpenGLFrameBufferObject.cpp 2012-11-28 15:20:28 +0000 | |||
436 | @@ -32,7 +32,8 @@ | |||
437 | 32 | NUX_IMPLEMENT_OBJECT_TYPE(IOpenGLFrameBufferObject); | 32 | NUX_IMPLEMENT_OBJECT_TYPE(IOpenGLFrameBufferObject); |
438 | 33 | 33 | ||
439 | 34 | IOpenGLFrameBufferObject::IOpenGLFrameBufferObject(NUX_FILE_LINE_DECL) | 34 | IOpenGLFrameBufferObject::IOpenGLFrameBufferObject(NUX_FILE_LINE_DECL) |
441 | 35 | : IOpenGLResource(RTFRAMEBUFFEROBJECT, NUX_FILE_LINE_PARAM) | 35 | : IOpenGLResource(RTFRAMEBUFFEROBJECT, NUX_FILE_LINE_PARAM) |
442 | 36 | , platform_support_for_depth_texture_(false) | ||
443 | 36 | { | 37 | { |
444 | 37 | attachment_width_ = 1; | 38 | attachment_width_ = 1; |
445 | 38 | attachment_height_ = 1; | 39 | attachment_height_ = 1; |
446 | @@ -45,6 +46,11 @@ | |||
447 | 45 | surface_attachment_array_.push_back(ObjectPtr<IOpenGLSurface> (0)); | 46 | surface_attachment_array_.push_back(ObjectPtr<IOpenGLSurface> (0)); |
448 | 46 | } | 47 | } |
449 | 47 | 48 | ||
450 | 49 | if (GetGraphicsDisplay()->GetGpuDevice() && GetGraphicsDisplay()->GetGpuDevice()->GetGpuInfo().Support_Depth_Buffer()) | ||
451 | 50 | { | ||
452 | 51 | platform_support_for_depth_texture_ = true; | ||
453 | 52 | } | ||
454 | 53 | |||
455 | 48 | FormatFrameBufferObject(attachment_width_, attachment_height_, _PixelFormat); | 54 | FormatFrameBufferObject(attachment_width_, attachment_height_, _PixelFormat); |
456 | 49 | GRunTimeStats.Register(this); | 55 | GRunTimeStats.Register(this); |
457 | 50 | } | 56 | } |
458 | @@ -174,7 +180,10 @@ | |||
459 | 174 | 180 | ||
460 | 175 | int IOpenGLFrameBufferObject::SetDepthSurface(ObjectPtr<IOpenGLSurface> pDepthSurface) | 181 | int IOpenGLFrameBufferObject::SetDepthSurface(ObjectPtr<IOpenGLSurface> pDepthSurface) |
461 | 176 | { | 182 | { |
463 | 177 | //nuxAssert(pDepthSurface.IsValid()); | 183 | if (!platform_support_for_depth_texture_) |
464 | 184 | { | ||
465 | 185 | return 0; | ||
466 | 186 | } | ||
467 | 178 | 187 | ||
468 | 179 | if (pDepthSurface.IsNull()) | 188 | if (pDepthSurface.IsNull()) |
469 | 180 | { | 189 | { |
470 | @@ -208,6 +217,11 @@ | |||
471 | 208 | 217 | ||
472 | 209 | int IOpenGLFrameBufferObject::SetDepthTextureAttachment(ObjectPtr<IOpenGLBaseTexture> depth_texture, int mip_level) | 218 | int IOpenGLFrameBufferObject::SetDepthTextureAttachment(ObjectPtr<IOpenGLBaseTexture> depth_texture, int mip_level) |
473 | 210 | { | 219 | { |
474 | 220 | if (!platform_support_for_depth_texture_) | ||
475 | 221 | { | ||
476 | 222 | return 0; | ||
477 | 223 | } | ||
478 | 224 | |||
479 | 211 | if (depth_texture.IsNull()) | 225 | if (depth_texture.IsNull()) |
480 | 212 | { | 226 | { |
481 | 213 | depth_surface_attachment_ = ObjectPtr<IOpenGLSurface> (0); | 227 | depth_surface_attachment_ = ObjectPtr<IOpenGLSurface> (0); |
482 | @@ -289,27 +303,26 @@ | |||
483 | 289 | } | 303 | } |
484 | 290 | } | 304 | } |
485 | 291 | 305 | ||
487 | 292 | if (depth_surface_attachment_.IsValid()) | 306 | if (platform_support_for_depth_texture_) |
488 | 293 | { | 307 | { |
493 | 294 | GLenum target = depth_surface_attachment_->GetSurfaceTarget(); | 308 | if (depth_surface_attachment_.IsValid()) |
494 | 295 | GLenum glID = depth_surface_attachment_->GetOpenGLID(); | 309 | { |
495 | 296 | GLint level = depth_surface_attachment_->GetMipLevel(); | 310 | GLenum target = depth_surface_attachment_->GetSurfaceTarget(); |
496 | 297 | CHECKGL(glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, target, glID, level)); | 311 | GLenum glID = depth_surface_attachment_->GetOpenGLID(); |
497 | 312 | GLint level = depth_surface_attachment_->GetMipLevel(); | ||
498 | 313 | CHECKGL(glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, target, glID, level)); | ||
499 | 314 | } | ||
500 | 315 | else | ||
501 | 316 | { | ||
502 | 317 | CHECKGL(glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_TEXTURE_2D, 0, 0)); | ||
503 | 318 | // On the PC you need to bing the same D24S8 surface to the depth and the stencil attachment. | ||
504 | 319 | } | ||
505 | 298 | } | 320 | } |
506 | 299 | else | 321 | else |
507 | 300 | { | 322 | { |
510 | 301 | CHECKGL(glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_TEXTURE_2D, 0, 0)); | 323 | CHECKGL(glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_TEXTURE_2D, 0, 0)); |
509 | 302 | // On the PC you need to bing the same D24S8 surface to the depth and the stencil attachment. | ||
511 | 303 | } | 324 | } |
512 | 304 | 325 | ||
513 | 305 | // #ifndef NUX_OPENGLES_20 | ||
514 | 306 | // _Rbo.Set(GL_DEPTH_COMPONENT, attachment_width_, attachment_height_); | ||
515 | 307 | // CHECKGL(glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, | ||
516 | 308 | // GL_DEPTH_ATTACHMENT_EXT, | ||
517 | 309 | // GL_RENDERBUFFER_EXT, | ||
518 | 310 | // _Rbo.GetId())); | ||
519 | 311 | // #endif | ||
520 | 312 | |||
521 | 313 | nuxAssert( _Fbo.IsValid() == true ); | 326 | nuxAssert( _Fbo.IsValid() == true ); |
522 | 314 | 327 | ||
523 | 315 | if (GetGraphicsDisplay()->GetGraphicsEngine()) | 328 | if (GetGraphicsDisplay()->GetGraphicsEngine()) |
524 | 316 | 329 | ||
525 | === modified file 'NuxGraphics/IOpenGLFrameBufferObject.h' | |||
526 | --- NuxGraphics/IOpenGLFrameBufferObject.h 2012-11-05 21:31:06 +0000 | |||
527 | +++ NuxGraphics/IOpenGLFrameBufferObject.h 2012-11-28 15:20:28 +0000 | |||
528 | @@ -105,6 +105,7 @@ | |||
529 | 105 | 105 | ||
530 | 106 | GLFramebufferObject _Fbo; // The framebuffer object used for rendering to the texture | 106 | GLFramebufferObject _Fbo; // The framebuffer object used for rendering to the texture |
531 | 107 | GLRenderbuffer _Rbo; | 107 | GLRenderbuffer _Rbo; |
532 | 108 | bool platform_support_for_depth_texture_; | ||
533 | 108 | 109 | ||
534 | 109 | friend class GpuDevice; | 110 | friend class GpuDevice; |
535 | 110 | }; | 111 | }; |
Looks ok to me.