void CBoxProxyView::drawUnitAxes() { // 实线部分 glPointSize(1.0f); glBegin(GL_POINTS); for (int i=0;i<points.size();i++) { Vector3d tmpP=points.at(i); Vector3d tmpC=pColors.at(i); //glColor3f(tmpC(2)/255,tmpC(1)/255,tmpC(0)/255); if (gettingDepth) { glVertexAttrib4d(ColorPos,tmpC(2)/255,tmpC(1)/255,tmpC(0)/255,0.0); glVertexAttrib4d(VertexPos,tmpP(0),tmpP(1),tmpP(2),1.0); } else glColor3f(tmpC(2)/255,tmpC(1)/255,tmpC(0)/255); glVertex3f(tmpP(0),tmpP(1),tmpP(2)); } glEnd(); }
//-------------------------------------------------------------- void ofShader::setAttribute4d(GLint location, double v1, double v2, double v3, double v4) const{ if(bLoaded) glVertexAttrib4d(location, v1, v2, v3, v4); }
void CBoxProxyView::OnDraw(CDC* /*pDC*/) { CBoxProxyDoc* pDoc = GetDocument(); ASSERT_VALID(pDoc); if (!pDoc) return; // TODO: 在此处为本机数据添加绘制代码 // 清除颜色 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glPushMatrix(); { // 绘制坐标系 if (gettingDepth) glVertexAttrib4d(ColorPos,0.0,1.0,0.0,0.0); if(!gettingDepth){ drawUnitAxes(); drawTest(); if (showOrig) { glColor3f(0,1,0); for (int i=0;i<boxes.size();i++) drawBoxLines(boxes.at(i)); } if (showExtend) { glColor3f(0,1,1); for (int i=0;i<extendedBoxes.size();i++) drawBoxLines(extendedBoxes.at(i)); } } else if(testMode){ for (int i=0;i<boxes.size();i++) drawBoxPolygons(boxes.at(i)); } else{ for (int i=0;i<boxes.size();i++) drawBoxPolygons(boxes.at(i)); } } glPopMatrix(); // 交换缓冲区 if (gettingDepth) { GetDepthAfter(); } else SwapBuffers(wglGetCurrentDC()); }
void ShaderProgram::setAttribute(GLint index, GLdouble v1, GLdouble v2, GLdouble v3, GLdouble v4) { glVertexAttrib4d(index, v1, v2, v3, v4); }
void shader_gl3::attribute(const char* name, const double& arg1, const double& arg2, const double& arg3, const double& arg4) const { A2E_CHECK_ATTRIBUTE_EXISTENCE(name); A2E_CHECK_ATTRIBUTE_TYPE(name, GL_FLOAT_VEC4); glVertexAttrib4d(A2E_SHADER_GET_ATTRIBUTE_POSITION(name), arg1, arg2, arg3, arg4); }
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_GL20_nglVertexAttrib4d(JNIEnv *env, jclass clazz, jint index, jdouble x, jdouble y, jdouble z, jdouble w, jlong function_pointer) { glVertexAttrib4dPROC glVertexAttrib4d = (glVertexAttrib4dPROC)((intptr_t)function_pointer); glVertexAttrib4d(index, x, y, z, w); }