OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2009, Google Inc. | 2 * Copyright 2009, Google Inc. |
3 * All rights reserved. | 3 * All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
7 * met: | 7 * met: |
8 * | 8 * |
9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 26 matching lines...) Expand all Loading... |
37 | 37 |
38 #ifdef OS_LINUX | 38 #ifdef OS_LINUX |
39 #include "command_buffer/service/linux/x_utils.h" | 39 #include "command_buffer/service/linux/x_utils.h" |
40 #endif // OS_LINUX | 40 #endif // OS_LINUX |
41 | 41 |
42 namespace o3d { | 42 namespace o3d { |
43 namespace command_buffer { | 43 namespace command_buffer { |
44 namespace o3d { | 44 namespace o3d { |
45 | 45 |
46 GAPIGL::GAPIGL() | 46 GAPIGL::GAPIGL() |
| 47 : cg_context_(NULL), |
47 #ifdef OS_LINUX | 48 #ifdef OS_LINUX |
48 : window_(NULL), | 49 window_(NULL), |
49 #endif | 50 #endif |
50 : anti_aliased_(false), | 51 #ifdef OS_WIN |
51 cg_context_(NULL), | 52 hwnd_(NULL), |
| 53 device_context_(NULL), |
| 54 gl_context_(NULL), |
| 55 #endif |
| 56 anti_aliased_(false), |
52 current_vertex_struct_(kInvalidResource), | 57 current_vertex_struct_(kInvalidResource), |
53 validate_streams_(true), | 58 validate_streams_(true), |
54 max_vertices_(0), | 59 max_vertices_(0), |
55 current_effect_id_(kInvalidResource), | 60 current_effect_id_(kInvalidResource), |
56 validate_effect_(true), | 61 validate_effect_(true), |
57 current_effect_(NULL) { | 62 current_effect_(NULL) { |
58 } | 63 } |
59 | 64 |
60 GAPIGL::~GAPIGL() { | 65 GAPIGL::~GAPIGL() { |
61 } | 66 } |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 } | 326 } |
322 | 327 |
323 // Check to see that we can use the OpenGL vertex attribute APIs | 328 // Check to see that we can use the OpenGL vertex attribute APIs |
324 // TODO(petersont): Return false if this check fails, but because some | 329 // TODO(petersont): Return false if this check fails, but because some |
325 // Intel hardware does not support OpenGL 2.0, yet does support all of the | 330 // Intel hardware does not support OpenGL 2.0, yet does support all of the |
326 // extensions we require, we only log an error. A future CL should change | 331 // extensions we require, we only log an error. A future CL should change |
327 // this check to ensure that all of the extension strings we require are | 332 // this check to ensure that all of the extension strings we require are |
328 // present. | 333 // present. |
329 if (!GLEW_VERSION_2_0) { | 334 if (!GLEW_VERSION_2_0) { |
330 DLOG(ERROR) << "GL drivers do not have OpenGL 2.0 functionality."; | 335 DLOG(ERROR) << "GL drivers do not have OpenGL 2.0 functionality."; |
331 return false; | |
332 } | 336 } |
333 | 337 |
334 bool extensions_found = true; | 338 bool extensions_found = true; |
335 if (!GLEW_ARB_vertex_buffer_object) { | 339 if (!GLEW_ARB_vertex_buffer_object) { |
336 // NOTE: Linux NVidia drivers claim to support OpenGL 2.0 when using | 340 // NOTE: Linux NVidia drivers claim to support OpenGL 2.0 when using |
337 // indirect rendering (e.g. remote X), but it is actually lying. The | 341 // indirect rendering (e.g. remote X), but it is actually lying. The |
338 // ARB_vertex_buffer_object functions silently no-op (!) when using | 342 // ARB_vertex_buffer_object functions silently no-op (!) when using |
339 // indirect rendering, leading to crashes. Fortunately, in that case, the | 343 // indirect rendering, leading to crashes. Fortunately, in that case, the |
340 // driver claims to not support ARB_vertex_buffer_object, so fail in that | 344 // driver claims to not support ARB_vertex_buffer_object, so fail in that |
341 // case. | 345 // case. |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
406 glClearStencil(stencil); | 410 glClearStencil(stencil); |
407 glClear((buffers & kColor ? GL_COLOR_BUFFER_BIT : 0) | | 411 glClear((buffers & kColor ? GL_COLOR_BUFFER_BIT : 0) | |
408 (buffers & kDepth ? GL_DEPTH_BUFFER_BIT : 0) | | 412 (buffers & kDepth ? GL_DEPTH_BUFFER_BIT : 0) | |
409 (buffers & kStencil ? GL_STENCIL_BUFFER_BIT : 0)); | 413 (buffers & kStencil ? GL_STENCIL_BUFFER_BIT : 0)); |
410 CHECK_GL_ERROR(); | 414 CHECK_GL_ERROR(); |
411 } | 415 } |
412 | 416 |
413 } // namespace o3d | 417 } // namespace o3d |
414 } // namespace command_buffer | 418 } // namespace command_buffer |
415 } // namespace o3d | 419 } // namespace o3d |
OLD | NEW |