{"id":4060,"date":"2018-05-07T23:32:09","date_gmt":"2018-05-07T15:32:09","guid":{"rendered":"http:\/\/www.bookcard.net\/wordpress\/?p=4060"},"modified":"2018-10-14T21:14:04","modified_gmt":"2018-10-14T13:14:04","slug":"opengl_bezier_surface","status":"publish","type":"post","link":"https:\/\/www.bookcard.net\/wordpress\/opengl_bezier_surface\/","title":{"rendered":"OpenGL\u4e4b\u8c9d\u8cfd\u723e(Bezier)\u66f2\u9762"},"content":{"rendered":"<figure id=\"attachment_4061\" aria-describedby=\"caption-attachment-4061\" style=\"width: 1024px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/www.bookcard.net\/wordpress\/wp-content\/uploads\/2018\/05\/OpenGL_Bezier_Surface.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-4061\" src=\"https:\/\/www.bookcard.net\/wordpress\/wp-content\/uploads\/2018\/05\/OpenGL_Bezier_Surface.jpg\" alt=\"\" width=\"1024\" height=\"768\" srcset=\"https:\/\/www.bookcard.net\/wordpress\/wp-content\/uploads\/2018\/05\/OpenGL_Bezier_Surface.jpg 1024w, https:\/\/www.bookcard.net\/wordpress\/wp-content\/uploads\/2018\/05\/OpenGL_Bezier_Surface-300x225.jpg 300w, https:\/\/www.bookcard.net\/wordpress\/wp-content\/uploads\/2018\/05\/OpenGL_Bezier_Surface-768x576.jpg 768w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption id=\"caption-attachment-4061\" class=\"wp-caption-text\">OpenGL\u8c9d\u8cfd\u723e(Bezier)\u66f2\u9762<\/figcaption><\/figure>\n<p>\u8c9d\u8cfd\u723e(Bezier)\u300e\u66f2\u9762\u300f\u8207\u300e<a href=\"https:\/\/www.bookcard.net\/wordpress\/opengl_bezier_curve\/\">\u66f2\u7dda<\/a>\u300f\u76f8\u6bd4\u4e0d\u540c\u4e4b\u8655\u5728\u65bc\u591a\u5497v\u7a7a\u9593\u57df.\u66f2\u9762\u51fd\u5f0fs(u,v).<strong>\u66f2\u9762<\/strong>\u6f14\u793a\u7a0b\u5f0f\u6309\u7a7a\u683c\u9375\u5728\u7dda\u6846\u3001\u586b\u5145\u3001\u7d0b\u7406\u6a21\u5f0f\u4e2d\u5207\u63db:<a href=\"https:\/\/www.bookcard.net\/wordpress\/wp-content\/uploads\/2018\/05\/OpenGLBezierSurface.zip\">\u4e0b\u8f09<\/a><\/p>\n<p>1.\u5c0d\u66f2\u9762\u9032\u884c\u67f5\u683c\u6620\u5c04<\/p>\n<p>void glMap2f(GLenum target,GLfloat u1,GLfloat u2,GLint ustride,GLint uorder,GLfloat v1,GLfloat v2,GLint vstride,GLint vorder,const GLfloat *points);<\/p>\n<p>\u51fd\u5f0f\u793a\u4f8b:<\/p>\n<p>glMap2f(GL_MAP2_VERTEX_3, 0, 1, 3,u,\u00a0 0,1, 3<em>v,3,\u00a0 (GLfloat<\/em>)bezier-&gt;control_array);<\/p>\n<table>\n<tbody>\n<tr>\n<td width=\"277\">\u53c3\u6578<\/td>\n<td width=\"277\">\u7c21\u4ecb<\/td>\n<\/tr>\n<tr>\n<td width=\"277\">target<\/td>\n<td width=\"277\"><strong>\u63a7\u5236\u9ede\u985e\u578b<\/strong><\/td>\n<\/tr>\n<tr>\n<td width=\"277\">u1,u2<\/td>\n<td width=\"277\"><strong>u<\/strong><strong>\u7a7a\u9593\u57df\u53c3\u6578\u7684\u5b9a\u7fa9\u57df(u1~u2)<\/strong><\/td>\n<\/tr>\n<tr>\n<td width=\"277\">ustride<\/td>\n<td width=\"277\"><strong>u<\/strong><strong>\u7a7a\u9593\u57df\u9802\u9ede<\/strong>\u8de8\u5ea6<\/td>\n<\/tr>\n<tr>\n<td width=\"277\">uorder<\/td>\n<td width=\"277\"><strong>u<\/strong><strong>\u7a7a\u9593\u57df\u9802\u9ede\u500b\u6578<\/strong><\/td>\n<\/tr>\n<tr>\n<td width=\"277\">v1, v2<\/td>\n<td width=\"277\"><strong>v<\/strong><strong>\u7a7a\u9593\u57df\u53c3\u6578\u7684\u5b9a\u7fa9\u57df(u1~u2)<\/strong><\/td>\n<\/tr>\n<tr>\n<td width=\"277\">vstride<\/td>\n<td width=\"277\"><strong>v<\/strong><strong>\u7a7a\u9593\u57df\u9802\u9ede<\/strong>\u8de8\u5ea6<\/td>\n<\/tr>\n<tr>\n<td width=\"277\">vorder<\/td>\n<td width=\"277\"><strong>v<\/strong><strong>\u7a7a\u9593\u57df\u9802\u9ede\u500b\u6578<\/strong><\/td>\n<\/tr>\n<tr>\n<td width=\"277\">points<\/td>\n<td width=\"277\"><strong>\u5b9a\u9ede\u6578\u7d44<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><strong>\u00a0<\/strong><\/p>\n<table>\n<tbody>\n<tr>\n<td width=\"277\"><strong>\u63a7\u5236\u9ede\u985e\u578b(<\/strong>target)<\/td>\n<td width=\"277\"><strong>\u7c21\u4ecb<\/strong><\/td>\n<\/tr>\n<tr>\n<td width=\"277\"><strong>GL_MAP1_VERTEX_3<\/strong><\/td>\n<td width=\"277\"><strong>\u9802\u9ede\u5ea7\u6a19(x,y,z)<\/strong><\/td>\n<\/tr>\n<tr>\n<td width=\"277\"><strong>GL_MAP1_VERTEX_4<\/strong><\/td>\n<td width=\"277\"><strong>\u9802\u9ede\u5ea7\u6a19(x,y,z,w)<\/strong><\/td>\n<\/tr>\n<tr>\n<td width=\"277\"><strong>GL_MAP1_INDEX<\/strong><\/td>\n<td width=\"277\"><strong>\u984f\u8272\u7d22\u5f15<\/strong><\/td>\n<\/tr>\n<tr>\n<td width=\"277\"><strong>GL_MAP1_COLOR_4<\/strong><\/td>\n<td width=\"277\"><strong>\u984f\u8272\u503c(RGBA)<\/strong><\/td>\n<\/tr>\n<tr>\n<td width=\"277\"><strong>GL_MAP1_NORMAL<\/strong><\/td>\n<td width=\"277\"><strong>\u6cd5\u7dda\u5ea7\u6a19<\/strong><\/td>\n<\/tr>\n<tr>\n<td width=\"277\"><strong>GL_MAP1_TEXTURE_COORD_1<\/strong><\/td>\n<td width=\"277\"><strong>\u7d0b\u7406\u5ea7\u6a19(s)<\/strong><\/td>\n<\/tr>\n<tr>\n<td width=\"277\"><strong>GL_MAP1_TEXTURE_COORD_2<\/strong><\/td>\n<td width=\"277\"><strong>\u7d0b\u7406\u5ea7\u6a19(s,t)<\/strong><\/td>\n<\/tr>\n<tr>\n<td width=\"277\"><strong>GL_MAP1_TEXTURE_COORD_3<\/strong><\/td>\n<td width=\"277\"><strong>\u7d0b\u7406\u5ea7\u6a19(s,t,r)<\/strong><\/td>\n<\/tr>\n<tr>\n<td width=\"277\"><strong>GL_MAP1_TEXTURE_COORD_4<\/strong><\/td>\n<td width=\"277\"><strong>\u7d0b\u7406\u5ea7\u6a19(s,t,r,g)<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>2.\u555f\u7528\u8c9d\u8cfd\u723e(Bezier)\u66f2\u9762<\/p>\n<p>glEnable(GL_MAP2_VERTEX_3);<\/p>\n<p>3.\u5b9a\u7fa9\u5b9a\u7fa9\u5747\u52fb\u7684\u67f5\u683c,\u4e26\u8a2d\u7f6e\u9593\u9694\u500b\u6578<\/p>\n<p>void glMapGrid2f(GLint un,GLfloat u1,GLfloat u2,GLint vn,GLfloat v1,GLfloat v2);<\/p>\n<p>\u51fd\u5f0f\u793a\u4f8b:<\/p>\n<p>glMapGrid2f(10,0, 10, 10, 0, 10);<\/p>\n<table>\n<tbody>\n<tr>\n<td width=\"277\">\u53c3\u6578<\/td>\n<td width=\"277\"><strong>\u7c21\u4ecb<\/strong><\/td>\n<\/tr>\n<tr>\n<td width=\"277\">un<\/td>\n<td width=\"277\">u\u57df[u1~u2]\u9593\u9694\u500b\u6578,\u5fc5\u9808\u70ba\u6b63<\/td>\n<\/tr>\n<tr>\n<td width=\"277\">u1<\/td>\n<td width=\"277\">u1=0<\/td>\n<\/tr>\n<tr>\n<td width=\"277\">u2<\/td>\n<td width=\"277\">u2=un<\/td>\n<\/tr>\n<tr>\n<td width=\"277\">vn<\/td>\n<td width=\"277\">v\u57df[v1~v2]\u9593\u9694\u500b\u6578,\u5fc5\u9808\u70ba\u6b63<\/td>\n<\/tr>\n<tr>\n<td width=\"277\">v1<\/td>\n<td width=\"277\">v1=0<\/td>\n<\/tr>\n<tr>\n<td width=\"277\">v2<\/td>\n<td width=\"277\">v2=vn<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<ol start=\"4\">\n<li>\u6839\u64da\u67f5\u683c\u8a2d\u7f6e\u7e6a\u88fd\u66f2\u9762<\/li>\n<\/ol>\n<p>void glEvalMesh2(GLenum mode,GLint i1,GLint i2,GLint j1,GLint j2);<\/p>\n<p>\u51fd\u5f0f\u793a\u4f8b:<\/p>\n<p>glEvalMesh2(GL_FILL, 0, 10, 0, 10);<\/p>\n<table>\n<tbody>\n<tr>\n<td width=\"277\">\u53c3\u6578<\/td>\n<td width=\"277\">\u7c21\u4ecb<\/td>\n<\/tr>\n<tr>\n<td width=\"277\">mode<\/td>\n<td width=\"277\">\u7e6a\u756b\u6a21\u5f0f<\/p>\n<p>GL_POINT:\u9ede<\/p>\n<p>GL_LINE:\u76f4\u7dda<\/p>\n<p>GL_FILL:\u586b\u5145<\/td>\n<\/tr>\n<tr>\n<td width=\"277\">i1,i2<\/td>\n<td width=\"277\">u\u7a7a\u9593\u57df\u7684\u7bc4\u570d<\/td>\n<\/tr>\n<tr>\n<td width=\"277\">j1,j2<\/td>\n<td width=\"277\">v\u7a7a\u9593\u57df\u7684\u7bc4\u570d<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>5.\u70ba\u66f2\u9762\u751f\u6210\u6cd5\u7dda\u7528\u65bc\u5149\u7167<\/p>\n<p>glEnable(GL_AUTO_NORMAL);<\/p>\n<p>6.\u5c0d\u66f2\u9762\u9032\u884c\u7d0b\u7406\u6620\u5c04<\/p>\n<p>glMap2f(GL_MAP2_TEXTURE_COORD_2, 0,1,2, 2,0,1, 4,2,(GLfloat*)bezier-&gt;texture_coord);<\/p>\n<table>\n<tbody>\n<tr>\n<td width=\"226\">\u5c0d\u66f2\u9762\u9032\u884c\u7d0b\u7406\u6620\u5c04glMap2f()<\/td>\n<td width=\"327\">\u7c21\u4ecb<\/td>\n<\/tr>\n<tr>\n<td width=\"226\">target<\/td>\n<td width=\"327\"><strong>\u7d0b\u7406\u5ea7\u6a19(s,t):<\/strong>GL_MAP2_TEXTURE_COORD_2(\u7747\u4e0a\u8868)<\/td>\n<\/tr>\n<tr>\n<td width=\"226\">u1,u2<\/td>\n<td width=\"327\">s\u7a7a\u9593\u57df:[0~1]<\/td>\n<\/tr>\n<tr>\n<td width=\"226\">ustride<\/td>\n<td width=\"327\">s\u7d0b\u7406\u5ea7\u6a19<strong>\u9802\u9ede<\/strong>\u8de8\u5ea6:2<\/td>\n<\/tr>\n<tr>\n<td width=\"226\">uorder<\/td>\n<td width=\"327\"><strong>s<\/strong><strong>\u7a7a\u9593\u57df\u9802\u9ede\u500b\u6578:2<\/strong><\/td>\n<\/tr>\n<tr>\n<td width=\"226\">v1,v2<\/td>\n<td width=\"327\">t\u7a7a\u9593\u57df:[0~1]<\/td>\n<\/tr>\n<tr>\n<td width=\"226\">vstride<\/td>\n<td width=\"327\">t\u7d0b\u7406\u5ea7\u6a19<strong>\u9802\u9ede<\/strong>\u8de8\u5ea6:4<\/td>\n<\/tr>\n<tr>\n<td width=\"226\">vorder<\/td>\n<td width=\"327\"><strong>t<\/strong><strong>\u7a7a\u9593\u57df\u9802\u9ede\u500b\u6578:2<\/strong><\/td>\n<\/tr>\n<tr>\n<td width=\"226\">points<\/td>\n<td width=\"327\">\u7d0b\u7406\u5ea7\u6a19:{0.0, 0.0}, {0.0, 1.0}, {1.0, 0.0}, {1.0, 1.0}<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>4.\u555f\u7528\u66f2\u9762\u7d0b\u7406\u5ea7\u6a19<\/p>\n<p>glEnable(GL_MAP2_TEXTURE_COORD_2);<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u8c9d\u8cfd\u723e(Bezier)\u300e\u66f2\u9762\u300f\u8207\u300e\u66f2\u7dda\u300f\u76f8\u6bd4\u4e0d\u540c\u4e4b\u8655\u5728\u65bc\u591a\u5497v\u7a7a\u9593\u57df.\u66f2\u9762\u51fd\u5f0fs(u,v).\u66f2\u9762\u6f14\u793a\u7a0b\u5f0f\u6309\u7a7a\u683c &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.bookcard.net\/wordpress\/opengl_bezier_surface\/\" class=\"more-link\">\u7e7c\u7e8c\u95b1\u8b80 <span class=\"screen-reader-text\">OpenGL\u4e4b\u8c9d\u8cfd\u723e(Bezier)\u66f2\u9762<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[62],"tags":[50],"class_list":["post-4060","post","type-post","status-publish","format-standard","hentry","category-opengl","tag-opengl","entry"],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.bookcard.net\/wordpress\/wp-json\/wp\/v2\/posts\/4060","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.bookcard.net\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.bookcard.net\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.bookcard.net\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.bookcard.net\/wordpress\/wp-json\/wp\/v2\/comments?post=4060"}],"version-history":[{"count":2,"href":"https:\/\/www.bookcard.net\/wordpress\/wp-json\/wp\/v2\/posts\/4060\/revisions"}],"predecessor-version":[{"id":4105,"href":"https:\/\/www.bookcard.net\/wordpress\/wp-json\/wp\/v2\/posts\/4060\/revisions\/4105"}],"wp:attachment":[{"href":"https:\/\/www.bookcard.net\/wordpress\/wp-json\/wp\/v2\/media?parent=4060"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.bookcard.net\/wordpress\/wp-json\/wp\/v2\/categories?post=4060"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.bookcard.net\/wordpress\/wp-json\/wp\/v2\/tags?post=4060"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}