opentk

OpenTK matrix transformations

时光总嘲笑我的痴心妄想 提交于 2019-12-04 02:01:58
问题 Here's the vertex shader: uniform mat4 projection; uniform mat4 view; uniform mat4 model; void main(void) { gl_Position = projection * view * model * gl_Vertex; gl_TexCoord[0] = gl_MultiTexCoord0; } My understanding is that using various transformations, the model space is eventually turned to clip space, which is a box bound by each unit in each axis drawn directly to the viewport, i.e. something at (-1, 1,0) is at the top left of the viewport. When I remove all matrix transforms from the

How to join overlapping circles?

不想你离开。 提交于 2019-12-03 07:48:08
问题 I want to visually join two circles that are overlapping so that becomes I already have methods for partial circles, but now I need to know how large the overlapping angle for earch circle is, and I don't know how to do that. Anyone got an Idea? 回答1: Phi= ArcTan[ Sqrt[4 * R^2 - d^2] /d ] HTH! Edit For two different radii: Simplifying a little: Phi= ArcTan[Sqrt[-d^4 -(R1^2 - R2^2)^2 + 2*d^2*(R1^2 + R2^2)]/(d^2 +R1^2 -R2^2)] Edit If you want the angle viewed from the other circle center, just

How to join overlapping circles?

馋奶兔 提交于 2019-12-02 20:31:31
I want to visually join two circles that are overlapping so that becomes I already have methods for partial circles, but now I need to know how large the overlapping angle for earch circle is, and I don't know how to do that. Anyone got an Idea? Phi= ArcTan[ Sqrt[4 * R^2 - d^2] /d ] HTH! Edit For two different radii: Simplifying a little: Phi= ArcTan[Sqrt[-d^4 -(R1^2 - R2^2)^2 + 2*d^2*(R1^2 + R2^2)]/(d^2 +R1^2 -R2^2)] Edit If you want the angle viewed from the other circle center, just exchange R1 by R2 in the last equation. Here is a sample implementation in Mathematica: f[center1_, d_, R1_,

Index Buffer Object and UV Coordinates don't play nice

我与影子孤独终老i 提交于 2019-12-02 09:27:44
This generates the 25 main vertices. For x As Single = -1 To 1 Step 0.5F For y As Single = 1 To -1 Step -0.5F Dim pt1 As New Vector3(x, y, 0) tFloats.Add(pt1) Next Next This is the indices, which makes up 16 tiles made of 32 triangles, I actually generate them but this is the first row: Dim inasd() As Integer = { 0, 2, 10, 2, 10, 12, 10, 12, 20, 12, 20, 22, 20, 22, 30, 22, 30, 32 } Now I'm trying to apply a texture to every single triangle, 1 texture per tile. 16 different textures. Now my problem lies within the fact that when I use GL.DrawRangeElements(PrimitiveType.Triangles, 0, indices

Plot a graph (x = y) in C# using OpenTK?

心已入冬 提交于 2019-12-02 08:52:09
问题 How to plot a simple graph (x=y) in C# using OpenTK ? both at Windws Form Application and at console App ?? What methods do use to plot that graph ?I'm new to this tool so a a good link or toutorial will help me a lot .... 回答1: Hey Carlos Oliveira, Step 1: You should start with this link ( http://www.opentk.com/doc/chapter/0 )[1] Step 2: For a simple x=y graph , copy-paste the code snippet provided in the link[1] and remove the game.RenderFrame part and replace with code snippet pasted just

OpenTK matrix transformations

只谈情不闲聊 提交于 2019-12-01 09:47:25
Here's the vertex shader: uniform mat4 projection; uniform mat4 view; uniform mat4 model; void main(void) { gl_Position = projection * view * model * gl_Vertex; gl_TexCoord[0] = gl_MultiTexCoord0; } My understanding is that using various transformations, the model space is eventually turned to clip space, which is a box bound by each unit in each axis drawn directly to the viewport, i.e. something at (-1, 1,0) is at the top left of the viewport. When I remove all matrix transforms from the shader, gl_Position = gl_Vertex; and pass in, as the model, a simple quad public Vector3[] verts = new

How to project top and bottom area of openGL control

我只是一个虾纸丫 提交于 2019-11-30 09:33:57
问题 Using below code I can display an image in openGL control. Which is in rectangular shape. Now I want to project top and bottom area of this rectangular to a cylindrical shape.I mean need to perform a rectangular to cylidrical projection on openGL. How can I achieve this? private void CreateShaders() { /***********Vert Shader********************/ vertShader = GL.CreateShader(ShaderType.VertexShader); GL.ShaderSource(vertShader, @"attribute vec3 a_position; varying vec2 vTexCoord; void main() {

How to project top and bottom area of openGL control

回眸只為那壹抹淺笑 提交于 2019-11-29 15:55:18
Using below code I can display an image in openGL control. Which is in rectangular shape. Now I want to project top and bottom area of this rectangular to a cylindrical shape.I mean need to perform a rectangular to cylidrical projection on openGL. How can I achieve this? private void CreateShaders() { /***********Vert Shader********************/ vertShader = GL.CreateShader(ShaderType.VertexShader); GL.ShaderSource(vertShader, @"attribute vec3 a_position; varying vec2 vTexCoord; void main() { vTexCoord = (a_position.xy + 1) / 2; gl_Position = vec4(a_position, 1); }"); GL.CompileShader

OpenGL - Rotation not working

半城伤御伤魂 提交于 2019-11-28 02:28:28
Background I currently have an environment I have created to which I load some shapes (for reference to where I am) and am trying to get the controls to move forward, backwards, and rotate where I am looking. I have the forward and backwards worked out using my lookat point and camera position point. I am trying to rotate 360 degrees but appear to get some strange limits based on what I have so far. I am outputting my xangle to see where I am at always.. In order to rotate, I change the lookat variable (x,y, and z) while keeping the position (x,y,z) the same. Problem When continuously

OpenGL - Rotation not working

杀马特。学长 韩版系。学妹 提交于 2019-11-26 23:47:04
问题 Background I currently have an environment I have created to which I load some shapes (for reference to where I am) and am trying to get the controls to move forward, backwards, and rotate where I am looking. I have the forward and backwards worked out using my lookat point and camera position point. I am trying to rotate 360 degrees but appear to get some strange limits based on what I have so far. I am outputting my xangle to see where I am at always.. In order to rotate, I change the