opentk

How to use GL.Ortho in OpenTK correctly?

混江龙づ霸主 提交于 2019-12-25 07:21:24
问题 I paint some figures using GLControl (OpenTK) in Windows forms. However, the problem is that I cannot figure out, how to use GL.Ortho() method. Here is the code I have written: public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void GlControlPaint(object sender, PaintEventArgs e) { GlControl.MakeCurrent(); GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit); GL.Viewport(150, 150, 300, 300); //GL.Ortho(0, 1, 0, 1, -1, 1); GL.ClearColor

How to make a billboard spherical

♀尐吖头ヾ 提交于 2019-12-25 02:01:23
问题 Following this turorial here I have managed to create a cylindrical billboard (it utilizes a geometry shader which takes points and produces quads). The problem is that when i move the camera so that it's higher than the billboard (using gluLookat) the billboard does not rotate to truly face the camera (as if it was a cylindrical billboard). How do I make it into spherical? if anyone interested, here is slightly modified geometry shader code: #version 330 //based on a great tutorial at http:/

Apply Projection on half of texture

我的梦境 提交于 2019-12-24 06:16:31
问题 I'm using three glcontrols say GlControl1, GlControl2, GlControl3. And I have two textures stexture1 and stexture2. Where stexture1 is displaying in glcontrol2. And right half portion of stexture2 is displaying on glcontrol1 and left half is dispalying on glcontrol3. Now I want to apply projection on these three glcontrols. Using this link I can apply it successfully on glcontrol2 since it is displaying the texture fully. But when applying on glcontrol1 and glcontrol3 it is not working well.

WPF MVVM WinformsHost with OpenGL-Control

不问归期 提交于 2019-12-23 21:05:09
问题 I'm developing a WPF-application with MVVM. In this application I need to have an OpenGL-Control (I'm using OpenTK). The currently only useful way to get OpenGL in WPF is using a WindowsFormsHost. Until here, there's no problem. To add content to my Scene I need access to the OpenGL-Control in my View. Of course I want to add and edit the content in the ViewModel. So, how can I get access to the OpenGL-Control without violating the MVVM-Pattern? I'm using a scene-object which can get

Change the intensity of an image by comparing intensity of another image - OpenTK

孤街浪徒 提交于 2019-12-23 18:09:40
问题 I have two images. I have to found the points of first image which have intensity greater than 0.8. At the same time I have to found the intensity of second image on same points and need to adjust the light on second image on same points with a threshold/slider value(ranges from 0 to 1). I have done like below. Getting black or dark area on points have intensity greater than 0.8. I'm trying with z value of HSV. But instead of this black area I should be able to adjust the light on image2. How

OpenGL Unbind texture

本秂侑毒 提交于 2019-12-23 04:47:15
问题 I have a huge list of 2D Textures that I load each time a map loads (Depending on the map and it's contents). I'm looking for a way to anyhow unbind a bound texture to reduce usage of memory. The bind texture function works perfect just don't see any function to unbind some ids or all of them. 回答1: try glDeleteTextures(1, &texID) This should remove texture from memory. Before that call be sure to unbind currect texture by simply calling: glBindTexture(target, 0) // << default texture object

OpenGL 2.0 Drawing with Monodroid (using OpenTK)

孤人 提交于 2019-12-23 02:36:57
问题 I'm attempting to setup a cross platform application that uses OpenTK-1.0 to draw some basic 3D objects using the programmable pipeline approach in OpenGL ES 2.0. I have the iOS side of the application working perfectly but the Android facing application keeps hitting calling unimplemented OpenGL ES API errors. I believe this is happening because the Android side of the application is not being setup properly to target OpenGL ES 2.0. I've updated the AndroidManifest.xml with the appropriate

Setup of matrix for instance shader

情到浓时终转凉″ 提交于 2019-12-22 06:24:43
问题 I want to draw instanced cubes. I can call GL.DrawArraysInstanced(PrimitiveType.Triangles, 0, 36, 2); successfully. My problem is that all the cubes are drawn at the same position and same rotation. How can i change that individually for every cube? To create different positions and so on, i need a matrix for each cube, right? I created this: Matrix4[] Matrices = new Matrix4[]{ Matrix4.Identity, //do nothing Matrix4.Identity * Matrix4.CreateTranslation(1,0,0) //move a little bit }; GL

C# OpenTK - Textured Quad

只谈情不闲聊 提交于 2019-12-19 04:49:29
问题 I've recently downloaded OpenTK. I've created a basic game class and a quad. I've tried rendering a texture in my quad but it doesn't work. Here's my code. This is the loading of the texture. (The texture class contains just an ID and a Bitmap. The GetWidth() and the GetHeight() just returns the Bitmap.Width and Bitmap.Height). Texture Texture = new Texture (); Texture.Bitmap = new Bitmap (Path); Texture.ID = GL.GenTexture (); GL.BindTexture (TextureTarget.Texture2D, Texture.ID); BitmapData

Open TK difference onRenderFrame and onUpdateFrame?

对着背影说爱祢 提交于 2019-12-14 01:02:22
问题 I am currently programming a Jump n' Run game in C# using OpenTK Framework and OpenGL. Open TK provides preset functions like GameWindow.Run(); or GameWindow.onUpdateFrame(); onRenderFrame(); As far as i thought through it, all actions that draw OpenGL elements or primitives should belong into onRenderFrame, whereas game events like player movement should be performed in onUpdateFrame, so these actions can be calculated in advance before rendering a new frame. Am I right? Would it make a