如何使用VBO使用OpenGL(特别是LWJGL)绘制一个圆(How to draw a circle with OpenGL(LWJGL specifically) using VBOs)
我目前正在学习LWJGL(LightWeight Java游戏库),OpenGL-Java端口,我正在试图弄清楚如何使用VBO绘制一个圆圈。
当我搜索有关我的问题的代码示例时(我搜索OpenGL b / c,OpenGL和LWJGL的语法非常相似),我发现所有人都使用
glBegin(GL_QUADS)
等等,由于它的差,我不喜欢表现及其不足。 我知道它使用像Math.PI
这样的东西(我采用几何学,数学并不是我认为的难点)。我想知道如何获得从使用
Math.cos
和Math.sin
到VBO中获得的X和Y值,使用glDrawArrays
时b / c,你必须指定顶点的数量。I am currently learning LWJGL(LightWeight Java Game Library), the OpenGL-Java port, and am trying to figure out how to draw a circle using VBOs.
When I search for code samples concerning my problem (I search OpenGL b/c the syntax of OpenGL & LWJGL are quite similar), all I find is people using
glBegin(GL_QUADS)
and such, which I don't like due to its poor performance and its insufficiency. I know it uses thing likeMath.PI
and such(I've taken Geometry, the math is not the hard part in my opinion).I want to know how I would get the X and Y values I receive from using
Math.cos
&Math.sin
into the VBO, b/c when usingglDrawArrays
, you have to specify the number of vertices.
原文:https://stackoverflow.com/questions/23635749
最满意答案
更新您的模式以使用属性,然后只有MVC 模型绑定才有效
public class Testing { public int a = 0; public string name { get; set;} public string age { get; set;} }
Update your mode to use properties, then only MVC model binding will work
public class Testing { public int a = 0; public string name { get; set;} public string age { get; set;} }
相关问答
更多-
看起来你需要在这里稍微移动一下。 我对你想要达到的目标做了一些假设,但是 (Repository.cs) public class AppRespository { private DataContext db = new DataContext(); public IEnumerable
LoadStates() { var query = from d in db.States.ToList() ... -
如上所示: ASP.NET MVC 4 - for循环发布模型集合属性,但foreach没有 MVC助手讨厌foreach循环。 转到for循环,一切都应该正常工作。 编写两个循环并使用Web开发人员工具检查它们,以查看“id”和“name”属性的差异。 As seen on here: ASP.NET MVC 4 - for loop posts model collection properties but foreach does not MVC helpers hate foreach loops. ...
-
那是因为您没有使用包含其属于List的信息的表达式来访问每个CustomerCDTO 。 改为使用for循环: <%for (var i = 0; i < Model.customerCDTO.Count; ++i) 并参考带有表达式的元素 <%=Html.CheckBoxFor(m => m.customerCDTO[i].Active)%> 基本上你需要将表达式m => ...解析为你感兴趣的属性,从m开始,而不是从其他变量开始。 That's because you are not getting ...
-
更新您的模式以使用属性,然后只有MVC 模型绑定才有效 public class Testing { public int a = 0; public string name { get; set;} public string age { get; set;} } Update your mode to use properties, then only MVC model binding will work public class Testing { public ...
-
查看不返回Asp.net MVC中的多个列表[重复](View Not Returning Multiple Lists in Asp.net MVC [duplicate])[2022-06-15]
这是您的ProductsVM : public class ProductsVM { public IList- items { get; set; } public IList
categories { get; set; } } 这是您要发布的操作方法: [HttpPost] public ActionResult Products(ProductsVM model) 当您提交表单时,它将从表单的控件中获取值并使用控件的名称,它会将它们发布到Produc ... - items { get; set; } public IList
-
我会更改您的模型集合以使用能够进行模型绑定的List属性。 举个例子: public List
AllRows { get; set; } 然后将循环更改为此模型绑定器将拾取的循环。 @for (int i = 0; i < Model.AllRows.Count; i++) { ..... @Html.EditorFor(model => Model.AllRows[i].Heading) ..... } ... -
您将需要另一个单独的控制器操作来检查数据存储并返回ContentResult ,该操作将为true或false (或者您想要判断ID是否包含字节的其他字符串),然后在视图中您将需要: if(@Html.Action("action", "controller").ToString().Equals("true", StringComparison.OrdinalIgnoreCase)){ // render image tag with the call to the other action that r ...
-
@Html.HiddenFor呈现一个 。 因此,如果要发布复杂对象,请确保为该对象的所有属性渲染隐藏字段,并将其回发。 我不知道你的Area对象是怎样的,但是沿着这些方向: @model CurrentArea @* post back the properties of CurrentArea.area we are interested in *@ @Html.HiddenFor(m => m.area.Name) @Html.HiddenFor(m = ...
-
ASP.NET MVC jQuery不能访问null模型对象[重复](ASP.NET MVC jQuery not to access null model object [duplicate])[2022-07-06]
在尝试访问其属性之前,必须测试模型对象是否为null。 喜欢这个: var isObjectNotnull = @(Model != null && Model.InnerClass != null); 但是,假设Model.InnerClass不为null,这将呈现如下: var isObjectNotnull = True; 并且您将在javascript中收到以下错误,因为“True”中的mayus“T”字母将使浏览器将其视为变量而不是true关键字: 未捕获的ReferenceError:未定 ... -
MVC模型为null(MVC Model is null)[2022-03-06]
这段代码: @Model.OutputEmail 引用传递给视图的模型实例。 但是, 这段代码: @Html.LabelFor(x => x.OutputEmail) 不引用模型的实际实例。 它反映了模型的类型并生成了针对该类型的标记。 因此,如果您没有将模型传递给视图,那么第一行将失败,因为模型的实例为null ,但第二行将成功,因为模型的类型仍然是已知的。 This code: @Model.OutputEmail references the instance of the model pass ...