当前位置: 首页 > news >正文

展示系统 网站模板分栏型网站

展示系统 网站模板,分栏型网站,可画简历模板官网,低价网站建设哪家更好1 前言 使用Mesh绘制三角形 中介绍了绘制三角形的方法#xff0c;使用Mesh绘制矩形 中介绍了绘制矩形的方法#xff0c;本文将介绍绘制圆形的方法。 libGDX 以点、线段、三角形为图元#xff0c;没有提供绘制圆形的接口。要绘制圆形边框#xff0c;必须通过割圆法逼近圆形使用Mesh绘制矩形 中介绍了绘制矩形的方法本文将介绍绘制圆形的方法。 libGDX 以点、线段、三角形为图元没有提供绘制圆形的接口。要绘制圆形边框必须通过割圆法逼近圆形要绘制圆形的内部必须通过三角形逼近圆形如下图是通过 GL_TRIANGLE_FAN 模式逼近圆形。 2 绘制圆形 DesktopLauncher.java package com.zhyan8.game;import com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application; import com.badlogic.gdx.backends.lwjgl3.Lwjgl3ApplicationConfiguration;public class DesktopLauncher {public static void main (String[] arg) {Lwjgl3ApplicationConfiguration config new Lwjgl3ApplicationConfiguration();config.setForegroundFPS(60);config.setTitle(Circle);new Lwjgl3Application(new Circle(), config);} } Circle.java package com.zhyan8.game;import com.badlogic.gdx.ApplicationAdapter; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.graphics.GL30; import com.badlogic.gdx.graphics.Mesh; import com.badlogic.gdx.graphics.VertexAttribute; import com.badlogic.gdx.graphics.VertexAttributes.Usage; import com.badlogic.gdx.graphics.glutils.ShaderProgram;public class Circle extends ApplicationAdapter {private ShaderProgram mShaderProgram;private Mesh mMesh;private float mRatio;Overridepublic void create() {initShader();initMesh();}Overridepublic void render() {Gdx.gl.glClearColor(0.455f, 0.725f, 1.0f, 1.0f);Gdx.gl.glClear(GL30.GL_COLOR_BUFFER_BIT);mShaderProgram.bind();mShaderProgram.setUniformf(u_wh_ratio, mRatio);mMesh.render(mShaderProgram, GL30.GL_TRIANGLE_FAN); // 绘制圆形内部// mMesh.render(mShaderProgram, GL30.GL_LINE_LOOP); // 绘制圆形框}Overridepublic void dispose() {mShaderProgram.dispose();mMesh.dispose();}private void initShader() { // 初始化着色器程序String vertex Gdx.files.internal(shaders/circle_vertex.glsl).readString();String fragment Gdx.files.internal(shaders/circle_fragment.glsl).readString();mShaderProgram new ShaderProgram(vertex, fragment);mRatio 1.0f * Gdx.graphics.getWidth() / Gdx.graphics.getHeight();}private void initMesh() { // 初始化网格int num 50;float[] vertices getCircle(0f, 0f, 0.5f, num);short[] indices getIndices(num);VertexAttribute vertexPosition new VertexAttribute(Usage.Position, 3, a_position);mMesh new Mesh(true, vertices.length / 3, indices.length, vertexPosition);mMesh.setVertices(vertices);mMesh.setIndices(indices);}private float[] getCircle(float centerX, float centerY, float radius, int num) {float unit (float)(2 * Math.PI / num);float[] coords new float[num * 3];for (int i 0; i num; i) {coords[i * 3] (float)(centerX radius * Math.cos(unit * i));coords[i * 3 1] (float)(centerY radius * Math.sin(unit * i));coords[i * 3 2] 0;}return coords;}private short[] getIndices(int num) {short[] indices new short[num];for (short i 0; i num; i) {indices[i] i;}return indices;} } circle_vertex.glsl #version 300 esin vec3 a_position;uniform float u_wh_ratio; // 屏幕宽高比void main() {gl_Position vec4(a_position, 1.0);if (u_wh_ratio 1.0) {gl_Position.x / u_wh_ratio;} else {gl_Position.y * u_wh_ratio;} } circle_fragment.glsl #version 300 es precision mediump float; // 声明float型变量的精度为mediumpout vec4 fragColor;void main() {fragColor vec4(1, 0, 0, 0); }
http://wiki.neutronadmin.com/news/166349/

相关文章:

  • 阿里买域名 电脑做网站德州公司做网站
  • 免费照片的网站模板免费下载远洋国际一期官方网站建设
  • 创业做网站开发推广网站哪家做的好
  • 中国建设银行网站不好用烟台工程建设信息网站
  • 杭州高瑞网站建设网站建设需要配置环境么
  • 做网站用个人还是企业比较好深圳优化公司排名
  • 网站制作公司起名wordpress4.9.8安装
  • 网站建设工作落实情况wordpress重置
  • 厦门高端网站建设公司应用商店app下载安卓版
  • 单页网站 产品放哪自己做的网站如何引流
  • 想做网站策划怎么做门户网站建设与推广方案
  • 如何看别人网站用什么做的wordpress 5.0网易云音乐
  • linux wordpress 建站教程wordpress网站分享到朋友圈
  • 营销导向网站建设流程微信网站开发企业
  • 上海企业网站改版信誉比较好的商家可做网站
  • 网站建设 试题中铁建设团门户网登录入口
  • 建设企业网站公司在哪里搜索引擎链接
  • 门户网站建设技术方案广西建设信息网官网
  • 负责做网站的叫什么公司如何查看网站的更新频率
  • 吉林移动网站盐城网站建设
  • 泰州网站制作方案定制解析软件的网站
  • icp备案网站接入信息ip地址段怎么填wordpress 暖岛 主题
  • 关于网站建设的总结网站开发可选择的方案有
  • 成都网站制作的公司html表格代码
  • 网站主机空间用哪个好网络广告营销方案
  • 深圳做微商网站的公司佛山制作网页公司
  • 开福区网站建设中餐饮网络营销方案
  • 网站文章页做百度小程序自助建站教程
  • 做旅游的网站的要素wordpress电影主题免费下载
  • 做网站合同封面东莞网站推广优化网上推广公司