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

抚州建设网站欧洲站vat激活

抚州建设网站,欧洲站vat激活,北京房地产信息网,wordpress 嵌入html1 前言 使用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://www.huolong8.cn/news/44924/

相关文章:

  • 珠海移动网站定制wordpress手机电影
  • 做淘宝客网站难吗网站截图环境 php
  • 万网经常清空网站电子商务网站规划设计方案
  • wordpress采集接口温州seo排名公司
  • 盘锦市网站建设深圳网站建设外贸
  • 优秀网站开发公司网站备案麻烦
  • 精品网站建设费用网站地图作用
  • 怎么建立自己的网站域名荣茂网站建设
  • 京东网站的设计特点高并发系统架构
  • 建设高端网站的公司自己的公网ip可以做网站
  • 一般企业网站3年多少钱网站内容建设的原则
  • 各大网站热搜榜排名网络营销研究现状文献综述
  • 如何做网站展示商品福建建设银行官方网站
  • 摄影网站哪个最好网站建设 总结
  • 青岛网站建设加王道下拉wordpress付费下载主题
  • 网站构建的工作石家庄快速网站搭建
  • 厦门网站建设案例公司企业网站建设方案
  • 自己建设的网站怎么上传图片软件项目交易平台
  • 网站建设信息科技公司织梦做商城类网站好做吗
  • 正规的网站建设请描述网站开发的一般流程
  • 快注销网站甘肃兰州天气预报
  • 厦门建设局网站韩国美食网站建设目的
  • 热 网站正在建设中免费的编程自学网站
  • 找公司做网站需要注意wordpress同步至订阅号
  • 网站制作教程及流程找做玻璃的网站
  • 第二章营销型网站建设测验安庆经济开发区人才网
  • 浙江省建设厅新网站人员无法查询千海网站建设 小程序
  • )网站开发架构师哪个网站可以找到毕业设计
  • 汽车网站更新怎么做常州高端网站建设
  • 深圳外贸网站制作价格网站上文章加入音乐是怎么做的