59 #include <ACG/GL/acg_glew.hh> 86 bool GLState::depthFuncLock_ =
false;
87 bool GLState::depthRangeLock_ =
false;
88 bool GLState::blendFuncSeparateLock_[2] = {
false };
89 bool GLState::blendEquationLock_ =
false;
90 bool GLState::blendColorLock_ =
false;
91 bool GLState::alphaFuncLock_ =
false;
92 bool GLState::shadeModelLock_ =
false;
93 bool GLState::cullFaceLock_ =
false;
94 bool GLState::vertexPointerLock_ =
false;
95 bool GLState::normalPointerLock_ =
false;
96 bool GLState::texcoordPointerLock_ =
false;
97 bool GLState::colorPointerLock_ =
false;
98 bool GLState::drawBufferLock_ =
false;
99 bool GLState::programLock_ =
false;
101 std::deque <GLStateContext> GLState::stateStack_;
102 std::bitset<0xFFFF+1> GLState::glStateLock_;
103 int GLState::glBufferTargetLock_[4] = {0};
104 int GLState::glTextureStageLock_[16] = {0};
105 bool GLState::framebufferLock_[2] = {
false};
106 int GLState::maxTextureCoords_ = 0;
107 int GLState::maxCombinedTextureImageUnits_ = 0;
108 int GLState::maxDrawBuffers_ = 0;
110 int GLState::num_texture_units_ = 0;
112 GLStateContext::GLStateContext() :
113 activeTexture_(GL_TEXTURE0),
114 drawBufferSingle_(GL_BACK),
115 activeDrawBuffer_(0),
118 framebuffers_[0] = framebuffers_[1] = 0;
119 memset(drawBufferState_, GL_BACK,
sizeof(drawBufferState_));
123 : compatibilityProfile_(_compatibilityProfile),
125 max_render_passes_(1),
136 multisampling_(false),
137 allow_multisampling_(true),
139 updateGL_(_updateGL),
141 msSinceLastRedraw_ (1),
145 if ( stateStack_.empty() )
149 memset(glBufferTargetLock_, 0,
sizeof(glBufferTargetLock_));
151 framebufferLock_[0] = framebufferLock_[1] =
false;
153 glStateLock_.reset();
165 while (!stack_projection_.empty())
166 stack_projection_.pop();
167 while (!stack_modelview_.empty())
168 stack_modelview_.pop();
169 while (!stack_inverse_projection_.empty())
170 stack_inverse_projection_.pop();
171 while (!stack_inverse_modelview_.empty())
172 stack_inverse_modelview_.pop();
199 glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS_ARB, &value);
201 num_texture_units_ = value;
213 if (compatibilityProfile_ ) {
216 glMatrixMode(GL_PROJECTION);
218 glMatrixMode(GL_MODELVIEW);
226 glClearColor(clear_color_[0], clear_color_[1], clear_color_[2], clear_color_[3]);
228 if (compatibilityProfile_ ) {
230 glMaterialfv(GL_FRONT_AND_BACK, GL_EMISSION, base_color_.
data());
233 glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT , ambient_color_.
data());
236 glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE , diffuse_color_.
data());
239 glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, specular_color_.
data());
242 glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, shininess_);
246 glPointSize(point_size_);
249 glLineWidth(line_width_);
251 if ( compatibilityProfile_ ) {
253 if (twosided_lighting_ )
254 glLightModeli( GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE );
256 glLightModeli( GL_LIGHT_MODEL_TWO_SIDE, GL_FALSE );
260 glViewport(left_, bottom_, width_, height_);
269 if ( compatibilityProfile_ ) {
270 glPushAttrib (GL_ALL_ATTRIB_BITS);
275 glShadeModel( GL_FLAT );
277 if ( compatibilityProfile_ ) {
279 glMatrixMode(GL_PROJECTION);
283 glMatrixMode(GL_MODELVIEW);
290 GLboolean scissor = glIsEnabled(GL_SCISSOR_TEST);
293 glGetIntegerv(GL_SCISSOR_BOX,&origBox[0]);
300 glScissor( left_,bottom_,width_,height_ );
303 glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
306 glScissor( origBox[0], origBox[1], origBox[2], origBox[3] );
311 if ( compatibilityProfile_ ) {
313 glMatrixMode(GL_PROJECTION);
315 glMatrixMode(GL_MODELVIEW);
322 void GLState::setCompatibilityProfile(
bool _compatibility ) {
323 compatibilityProfile_ = _compatibility;
326 bool GLState::compatibilityProfile()
const {
327 return compatibilityProfile_;
337 if (updateGL_ && compatibilityProfile_ )
340 glMatrixMode(GL_PROJECTION);
342 glMatrixMode(GL_MODELVIEW);
353 inverse_projection_ = _inv_m;
355 if (updateGL_ && compatibilityProfile_)
358 glMatrixMode(GL_PROJECTION);
360 glMatrixMode(GL_MODELVIEW);
373 if (updateGL_ && compatibilityProfile_ )
387 inverse_modelview_ = _inv_m;
389 if (updateGL_ && compatibilityProfile_)
401 double _bottom,
double _top,
402 double _n,
double _f )
407 projection_.
ortho(_left, _right, _bottom, _top, _n, _f);
408 inverse_projection_.
inverse_ortho(_left,_right,_bottom,_top,_n,_f);
410 if (updateGL_ && compatibilityProfile_ )
413 glMatrixMode(GL_PROJECTION);
414 glOrtho(_left, _right, _bottom, _top, _n, _f);
415 glMatrixMode(GL_MODELVIEW);
424 double _bottom,
double _top,
425 double _n,
double _f )
430 projection_.
frustum(_left, _right, _bottom, _top, _n, _f);
433 if (updateGL_ && compatibilityProfile_)
436 glMatrixMode(GL_PROJECTION);
437 glFrustum(_left, _right, _bottom, _top, _n, _f);
438 glMatrixMode(GL_MODELVIEW);
447 double _n,
double _f )
455 if (updateGL_ && compatibilityProfile_)
458 glMatrixMode(GL_PROJECTION);
459 glLoadMatrixd(projection_.data());
460 glMatrixMode(GL_MODELVIEW);
469 int _width,
int _height,
470 int _glwidth,
int _glheight)
477 if (_glwidth < _width || _glheight < _height)
483 glheight_ = _glheight;
487 window2viewport_(0,0) = 0.5f * width_;
488 window2viewport_(0,3) = 0.5f * width_ + left_;
489 window2viewport_(1,1) = 0.5f * height_;
490 window2viewport_(1,3) = 0.5f * height_ + bottom_;
491 window2viewport_(2,2) = 0.5f;
492 window2viewport_(2,3) = 0.5f;
494 inverse_window2viewport_.
identity();
495 inverse_window2viewport_(0,0) = 2.0f / width_;
496 inverse_window2viewport_(0,3) = -(2.0*left_ + width_) / width_;
497 inverse_window2viewport_(1,1) = 2.0f / height_;
498 inverse_window2viewport_(1,3) = -(2.0*bottom_ + height_) / height_;
499 inverse_window2viewport_(2,2) = 2.0f;
500 inverse_window2viewport_(2,3) = -1.0f;
505 glViewport(_left, _bottom, _width, _height);
514 const Vec3d& _center,
517 modelview_.
lookAt(_eye, _center, _up);
520 if (updateGL_ && compatibilityProfile_)
523 glLoadMatrixd(modelview_.data());
534 if (_mult_from == MULT_FROM_RIGHT)
537 inverse_modelview_.
translate(-_x, -_y, -_z, MULT_FROM_LEFT);
541 modelview_.
translate(_x, _y, _z, MULT_FROM_LEFT);
542 inverse_modelview_.
translate(-_x, -_y, -_z);
545 if (updateGL_ && compatibilityProfile_)
556 translate( _vector[0] , _vector[1] , _vector[2] ,_mult_from);
565 if (_mult_from == MULT_FROM_RIGHT)
567 modelview_.
rotate(_angle, _x, _y, _z);
568 inverse_modelview_.
rotate(-_angle, _x, _y, _z, MULT_FROM_LEFT);
572 modelview_.
rotate(_angle, _x, _y, _z, MULT_FROM_LEFT);
573 inverse_modelview_.
rotate(-_angle, _x, _y, _z);
576 if (updateGL_ && compatibilityProfile_)
590 if (_mult_from == MULT_FROM_RIGHT)
592 modelview_.
scale(_sx, _sy, _sz, MULT_FROM_RIGHT);
593 inverse_modelview_.
scale(1.0f/_sx, 1.0f/_sy, 1.0f/_sz, MULT_FROM_LEFT);
597 modelview_.
scale(_sx, _sy, _sz, MULT_FROM_LEFT);
598 inverse_modelview_.
scale(1.0f/_sx, 1.0f/_sy, 1.0f/_sz, MULT_FROM_RIGHT);
601 if (updateGL_ && compatibilityProfile_)
615 if (_mult_from == MULT_FROM_RIGHT)
618 inverse_modelview_.leftMult(_inv_m);
622 modelview_.leftMult(_m);
623 inverse_modelview_ *= _inv_m;
626 if (updateGL_ && compatibilityProfile_)
667 glClearColor(_col[0], _col[1], _col[2], _col[3]);
679 if (updateGL_ && compatibilityProfile_ )
682 glMaterialfv(GL_FRONT_AND_BACK, GL_EMISSION, _col.
data());
707 ambient_color_ = _col;
709 if (updateGL_ && compatibilityProfile_)
712 glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, _col.
data());
722 diffuse_color_ = _col;
724 if (updateGL_ && compatibilityProfile_)
727 glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, _col.
data());
737 specular_color_ = _col;
739 if (updateGL_ && compatibilityProfile_)
742 glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, _col.
data());
752 overlay_color_ = _col;
761 shininess_ = _shininess;
763 if (updateGL_ && compatibilityProfile_)
766 glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, _shininess);
781 glPointSize(point_size_);
796 glLineWidth(line_width_);
820 twosided_lighting_ = _b;
822 if (updateGL_ && compatibilityProfile_ )
825 if (twosided_lighting_)
826 glLightModeli( GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE );
828 glLightModeli( GL_LIGHT_MODEL_TWO_SIDE, GL_FALSE );
843 if ( allow_multisampling_ ) {
852 multisampling_ =
false;
854 if ( glIsEnabled( GL_MULTISAMPLE ) )
866 assert(projection_(1,1) != 0.0);
868 return atan(1.0/projection_(1,1))*2.0;
875 assert(projection_(0,0) != 0.0);
877 return projection_(1,1) / projection_(0,0);
939 return stateStack_.back().depthFunc_;
955 #ifdef GLSTATE_AVOID_REDUNDANT_GLCALLS 956 if (stateStack_.back().depthFunc_ != _depthFunc)
959 glDepthFunc(_depthFunc);
960 stateStack_.back().depthFunc_ = _depthFunc;
969 stack_projection_.push(projection_);
970 stack_inverse_projection_.push(inverse_projection_);
972 if (updateGL_ && compatibilityProfile_)
975 glMatrixMode(GL_PROJECTION);
977 glMatrixMode(GL_MODELVIEW);
987 projection_ = stack_projection_.top();
988 inverse_projection_ = stack_inverse_projection_.top();
990 stack_projection_.pop();
991 stack_inverse_projection_.pop();
993 if (updateGL_ && compatibilityProfile_)
996 glMatrixMode(GL_PROJECTION);
998 glMatrixMode(GL_MODELVIEW);
1008 stack_modelview_.push(modelview_);
1009 stack_inverse_modelview_.push(inverse_modelview_);
1011 if (updateGL_ && compatibilityProfile_)
1024 modelview_ = stack_modelview_.top();
1025 inverse_modelview_ = stack_inverse_modelview_.top();
1027 stack_modelview_.pop();
1028 stack_inverse_modelview_.pop();
1030 if (updateGL_ && compatibilityProfile_)
1041 colorPicking_ = _color;
1068 return Vec4uc (0, 0, 0, 0);
1091 return std::vector<unsigned int> ();
1108 return colorStack_.
error ();
1126 return colorPicking_;
1131 GLenum GLState::glStateCaps[95] = {GL_ALPHA_TEST,
1168 GL_MAP1_TEXTURE_COORD_1,
1169 GL_MAP1_TEXTURE_COORD_2,
1170 GL_MAP1_TEXTURE_COORD_3,
1171 GL_MAP1_TEXTURE_COORD_4,
1177 GL_MAP2_TEXTURE_COORD_1,
1178 GL_MAP2_TEXTURE_COORD_2,
1179 GL_MAP2_TEXTURE_COORD_3,
1180 GL_MAP2_TEXTURE_COORD_4,
1189 GL_POLYGON_OFFSET_FILL,
1191 GL_POLYGON_OFFSET_LINE,
1193 GL_POLYGON_OFFSET_POINT,
1197 GL_POST_COLOR_MATRIX_COLOR_TABLE,
1198 GL_POST_CONVOLUTION_COLOR_TABLE,
1201 GL_SAMPLE_ALPHA_TO_COVERAGE,
1202 GL_SAMPLE_ALPHA_TO_ONE,
1204 GL_SAMPLE_COVERAGE_INVERT,
1211 GL_TEXTURE_CUBE_MAP,
1216 GL_VERTEX_PROGRAM_POINT_SIZE,
1217 GL_VERTEX_PROGRAM_TWO_SIDE,
1223 GL_SECONDARY_COLOR_ARRAY,
1224 GL_TEXTURE_COORD_ARRAY,
1230 GLenum caps[] = {GL_ALPHA_TEST,
1267 GL_MAP1_TEXTURE_COORD_1,
1268 GL_MAP1_TEXTURE_COORD_2,
1269 GL_MAP1_TEXTURE_COORD_3,
1270 GL_MAP1_TEXTURE_COORD_4,
1276 GL_MAP2_TEXTURE_COORD_1,
1277 GL_MAP2_TEXTURE_COORD_2,
1278 GL_MAP2_TEXTURE_COORD_3,
1279 GL_MAP2_TEXTURE_COORD_4,
1288 GL_POLYGON_OFFSET_FILL,
1289 GL_POLYGON_OFFSET_LINE,
1290 GL_POLYGON_OFFSET_POINT,
1293 GL_POST_COLOR_MATRIX_COLOR_TABLE,
1294 GL_POST_CONVOLUTION_COLOR_TABLE,
1297 GL_SAMPLE_ALPHA_TO_COVERAGE,
1298 GL_SAMPLE_ALPHA_TO_ONE,
1306 GL_TEXTURE_CUBE_MAP,
1311 GL_VERTEX_PROGRAM_POINT_SIZE,
1312 GL_VERTEX_PROGRAM_TWO_SIDE,
1318 GL_SECONDARY_COLOR_ARRAY,
1319 GL_TEXTURE_COORD_ARRAY,
1322 for (
unsigned int i = 0; i <
sizeof(caps) /
sizeof(GLenum); ++i)
1324 if (glIsEnabled(caps[i])) stateStack_.back().glStateEnabled_.set(caps[i]);
1325 else stateStack_.back().glStateEnabled_.reset(caps[i]);
1330 #ifdef GL_VERSION_1_4 1331 glGetIntegerv(GL_BLEND_SRC_RGB, &getparam);
1332 stateStack_.back().blendFuncState_[0] = getparam;
1334 glGetIntegerv(GL_BLEND_DST_ALPHA, &getparam);
1335 stateStack_.back().blendFuncState_[1] = getparam;
1337 glGetIntegerv(GL_BLEND_SRC_ALPHA, &getparam);
1338 stateStack_.back().blendFuncState_[2] = getparam;
1340 glGetIntegerv(GL_BLEND_DST_ALPHA, &getparam);
1341 stateStack_.back().blendFuncState_[3] = getparam;
1343 glGetIntegerv(GL_BLEND_SRC, &getparam);
1344 stateStack_.back().blendFuncState_[0] = getparam;
1346 glGetIntegerv(GL_BLEND_DST, &getparam);
1347 stateStack_.back().blendFuncState_[1] = getparam;
1351 glGetIntegerv(GL_BLEND_EQUATION_RGB, &getparam);
1352 stateStack_.back().blendEquationState_ = getparam;
1354 glGetFloatv(GL_BLEND_COLOR, stateStack_.back().blendColorState_);
1356 glGetIntegerv(GL_ALPHA_TEST_FUNC, &getparam);
1357 stateStack_.back().alphaFuncState_ = getparam;
1359 glGetFloatv(GL_ALPHA_TEST_REF, &stateStack_.back().alphaRefState_);
1361 glGetIntegerv(GL_DEPTH_FUNC, &getparam);
1362 stateStack_.back().depthFunc_ = getparam;
1364 glGetDoublev(GL_DEPTH_RANGE, stateStack_.back().depthRange_);
1368 GLenum bufGets[8] = {
1369 GL_ARRAY_BUFFER_BINDING, GL_ARRAY_BUFFER,
1370 GL_ELEMENT_ARRAY_BUFFER_BINDING, GL_ELEMENT_ARRAY_BUFFER,
1371 GL_PIXEL_PACK_BUFFER_BINDING, GL_PIXEL_PACK_BUFFER,
1372 GL_PIXEL_UNPACK_BUFFER_BINDING, GL_PIXEL_UNPACK_BUFFER};
1374 for (
int i = 0; i < 4; ++i)
1375 glGetIntegerv(bufGets[i*2], (GLint*)stateStack_.back().glBufferTargetState_ +
getBufferTargetIndex(bufGets[i*2+1]));
1379 glGetIntegerv(GL_ACTIVE_TEXTURE, &getparam);
1380 stateStack_.back().activeTexture_ = getparam;
1382 GLenum texBufGets[] = {
1383 GL_TEXTURE_BINDING_1D, GL_TEXTURE_1D,
1384 GL_TEXTURE_BINDING_2D, GL_TEXTURE_2D,
1385 GL_TEXTURE_BINDING_3D, GL_TEXTURE_3D,
1386 GL_TEXTURE_BINDING_CUBE_MAP, GL_TEXTURE_CUBE_MAP
1387 , GL_TEXTURE_BINDING_RECTANGLE_ARB, GL_TEXTURE_RECTANGLE_ARB
1390 glGetIntegerv(GL_MAX_TEXTURE_COORDS, &maxTextureCoords_);
1391 glGetIntegerv(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, &maxCombinedTextureImageUnits_);
1394 if (maxTextureCoords_ > 16) maxTextureCoords_ = 16;
1395 if (maxCombinedTextureImageUnits_ > 16) maxCombinedTextureImageUnits_ = 16;
1397 int numTexUnits = maxTextureCoords_;
1398 if (numTexUnits < maxCombinedTextureImageUnits_) numTexUnits = maxCombinedTextureImageUnits_;
1400 for (
int i = 0; i < numTexUnits; ++i)
1402 glActiveTexture(GL_TEXTURE0 + i);
1406 for (
int k = 0; k < 5 && !getparam; ++k)
1408 glGetIntegerv(texBufGets[k*2], &getparam);
1411 stateStack_.back().glTextureStage_[i].buf_ = getparam;
1412 stateStack_.back().glTextureStage_[i].target_ = texBufGets[k*2+1];
1418 if (numTexUnits > 0)
1419 glActiveTexture(stateStack_.back().activeTexture_);
1423 glGetIntegerv(GL_SHADE_MODEL, &getparam);
1424 stateStack_.back().shadeModel_ = getparam;
1427 glGetIntegerv(GL_CULL_FACE_MODE, &getparam);
1428 stateStack_.back().cullFace_ = getparam;
1433 GLenum ptrEnums[] = {
1434 GL_VERTEX_ARRAY_SIZE, GL_VERTEX_ARRAY_TYPE,
1435 GL_VERTEX_ARRAY_STRIDE, GL_VERTEX_ARRAY_POINTER,
1436 GL_COLOR_ARRAY_SIZE, GL_COLOR_ARRAY_TYPE,
1437 GL_COLOR_ARRAY_STRIDE, GL_COLOR_ARRAY_POINTER,
1438 GL_TEXTURE_COORD_ARRAY_SIZE, GL_TEXTURE_COORD_ARRAY_TYPE,
1439 GL_TEXTURE_COORD_ARRAY_STRIDE, GL_TEXTURE_COORD_ARRAY_POINTER};
1442 &stateStack_.back().colorPointer_, &stateStack_.back().texcoordPointer_};
1444 for (
int i = 0; i < 3 ; ++i)
1446 glGetIntegerv(ptrEnums[i*4], &getparam);
1447 ptrs[i]->size = getparam;
1448 glGetIntegerv(ptrEnums[i*4+1], &getparam);
1449 ptrs[i]->type = getparam;
1450 glGetIntegerv(ptrEnums[i*4+2], &getparam);
1451 ptrs[i]->stride = getparam;
1452 glGetPointerv(ptrEnums[i*4+3], (GLvoid**)&ptrs[i]->pointer);
1455 glGetIntegerv(GL_NORMAL_ARRAY_STRIDE, &getparam);
1456 stateStack_.back().normalPointer_.size = getparam;
1457 glGetIntegerv(GL_NORMAL_ARRAY_TYPE, &getparam);
1458 stateStack_.back().normalPointer_.type = getparam;
1459 glGetPointerv(GL_NORMAL_ARRAY_POINTER, (GLvoid**)&stateStack_.back().normalPointer_.pointer);
1464 glGetIntegerv(GL_MAX_DRAW_BUFFERS, &maxDrawBuffers_);
1465 if (maxDrawBuffers_ > 16) maxDrawBuffers_ = 16;
1467 for (
int i = 0; i < maxDrawBuffers_; ++i)
1469 glGetIntegerv(GL_DRAW_BUFFER0 + i, &getparam);
1470 stateStack_.back().drawBufferState_[i] = getparam;
1473 glGetIntegerv(GL_DRAW_BUFFER, &getparam);
1474 stateStack_.back().drawBufferSingle_ = getparam;
1477 glGetIntegerv(GL_DRAW_FRAMEBUFFER_BINDING, &getparam);
1478 stateStack_.back().framebuffers_[0] = getparam;
1479 glGetIntegerv(GL_READ_FRAMEBUFFER_BINDING, &getparam);
1480 stateStack_.back().framebuffers_[1] = getparam;
1483 glGetIntegerv(GL_CURRENT_PROGRAM, &getparam);
1484 stateStack_.back().program_ = getparam;
1492 if (!glStateLock_.test(_cap))
1494 #ifdef GLSTATE_AVOID_REDUNDANT_GLCALLS 1495 if (!stateStack_.back().glStateEnabled_.test(_cap))
1499 stateStack_.back().glStateEnabled_.set(_cap);
1506 if (!glStateLock_.test(_cap))
1508 #ifdef GLSTATE_AVOID_REDUNDANT_GLCALLS 1509 if (stateStack_.back().glStateEnabled_.test(_cap))
1513 stateStack_.back().glStateEnabled_.reset(_cap);
1520 glStateLock_.set(_cap);
1525 glStateLock_.reset(_cap);
1530 return glStateLock_.test(_cap);
1535 return stateStack_.back().glStateEnabled_.test(_cap);
1543 if (!glStateLock_.test(_cap))
1545 #ifdef GLSTATE_AVOID_REDUNDANT_GLCALLS 1546 if (!stateStack_.back().glStateEnabled_.test(_cap))
1549 glEnableClientState(_cap);
1550 stateStack_.back().glStateEnabled_.set(_cap);
1557 if (!glStateLock_.test(_cap))
1559 #ifdef GLSTATE_AVOID_REDUNDANT_GLCALLS 1560 if (stateStack_.back().glStateEnabled_.test(_cap))
1563 glDisableClientState(_cap);
1564 stateStack_.back().glStateEnabled_.reset(_cap);
1571 glStateLock_.set(_cap);
1576 glStateLock_.reset(_cap);
1581 return glStateLock_.test(_cap);
1586 return stateStack_.back().glStateEnabled_.test(_cap);
1595 if (blendFuncSeparateLock_[0])
1597 _srcRGB = stateStack_.back().blendFuncState_[0];
1598 _dstRGB = stateStack_.back().blendFuncState_[1];
1601 if (blendFuncSeparateLock_[1])
1603 _srcAlpha = stateStack_.back().blendFuncState_[2];
1604 _dstAlpha = stateStack_.back().blendFuncState_[3];
1607 if (!blendFuncSeparateLock_[0] || !blendFuncSeparateLock_[1])
1609 #ifdef GLSTATE_AVOID_REDUNDANT_GLCALLS 1610 if (stateStack_.back().blendFuncState_[0] != _srcRGB || stateStack_.back().blendFuncState_[1] != _dstRGB ||
1611 stateStack_.back().blendFuncState_[2] != _srcAlpha || stateStack_.back().blendFuncState_[3] != _dstAlpha)
1614 #ifdef GL_VERSION_1_4 1616 if (glBlendFuncSeparate)
1617 glBlendFuncSeparate(_srcRGB, _dstRGB, _srcAlpha, _dstAlpha);
1619 glBlendFunc(_srcRGB, _dstRGB);
1620 stateStack_.back().blendFuncState_[0] = _srcRGB;
1621 stateStack_.back().blendFuncState_[1] = _dstRGB;
1622 stateStack_.back().blendFuncState_[2] = _srcAlpha;
1623 stateStack_.back().blendFuncState_[3] = _dstAlpha;
1625 glBlendFunc(_srcRGB, _dstRGB);
1626 stateStack_.back().blendFuncState_[0] = _srcRGB;
1627 stateStack_.back().blendFuncState_[1] = _dstRGB;
1628 stateStack_.back().blendFuncState_[2] = _srcRGB;
1629 stateStack_.back().blendFuncState_[3] = _dstRGB;
1637 if (_srcRGB) *_srcRGB = stateStack_.back().blendFuncState_[0];
1638 if (_dstRGB) *_dstRGB = stateStack_.back().blendFuncState_[1];
1639 if (_srcAlpha) *_srcAlpha = stateStack_.back().blendFuncState_[2];
1640 if (_dstAlpha) *_dstAlpha = stateStack_.back().blendFuncState_[3];
1645 if (!blendEquationLock_)
1647 #ifdef GLSTATE_AVOID_REDUNDANT_GLCALLS 1648 if (stateStack_.back().blendEquationState_ != _mode)
1651 glBlendEquation(_mode);
1652 stateStack_.back().blendEquationState_ = _mode;
1659 if (!blendColorLock_)
1661 #ifdef GLSTATE_AVOID_REDUNDANT_GLCALLS 1662 if (stateStack_.back().blendColorState_[0] != _red || stateStack_.back().blendColorState_[1] != _green ||
1663 stateStack_.back().blendColorState_[2] != _blue || stateStack_.back().blendColorState_[3] != _alpha)
1666 glBlendColor(_red, _green, _blue, _alpha);
1667 stateStack_.back().blendColorState_[0] = _red; stateStack_.back().blendColorState_[1] = _green;
1668 stateStack_.back().blendColorState_[2] = _blue; stateStack_.back().blendColorState_[3] = _alpha;
1675 for (
int i = 0; i < 4; ++i) _col[i] = stateStack_.back().blendColorState_[i];
1681 if (!alphaFuncLock_)
1683 #ifdef GLSTATE_AVOID_REDUNDANT_GLCALLS 1684 if (stateStack_.back().alphaFuncState_ != _func || stateStack_.back().alphaRefState_ != _ref)
1687 glAlphaFunc(_func, _ref);
1688 stateStack_.back().alphaFuncState_ = _func;
1689 stateStack_.back().alphaRefState_ = _ref;
1696 if (_func) *_func = stateStack_.back().alphaFuncState_;
1697 if (_ref) *_ref = stateStack_.back().alphaRefState_;
1702 if (!shadeModelLock_)
1704 #ifdef GLSTATE_AVOID_REDUNDANT_GLCALLS 1705 if (stateStack_.back().shadeModel_ != _mode)
1708 glShadeModel(_mode);
1709 stateStack_.back().shadeModel_ = _mode;
1718 #ifdef GLSTATE_AVOID_REDUNDANT_GLCALLS 1719 if (stateStack_.back().cullFace_ != _mode)
1723 stateStack_.back().cullFace_ = _mode;
1730 if (!depthRangeLock_)
1732 #ifdef GLSTATE_AVOID_REDUNDANT_GLCALLS 1733 if (abs(_zNear - stateStack_.back().depthRange_[0]) > 1e-6 ||
1734 abs(_zFar - stateStack_.back().depthRange_[1]) > 1e-6)
1737 glDepthRange(_zNear, _zFar);
1738 stateStack_.back().depthRange_[0] = _zNear;
1739 stateStack_.back().depthRange_[1] = _zFar;
1746 if (_zNearOut) *_zNearOut = stateStack_.back().depthRange_[0];
1747 if (_zFarOut) *_zFarOut = stateStack_.back().depthRange_[1];
1756 case GL_ARRAY_BUFFER:
return 0;
1757 case GL_ELEMENT_ARRAY_BUFFER:
return 1;
1758 case GL_PIXEL_PACK_BUFFER:
return 2;
1759 case GL_PIXEL_UNPACK_BUFFER:
return 3;
1767 if (idx >= 0 && !glBufferTargetLock_[idx])
1769 #ifdef GLSTATE_AVOID_REDUNDANT_GLCALLS 1770 if (stateStack_.back().glBufferTargetState_[idx] != _buffer)
1773 glBindBufferARB(_target, _buffer);
1774 stateStack_.back().glBufferTargetState_[idx] = _buffer;
1803 #ifdef GLSTATE_AVOID_REDUNDANT_GLCALLS 1804 if (stateStack_.back().activeTexture_ != _texunit)
1807 glActiveTexture(_texunit);
1808 stateStack_.back().activeTexture_ = _texunit;
1816 assert(activeTex >= 0);
1820 if (!glTextureStageLock_[activeTex])
1822 #ifdef GLSTATE_AVOID_REDUNDANT_GLCALLS 1823 if (_buffer != stage->buf_ || _target != stage->target_)
1826 glBindTexture(_target, _buffer);
1828 stage->target_ = _target;
1829 stage->buf_ = _buffer;
1864 if (!vertexPointerLock_)
1866 #ifdef GLSTATE_AVOID_REDUNDANT_GLCALLS 1867 if (!stateStack_.back().vertexPointer_.equals(_size, _type, _stride, _pointer))
1870 glVertexPointer(_size, _type, _stride, _pointer);
1871 stateStack_.back().vertexPointer_.set(_size, _type, _stride, _pointer);
1878 if (_size) *_size = stateStack_.back().vertexPointer_.size;
1879 if (_stride) *_stride = stateStack_.back().vertexPointer_.stride;
1880 if (_type) *_type = stateStack_.back().vertexPointer_.type;
1881 if (_pointer) *_pointer = stateStack_.back().vertexPointer_.pointer;
1886 if (!normalPointerLock_)
1888 #ifdef GLSTATE_AVOID_REDUNDANT_GLCALLS 1889 if (!stateStack_.back().normalPointer_.equals(stateStack_.back().normalPointer_.size, _type, _stride, _pointer))
1892 glNormalPointer(_type, _stride, _pointer);
1893 stateStack_.back().normalPointer_.set(3, _type, _stride, _pointer);
1900 if (_type) *_type = stateStack_.back().normalPointer_.type;
1901 if (_stride) *_stride = stateStack_.back().normalPointer_.stride;
1902 if (_pointer) *_pointer = stateStack_.back().normalPointer_.pointer;
1908 if (!colorPointerLock_)
1910 #ifdef GLSTATE_AVOID_REDUNDANT_GLCALLS 1911 if (!stateStack_.back().colorPointer_.equals(_size, _type, _stride, _pointer))
1914 glColorPointer(_size, _type, _stride, _pointer);
1915 stateStack_.back().colorPointer_.set(_size, _type, _stride, _pointer);
1922 if (_size) *_size = stateStack_.back().colorPointer_.size;
1923 if (_stride) *_stride = stateStack_.back().colorPointer_.stride;
1924 if (_type) *_type = stateStack_.back().colorPointer_.type;
1925 if (_pointer) *_pointer = stateStack_.back().colorPointer_.pointer;
1930 if (!texcoordPointerLock_)
1932 #ifdef GLSTATE_AVOID_REDUNDANT_GLCALLS 1933 if (!stateStack_.back().texcoordPointer_.equals(_size, _type, _stride, _pointer))
1936 glTexCoordPointer(_size, _type, _stride, _pointer);
1937 stateStack_.back().texcoordPointer_.set(_size, _type, _stride, _pointer);
1944 if (_size) *_size = stateStack_.back().texcoordPointer_.size;
1945 if (_stride) *_stride = stateStack_.back().texcoordPointer_.stride;
1946 if (_type) *_type = stateStack_.back().texcoordPointer_.type;
1947 if (_pointer) *_pointer = stateStack_.back().texcoordPointer_.pointer;
1955 if (!drawBufferLock_)
1957 #ifdef GLSTATE_AVOID_REDUNDANT_GLCALLS 1958 if (stateStack_.back().drawBufferSingle_ != _mode || stateStack_.back().activeDrawBuffer_)
1961 glDrawBuffer(_mode);
1962 stateStack_.back().drawBufferSingle_ = _mode;
1963 stateStack_.back().activeDrawBuffer_ = 0;
1970 if (!drawBufferLock_)
1972 #ifdef GLSTATE_AVOID_REDUNDANT_GLCALLS 1973 int bChange = !stateStack_.back().activeDrawBuffer_;
1974 for (
int i = 0; i < _n && (!bChange); ++i)
1976 if (stateStack_.back().drawBufferState_[i] != _bufs[i])
1983 glDrawBuffers(_n, _bufs);
1985 for (
int i = 0; i < _n; ++i)
1986 stateStack_.back().drawBufferState_[i] = _bufs[i];
1988 stateStack_.back().activeDrawBuffer_ = _n;
1997 glGetIntegerv(GL_DRAW_FRAMEBUFFER_BINDING, (GLint*)&curfbo);
2005 glGetIntegerv(GL_READ_FRAMEBUFFER_BINDING, (GLint*)&curfbo);
2014 case GL_FRAMEBUFFER:
2020 case GL_DRAW_FRAMEBUFFER: i = 0;
break;
2021 case GL_READ_FRAMEBUFFER: i = 1;
break;
2024 if (i >= 0 && !framebufferLock_[i])
2026 #ifdef GLSTATE_AVOID_REDUNDANT_GLCALLS 2027 if (stateStack_.back().framebuffers_[i] != _framebuffer)
2030 glBindFramebufferEXT(_target, _framebuffer);
2031 stateStack_.back().framebuffers_[i] = _framebuffer;
2040 case GL_FRAMEBUFFER:
2041 framebufferLock_[0] = framebufferLock_[1] =
true;
break;
2043 case GL_DRAW_FRAMEBUFFER: framebufferLock_[0] =
true;
break;
2044 case GL_READ_FRAMEBUFFER: framebufferLock_[1] =
true;
break;
2052 case GL_FRAMEBUFFER:
2053 framebufferLock_[0] = framebufferLock_[1] =
false;
break;
2055 case GL_DRAW_FRAMEBUFFER: framebufferLock_[0] =
false;
break;
2056 case GL_READ_FRAMEBUFFER: framebufferLock_[1] =
false;
break;
2064 case GL_FRAMEBUFFER:
2065 return framebufferLock_[0] && framebufferLock_[1];
2067 case GL_DRAW_FRAMEBUFFER:
return framebufferLock_[0];
2068 case GL_READ_FRAMEBUFFER:
return framebufferLock_[1];
2077 #ifdef GLSTATE_AVOID_REDUNDANT_GLCALLS 2078 if (stateStack_.back().program_ != _program)
2081 glUseProgram(_program);
2082 stateStack_.back().program_ = _program;
2088 glGenBuffersARB(n, buffers);
2092 glGenBuffers(n, buffers);
2096 GLenum target, GLsizeiptrARB size,
const GLvoid *data, GLenum usage) {
2097 glBufferDataARB(target, size, data, usage);
2101 GLenum target, GLsizeiptr size,
const GLvoid* data, GLenum usage) {
2102 glBufferData(target, size, data, usage);
2106 glDeleteBuffers(n, buffers);
2110 return glMapBuffer(target, access);
2115 return glUnmapBuffer(target);
void inverse_lookAt(const Vec3 &eye, const Vec3 ¢er, const Vec3 &up)
multiply self from left with inverse lookAt matrix
static void enable(GLenum _cap)
replaces glEnable, but supports locking
unsigned int pick_current_index() const
Returns the current color picking index (can be used for caching)
void push_projection_matrix()
push projection matrix
void clearBuffers()
clear buffers viewport rectangle
Vec3d eye() const
get eye point
void setState()
set the whole stored gl state
Vec4uc getIndexColor(unsigned int _idx)
gets the color instead of setting it directly
static void getDepthRange(GLclampd *_zNearOut, GLclampd *_zFarOut)
get current depth range
bool error() const
Did an error occur during picking.
void pop_projection_matrix()
pop projection matrix
void set_multisampling(bool _b)
Enable or disable multisampling.
VectorT< T, 3 > transform_point(const VectorT< T, 3 > &_v) const
transform point (x',y',z',1) = M * (x,y,z,1)
void glColor(const Vec3f &_v)
Wrapper: glColor for Vec3f.
void initialize()
init (takes current GL context/ like glInitNames (); glPushName (0))
void pick_pop_name()
pops the current name from the stack (like glPopName())
void popIndex()
pops the current node from the stack (like glPopName)
void translate(Scalar _x, Scalar _y, Scalar _z, MultiplyFrom _mult_from=MULT_FROM_RIGHT)
multiply self with translation matrix (x,y,z)
void set_twosided_lighting(bool _b)
set whether transparent or solid objects should be drawn
void lookAt(const Vec3d &_eye, const Vec3d &_center, const Vec3d &_up)
set camera by lookAt
static void blendEquation(GLenum _mode)
replaces glBlendEquation, supports locking
static void lockClientState(GLenum _cap)
locks a client state
static const Vec4f default_diffuse_color
default value for diffuse color
unsigned int freeIndicies() const
returns maximal available index count
unsigned int currentIndex() const
returns the current color index
bool color_picking() const
Is color picking active?
static bool isClientStateEnabled(GLenum _cap)
returns true, if a client state is enabled
void set_ambient_color(const Vec4f &_col)
set ambient color
static GLenum getBoundTextureTarget()
get bound texture target
static void genBuffers(GLsizei n, GLuint *buffers)
void inverse_frustum(Scalar left, Scalar right, Scalar bottom, Scalar top, Scalar near_plane, Scalar far_plane)
multiply self from left with inverse of perspective projection matrix
void viewing_ray(int _x, int _y, Vec3d &_origin, Vec3d &_direction) const
void push_modelview_matrix()
push modelview matrix
void perspective(double _fovY, double _aspect, double _near_plane, double _far_plane)
perspective projection
static void genBuffersARB(GLsizei n, GLuint *buffers)
static void alphaFunc(GLenum _func, GLclampf _ref)
replaces glAlphaFunc, supports locking
static void disableClientState(GLenum _cap)
replaces glDisableClientState, supports locking
void set_bounding_box(ACG::Vec3d _min, ACG::Vec3d _max)
void set_shininess(float _shininess)
set specular shininess (must be in [0, 128])
std::vector< unsigned int > pick_color_to_stack(Vec4uc _rgba) const
static bool isBufferTargetLocked(GLenum _target)
get buffer target locking state
static const Vec4f default_clear_color
default value for clear color
static void enableClientState(GLenum _cap)
replaces glEnableClientState, supports locking
static void deleteBuffers(GLsizei n, const GLuint *buffers)
void makeCurrent()
does nothing
Vec4uc pick_get_name_color(unsigned int _idx)
static void lockState(GLenum _cap)
locks a specific cap state, such that enable() or disable() has no effect
static bool isFramebufferLocked(GLenum _target)
get framebuffer target lock state
static void getVertexPointer(GLint *_size, GLenum *_type, GLsizei *_stride, const GLvoid **_pointer)
get vertex pointer, null-ptr safe
void pick_init(bool _color)
initialize name/color picking stack (like glInitNames())
static bool isStateEnabled(GLenum _cap)
returns true, if a cpa state is enabled
static void unlockFramebuffer(GLenum _target)
unlock a framebuffer target
static GLuint getFramebufferDraw()
get current draw framebuffer of a target
void setIndex(unsigned int _idx)
sets the current color the given index (like glLoadName)
static const Vec4f default_base_color
default value for base color
void set_depthFunc(const GLenum &_depth_func)
Call glDepthFunc() to actually change the depth comparison function, and store the new value in this ...
static void bindFramebuffer(GLenum _target, GLuint _framebuffer)
replaces glBindFramebuffer, supports locking
static void texcoordPointer(GLint _size, GLenum _type, GLsizei _stride, const GLvoid *_pointer)
replaces glTexcoordPointer, supports locking
void ortho(double _left, double _right, double _bottom, double _top, double _near_plane, double _far_plane)
orthographic projection
static void bindBuffer(GLenum _target, GLuint _buffer)
replaces glBindBuffer, supports locking
static bool isTextureTargetLocked()
get texture target locking state
static void useProgram(GLuint _program)
replaces glUseProgram, supports locking
static void unlockTextureStage()
unlocks the current texture target
Vec3d project(const Vec3d &_point) const
project point in world coordinates to window coordinates
void rotate(Scalar angle, Scalar x, Scalar y, Scalar z, MultiplyFrom _mult_from=MULT_FROM_RIGHT)
void set_point_size(float _f)
set point size
Vec3d up() const
get up-vector w.r.t. camera coordinates
static int getActiveTextureIndex()
get active texture as zero based index
void set_diffuse_color(const Vec4f &_col)
set diffuse color
double aspect() const
get aspect ratio
static void bufferData(GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage)
void identity()
setup an identity matrix
static void blendColor(GLclampf _red, GLclampf _green, GLclampf _blue, GLclampf _alpha)
replaces glBlendColor, supports locking
const GLenum & depthFunc() const
get glDepthFunc() that is supposed to be active
static void bufferDataARB(GLenum target, GLsizeiptrARB size, const GLvoid *data, GLenum usage)
bool initialized() const
has it been initialized?
void pushIndex(unsigned int _idx)
creates a new node the stack (like glPushName)
static void depthRange(GLclampd _zNear, GLclampd _zFar)
replaces glDepthRange, supports locking
void translate(double _x, double _y, double _z, MultiplyFrom _mult_from=MULT_FROM_RIGHT)
translate by (_x, _y, _z)
void mult_matrix(const GLMatrixd &_m, const GLMatrixd &_inv_m, MultiplyFrom _mult_from=MULT_FROM_RIGHT)
multiply by a given transformation matrix
void inverse_ortho(Scalar left, Scalar right, Scalar bottom, Scalar top, Scalar near_plane, Scalar far_plane)
multiply self from left with inverse orthographic projection matrix
bool pick_set_maximum(unsigned int _idx)
Set the maximal number of primitives/components of your object.
void set_specular_color(const Vec4f &_col)
set specular color
VectorT< unsigned char, 4 > Vec4uc
static GLboolean unmapBuffer(GLenum target)
Vec3d unproject(const Vec3d &_winPoint) const
unproject point in window coordinates _winPoint to world coordinates
void perspective(Scalar fovY, Scalar aspect, Scalar near_plane, Scalar far_plane)
multiply self with a perspective projection matrix
static const Vec4f default_ambient_color
default value for ambient color
void set_modelview(const GLMatrixd &_m)
set modelview
void frustum(double _left, double _right, double _bottom, double _top, double _near_plane, double _far_plane)
perspective projection
static void unlockBufferTarget(GLenum _target)
unlock buffer target
const Scalar * get_raw_data() const
const GLMatrixd & viewport() const
get viewport matrix
static GLuint getFramebufferRead()
get current read framebuffer of a target
static bool isClientStateLocked(GLenum _cap)
returns true, if a client state is locked
static void drawBuffers(GLsizei _n, const GLenum *_bufs)
replaces glDrawBuffers, supports locking
unsigned int pick_free_indicies() const
returns the number of still available colors during color picking
static const float default_shininess
default value for shininess
Namespace providing different geometric functions concerning angles.
static void syncFromGL()
synchronize this class with the OpenGL state machine
void scale(Scalar _x, Scalar _y, Scalar _z, MultiplyFrom _mult_from=MULT_FROM_RIGHT)
multiply self with scaling matrix (x,y,z)
void scale(double _s)
scale by (_s, _s, _s)
static void colorPointer(GLint _size, GLenum _type, GLsizei _stride, const GLvoid *_pointer)
replaces glColorPointer, supports locking
static GLvoid * mapBuffer(GLenum target, GLenum access)
static int getBufferTargetIndex(GLenum _target)
bijective map from GLenum buffer_target to [0..3], -1 if unsupported
static void activeTexture(GLenum _texunit)
replaces glActiveTexture, no locking support
static void unlockState(GLenum _cap)
unlocks a specific cap state
static void lockBufferTarget(GLenum _target)
lock buffer target
void pop_modelview_matrix()
pop modelview matrix
void set_projection(const GLMatrixd &_m)
set projection
void set_overlay_color(const Vec4f &_col)
set overlay color
void pick_set_name(unsigned int _idx)
sets the current name/color (like glLoadName(_idx))
void rotate(double _angle, double _x, double _y, double _z, MultiplyFrom _mult_from=MULT_FROM_RIGHT)
rotate around axis (_x, _y, _z) by _angle
static void vertexPointer(GLint _size, GLenum _type, GLsizei _stride, const GLvoid *_pointer)
replaces glVertexPointer, supports locking
static void disable(GLenum _cap)
replaces glDisable, but supports locking
void frustum(Scalar left, Scalar right, Scalar bottom, Scalar top, Scalar near_plane, Scalar far_plane)
multiply self with a perspective projection matrix
void reset_projection()
reset projection matrix (load identity)
auto normalize() -> decltype(*this/=std::declval< VectorT< S, DIM >>().norm())
static void getTexcoordPointer(GLint *_size, GLenum *_type, GLsizei *_stride, const GLvoid **_pointer)
get color pointer, null-ptr safe
void set_clear_color(const Vec4f &_col)
set background color
void inverse_perspective(Scalar fovY, Scalar aspect, Scalar near_plane, Scalar far_plane)
multiply self from left with inverse of perspective projection matrix
static void cullFace(GLenum _mode)
replaces glCullFace, supports locking
void lookAt(const Vec3 &eye, const Vec3 ¢er, const Vec3 &up)
static const Vec4f default_overlay_color
default value for overlay color
std::vector< unsigned int > colorToStack(Vec4uc _rgba) const
converts the given color to index values on the stack
static void lockTextureStage()
locks the current texture stage (set by setActiveTexture)
static bool isStateLocked(GLenum _cap)
returns true, if a cap state is locked
bool setMaximumIndex(unsigned int _idx)
sets the maximum index number used in current node
static void getNormalPointer(GLenum *_type, GLsizei *_stride, const GLvoid **_pointer)
get normal pointer, null-ptr safe
static void unlockClientState(GLenum _cap)
unlocks a client state
static void bindTexture(GLenum _target, GLuint _buffer)
replaces glBindTexture, supports locking
double fovy() const
get field of view in y direction
static void getAlphaFunc(GLenum *_func, GLclampf *_ref)
get alpha function, null-ptr safe
void set_base_color(const Vec4f &_col)
set base color (used when lighting is off)
GLState(bool _updateGL=true, bool _compatibilityProfile=true)
Default constructor.
static GLuint getBoundBuf(GLenum _target)
get currently bound buffer
static const Vec4f default_specular_color
default value for specular color
void ortho(Scalar left, Scalar right, Scalar bottom, Scalar top, Scalar near_plane, Scalar far_plane)
multiply self with orthographic projection matrix
void set_color(const Vec4f &_col)
set color
static void getColorPointer(GLint *_size, GLenum *_type, GLsizei *_stride, const GLvoid **_pointer)
get color pointer, null-ptr safe
void get_bounding_box(ACG::Vec3d &_min, ACG::Vec3d &_max)
void set_line_width(float _f)
set line width
Vec3d right() const
get right-vector w.r.t. camera coordinates
void initialize()
initialize all state variables (called by constructor)
static void drawBuffer(GLenum _mode)
replaces glDrawBuffer, supports locking
VectorT< double, 3 > Vec3d
static void blendFuncSeparate(GLenum _srcRGB, GLenum _dstRGB, GLenum _srcAlpha, GLenum _dstAlpha)
replaces glBlendFuncSeparate, supports locking
static void getBlendColor(GLclampf *_col)
get blend color, not null-ptr safe, 4 element color output: RGBA
static GLuint getBoundTextureBuffer()
get bound texture
static void lockFramebuffer(GLenum _target)
lock a framebuffer target
void reset_modelview()
reset modelview matrix (load identity)
void pick_push_name(unsigned int _idx)
creates a new name the stack (like glPushName())
Scalar * data()
access to Scalar array
static void normalPointer(GLenum _type, GLsizei _stride, const GLvoid *_pointer)
replaces glNormalPointer, supports locking
Vec3d viewing_direction() const
get viewing ray
static void getBlendFuncSeparate(GLenum *_srcRGB, GLenum *_dstRGB, GLenum *_srcAlpha, GLenum *_dstAlpha)
get blend function, null-ptr safe
static void shadeModel(GLenum _mode)
replaces glShadeModel, supports locking