Jump to content
  • Advertisement

Search the Community

Showing results for tags 'OpenGL'.

The search index is currently processing. Current results may not be complete.


More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Categories

  • Audio
    • Music and Sound FX
  • Business
    • Business and Law
    • Career Development
    • Production and Management
  • Game Design
    • Game Design and Theory
    • Writing for Games
    • UX for Games
  • Industry
    • Interviews
    • Event Coverage
  • Programming
    • Artificial Intelligence
    • General and Gameplay Programming
    • Graphics and GPU Programming
    • Engines and Middleware
    • Math and Physics
    • Networking and Multiplayer
  • Visual Arts
  • Archive

Categories

  • Audio
  • Visual Arts
  • Programming
  • Writing

Categories

  • Game Dev Loadout
  • Game Dev Unchained

Categories

  • Game Developers Conference
    • GDC 2017
    • GDC 2018
  • Power-Up Digital Games Conference
    • PDGC I: Words of Wisdom
    • PDGC II: The Devs Strike Back
    • PDGC III: Syntax Error

Forums

  • Audio
    • Music and Sound FX
  • Business
    • Games Career Development
    • Production and Management
    • Games Business and Law
  • Game Design
    • Game Design and Theory
    • Writing for Games
  • Programming
    • Artificial Intelligence
    • Engines and Middleware
    • General and Gameplay Programming
    • Graphics and GPU Programming
    • Math and Physics
    • Networking and Multiplayer
  • Visual Arts
    • 2D and 3D Art
    • Art Critique and Feedback
  • Community
    • GameDev Challenges
    • GDNet+ Member Forum
    • GDNet Lounge
    • GDNet Comments, Suggestions, and Ideas
    • Coding Horrors
    • Your Announcements
    • Hobby Project Classifieds
    • Indie Showcase
    • Article Writing
  • Affiliates
    • NeHe Productions
    • AngelCode
  • Topical
    • Virtual and Augmented Reality
    • News
  • Workshops
    • C# Workshop
    • CPP Workshop
    • Freehand Drawing Workshop
    • Hands-On Interactive Game Development
    • SICP Workshop
    • XNA 4.0 Workshop
  • Archive
    • Topical
    • Affiliates
    • Contests
    • Technical
  • GameDev Challenges's Topics
  • For Beginners's Forum
  • Unreal Engine Users's Unreal Engine Group Forum
  • Unity Developers's Forum
  • Unity Developers's Asset Share

Calendars

  • Community Calendar
  • Games Industry Events
  • Game Jams
  • GameDev Challenges's Schedule

Blogs

There are no results to display.

There are no results to display.

Product Groups

  • Advertisements
  • GameDev Gear

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


About Me


Website


Role


Twitter


Github


Twitch


Steam

Found 245 results

  1. Hi, I'd like to get & set the OpenGL View Port Matrix but it doesn't work I'm using the "GL_VIEWPORT" parameter any ideas?
  2. Is there a way to set up the projection matrix (in OpenGL) so that the vanishing point is not at the center of the screen? Let me explain what I mean in more detail. Imagine that I am rendering a 3D scene with a standard perspective projection matrix to a 1000x1000 window. There is no camera matrix, so planes of constant z are parallel to the screen, and objects move toward the center of the window as their z coordinate approaches infinity. Now, I want to only render the bottom half of this window. Planes of constant z are still parallel to the screen, but now objects move to a point at the top of the window as their z approaches infinity.
  3. I implemented rotation model for earth. It orbits around me instead it rotates on its center. Some tutorial explains ordering for model is: rotation * translation. I am figuring out but can't find solution yet. It did not work with code because it orbits around me (surface always face me around) instead of rotating its center. prm.dmProj = glm::perspective(cam->getFOV(), double(gl.getWidth()) / double(gl.getHeight()), DIST_NEAR, DIST_FAR); prm.dmView = glm::transpose(glm::toMat4(prm.crot)); // prm.obj.orot = glm::toMat4(body.getRotation(prm.now)); prm.obj.orot = glm::rotate(mat4d_t(1.0), glm::radians(90.0), vec3d_t(0.0, 1.0, 0.0)); prm.dmWorld = prm.dmView * glm::translate(glm::transpose(prm.obj.orot), prm.obj.cpos); prm.mvp = mat4f_t(prm.dmProj * prm.dmWorld); I tried to split dmWorld into dmView and dmModel but it still results the same but earth looks smaller. prm.dmProj = glm::perspective(cam->getFOV(), double(gl.getWidth()) / double(gl.getHeight()), DIST_NEAR, DIST_FAR); prm.dmView = glm::transpose(glm::toMat4(prm.crot)); // prm.obj.orot = glm::toMat4(body.getRotation(prm.now)); prm.obj.orot = glm::rotate(mat4d_t(1.0), glm::radians(90.0), vec3d_t(0.0, 1.0, 0.0)); prm.dmModel = glm::translate(glm::transpose(prm.obj.orot), prm.obj.cpos); prm.mvp = mat4f_t(prm.dmProj * prm.dmView * prm.dmModel); When I tried to rotate full 360 degrees (on Y axis) several times for flat spinning test but... Everything gradually became flat line when rotates away from earth. More spinning = more distorted like flat line effect. After more several times, it became completely horizontal flat line. I tried to rotate on its X axis and it became vertical flat line against earth on right side. I tried barrel roll several times and everything became vertical flat circle (line) on my side of me. Does anyone know any similar problem? // Free travel mode // Update current position and orientation (local reference frame) // Applying angular velocity to rotation quaternion in local space. // // dq/dt = q * w * t/2 // w = (0, x, y, z) // lqrot += lqrot * wv * (dt / 2.0f); lpos -= lqrot * tv * dt; That is my controls from keyboard for angular and travel velocity where prm.crot = lqrot and prm.cpos = lpos, wv = angular velocity and tv = travel velocity (6 DoF controls)
  4. I am having a problem loading DXT5 textures. Everything works fine, unless I use a texture which has a height greater than the width and I enable mipmaps (i.e GL_LINEAR_MIPMAP_LINEAR) The textures are created using Compressonator and the code to load the textures is here: https://github.com/paroj/nv_dds/blob/master/nv_dds.cpp
  5. phil67rpg

    move ship

    I got my ship to rotate about arbitrary axis. my next step is to get it to move up and down depending on which way it is facing. I got it to move up and down but not in the way it is facing after it is rotated. void drawShip() { glPushMatrix(); glColor3f(1.0f, 0.0f, 0.0f); glLoadIdentity(); glTranslatef(50.0f, 0.0f+thrust, 0.0f); glRotatef(shipAngle, 0.0f, 0.0f, 1.0f); glBegin(GL_LINE_LOOP); glVertex3f(0.0f, 0.0f, 0.0f); glVertex3f(-5.0f, -5.0f, 0.0f); glVertex3f(0.0f, 10.0f, 0.0f); glVertex3f(5.0f, -5.0f, 0.0f); glEnd(); glPopMatrix(); }
  6. phil67rpg

    OpenGL rotate ship

    I have a very simple question, I am trying to rotate some vertex's around an arbitrary axis. basically I want to use glRotatef and glTranslatef to rotate a space ship I have drawn on the screen. here is my code of my ship. what it does do is rotate around the origin when I use the arrow keys left and right. void drawShip() { glPushMatrix(); glColor3f(255.0f, 0.0f, 0.0f); glTranslatef(-50.0f, 0.0f, 0.0f); glRotatef(rotateship, 0.0f, 0.0f, 1.0f); glBegin(GL_LINE_LOOP); glVertex3f(50.0f, 0.0f, 0.0f); glVertex3f(45.0f, -5.0f, 0.0f); glVertex3f(50.0f, 10.0f, 0.0f); glVertex3f(55.0f, -5.0f, 0.0f); glEnd(); glTranslatef(50.0f, 0.0f, 0.0f); glPopMatrix(); }
  7. Hello! I am trying to find efficient map-write-discard implementation in OpenGL, but with no luck so far. Following suggestions on this page, I tried both buffer orphaning with glBufferData(NULL) as well as glMapBufferRange(GL_MAP_INVALIDATE_BUFFER_BIT), both with depressing performance (approximately 40x slower than similar implementation in Direct3D). The method should ideally be suitable for OpenGL4.2 / GLES3.0 API, so glBufferStorage is not desirable, though initializing the buffer with glBufferStorage(GL_DYNAMIC_STORAGE_BIT|GL_MAP_WRITE_BIT) makes no difference. As an experiment I also tried mapping with GL_MAP_UNSYNCHRONIZED_BIT flag with no difference either. Various usage hints (I use GL_DYNAMIC_DRAW) also have zero effect as well. In my benchmark I render 32K objects with individual draw calls and map/unmap constant buffer before every call. On my 970GTX, this benchmark runs at ~4 ms/frame in D3D11 mode and 140 ms/frame in OpenGL. Here is what my map/unmap functions look like: void BufferGLImpl :: Map(MAP_TYPE MapType, Uint32 MapFlags, PVoid &pMappedData) { m_uiMapTarget = ( MapType == MAP_READ ) ? GL_COPY_READ_BUFFER : GL_COPY_WRITE_BUFFER; glBindBuffer(m_uiMapTarget, m_GlBuffer); GLbitfield Access = 0; switch(MapType) { case MAP_READ: Access |= GL_MAP_READ_BIT; break; case MAP_WRITE: Access |= GL_MAP_WRITE_BIT; if (MapFlags & MAP_FLAG_DISCARD) { if (m_bUseMapWriteDiscardBugWA) { glBufferData(m_uiMapTarget, m_Desc.uiSizeInBytes, nullptr, m_GLUsageHint); Access |= GL_MAP_WRITE_BIT; } else { Access |= GL_MAP_INVALIDATE_BUFFER_BIT; } } if (MapFlags & MAP_FLAG_DO_NOT_SYNCHRONIZE) { Access |= GL_MAP_UNSYNCHRONIZED_BIT; } break; case MAP_READ_WRITE: Access |= GL_MAP_WRITE_BIT | GL_MAP_READ_BIT; break; } pMappedData = glMapBufferRange(m_uiMapTarget, 0, m_Desc.uiSizeInBytes, Access); glBindBuffer(m_uiMapTarget, 0); } void BufferGLImpl::Unmap() { glBindBuffer(m_uiMapTarget, m_GlBuffer); glUnmapBuffer(m_uiMapTarget); glBindBuffer(m_uiMapTarget, 0); m_uiMapTarget = 0; } Am I doing something obviously wrong here? Is there a clear way to tell OpenGL that I want to discard all previous contents of the buffer?
  8. I have worked on this problem for several days. I have almost solved my problem. I have got my sprite to move up and down continuously using the mouse. this done by using the glutTimerFunc function. I want the mouse to get the sprite to move up and down once. I have googled and debugged my code. I have also taken some JavaScript code and ported it over into opengl. let me know if you need my question to be more specific. here is my code so far. bool onGround = false; void StartJump() { if (onGround) { velocityY = -12.0f; onGround = false; } } void EndJump() { if (velocityY < -6.0f) { velocityY = -6.0f; } } void Update() { velocityY += gravity; positionY += velocityY; positionX += velocityX; if (positionY > 25.0f) { positionY = 0.0f; velocityY = 0.0f; onGround = false; } } void Loop(int val) { Update(); drawSprite(); glutPostRedisplay(); glutTimerFunc(33, Loop, 0); } void mouseClicks(int button, int state, int x, int y) { if (button == GLUT_LEFT_BUTTON && state == GLUT_DOWN) { StartJump(); } if (button == GLUT_LEFT_BUTTON && state == GLUT_UP) { EndJump(); } } void handleKeypress(unsigned char key, int x, int y) { switch (key) { case 27: exit(0); break; case 32: Loop(0); break;
  9. I have been fascinated by programming before 8 years from now. The journey took me from someone who loves to be software engineer to be a networks engineer. I work as full time IP networks engineer. Well, I am a great fun of indie games developers. I have been following Dev-Logs for several indie game developers for a while. In the previous years many ideas of games have been floating in my mind and finally I took the decision to start my own small game project. I have been planning for the last 2 weeks for my game. I have decided to write the whole game and engine myself. My estimations are : Because I am doing this as side project the whole idea ( a 2D platformer ) will take me between 6 months to 1 year. The Game Engine will be developed in parallel with the game I am probably going to Use Java LWJGL or any other OpenGl library I should find a way to target my audience ( probably Youtube channel and dev-logs) Perfectioning the game might have a longer duration than the development of it. I will publish it when it meets the 95% of my expectations If There is any piece of advice of how to start the journey, It will be very helpful. If you have any thoughts about my plan please share it with me. If you have any guidance about how to use this platform I would be more than happy to hear from you. I am just a man who lost his way when making his career related decisions and he is doing a lot of things for fun. Thank you.
  10. Hi, I have interest developing Game Engine.But,you know it is very difficult and sometimes i feel unmotivated.So,I look for programmers who has passion about it.We will learn topics,then talk about them on Discord,so we will help one another and will learn faster.And we can build very good portfolio together.If you are interested pls send mail me => mr.vasifabdullayev@gmail.com
  11. I'm new to graphics and I'm struggling to get the SOIL2 library included. When I run the 'make' command on Mac for use by Xcode I get the following error: Linking soil2-static-lib ar: no archive members specified ... make[1]: *** [../../lib/macosx/libsoil2-debug.a] Error 1 make: *** [soil2-static-lib] Error 2 I'm unsure how to fix this and have been going around in circles for ages! Any help would be appreciated
  12. I am working on my new routines for rendering star (or particle) points (varying size and brightness) for starry sky. It did not work so well because it did not display stars except legacy glVertex calls (or glDrawArrays without GLSL programs). With my GLSL programs, it displayed nothing. I did enabled GL_PROGRAM_POINT_SIZE before glDrawArrays calls. That's why I am developing orbital flight simulator myself for space travels like Orbiter or MS Space Simulator and interstellar travels like Star Trek. Here are my GLSL programs. That should render square points as expected (very simple at this time). It happened nothing. Does anyone have any solution for GLSL 4.x codes for OpenGL core profile 4.x? I googled for particle/star rendering demos and found some sources. But they are using old OpenGL legacy calls or old GLSL codes that may not work with modern OpenGL core 4.x. I found only one source (Gaiasky) that uses newer version core 330 but GLSL codes looks more complex. #version 420 layout (location = 0) in vec3 vPosition; layout (location = 1) in vec4 vColor; layout (location = 2) in float vSize; uniform mat4 mvp; out vec4 starColor; void main() { gl_Position = mvp * vec4(vPosition, 1.0); gl_PointSize = vSize; starColor = vColor; } #version 420 in vec4 starColor; out vec4 fragColor; void main() { fragColor = starColor; }
  13. I'm trying to calculate normals of my grid surface. The map is 29952px x 19968px and each cell is 128px x 128px. So I have 36895 vertices. My flat map array is sent to shaders with the following structure: float vertices[368950] = { // x y z znoise xTex yTex xNorm yNorm zNorm Type 16384,16256,-16256, 0, 0.54, 0.45, 0, 0, 1, 1, 16256,16384,-16384, 0, 0.54, 0.45, 0, 0, 1, 1, ...... } I calculate the zNoise with a function float noise(float x, float y){}; And it works (I add it to y and z in the vertex shader). Method 1 If i calculate normals using finite-difference method i obtain a nice result. Pseudo-Code: vec3 off = vec3(1.0, 1.0, 0.0); float hL = noise(P.xy - off.xz); float hR = noise(P.xy + off.xz); float hD = noise(P.xy - off.zy); float hU = noise(P.xy + off.zy); N.x = hL - hR; N.y = hD - hU; N.z = 2.0; N = normalize(N); But, in the case I need to edit the map manually, for example in a Editor context, where you set the zNoise with a tool to create mountains as you want, this method won't help. I get this nice result (seen from minimap) (Normals are quite dark purposely) Method 2 | | | --6----1----+- |\ |\ | Y | \ | \ | ^ | \ | \ | | | \| \| | --5----+----2-- +-----> X |\ |\ | | \ | \ | | \ | \ | | \| \| --+----4----3-- | | | So i'm trying to calculate the normal using the adjacent triangles, but the result is very different (it seems that there's a bug somewhere): Code: std::array<glm::vec3, 6> getAdjacentVertices(glm::vec2 pos) { std::array<glm::vec3, 6> output; output = { // getVertex is a function that returns a glm::vec3 // with values x, y+znoise, z+znoise getVertex(pos.x, pos.y + 128), // up getVertex(pos.x + 128, pos.y), // right getVertex(pos.x + 128, pos.y - 128), // down-right getVertex(pos.x, pos.y - 128), // down getVertex(pos.x - 128, pos.y), // left getVertex(pos.x - 128, pos.y + 128), // up-left }; return output; } And the last function: glm::vec3 mapgen::updatedNormals(glm::vec2 pos) { bool notBorderLineX = pos.x > 128 && pos.x < 29952 - 128; bool notBorderLineY = pos.y > 128 && pos.y < 19968 - 128; if (notBorderLineX && notBorderLineY) { glm::vec3 a = getVertex(pos.x, pos.y); std::array<glm::vec3, 6> adjVertices = getAdjacentVertices(pos); glm::vec3 sum(0.f); for (int i = 0; i < 6; i++) { int j; (i == 0) ? j = 5 : j = i - 1; glm::vec3 side1 = adjVertices[i] - a; glm::vec3 side2 = adjVertices[j] - a; sum += glm::cross(side1, side2); } return glm::normalize(sum); } else { return glm::vec3(0.3333f); } } I get this bad result (seen from minimap) unfortunately Note: The buildings are in different positions but the surface has the same seed using the two methods. Could anyone help? 🙂 Thanks in advance.
  14. Hello, if I want to load an OBJ model, it does not look like it should. I have created a template that should render a cube, but the result does not look like a cube. Since my project is very extensive I uploaded it to GitHub where everyone can read through the source code the important files are platform/opengl/OpenGLRenderer.cpp and src/renderer/ObjModel.cpp Repo: GitHub.com/Cortablo/Cortablo-Engine I hope you can help me.greetingCortablo
  15. calioranged

    Drawing Circles in OpenGL

    I want to draw a circle in OpenGL. I have looked for examples of how to do this, but the only ones I can find use deprecated functions such as glBegin(), glEnd() and glVertex(). Can somebody provide an example of how this can be done using modern OpenGL? Thanks.
  16. 8Observer8

    C# GUI WPF + OpenGL 3.1

    We will see how to place OpenTK.GLControl on WPF window to make GUI application with 2D/3D graphics using modern OpenGL 3. This is the result VS project: EditedTriangle_WPFOpenGL31CSharp.zip How to create the project from scratch Note 1: RMB - Right Mouse Button click Note 2: Good Color calculator for normalized values: http://doc.instantreality.org/tools/color_calculator/ Create WPF application, with the name "EditedTriangle". See the screenshot: Download OpenTK.GLControl.zip and OpenTK.zip Create the empty "Libs" folder in the solution folder (where the ".sln" is placed) Unzip "OpenTK" and "OpenTK.GLControl" folder in the "Libs" folder Add references to "OpenTK.dll" and "OpenTK.GLControl.dll". For this: RMB on "References" -> select "Add Reference..." -> select "Browse" -> click the "Browse..." button -> select DLL's. See the screenshot with the result: Add "Assemblies". For this: select "Assemblies" -> "Framework" -> check: System.Drawing System.Windows.Forms WindowsFormsIntegration , see the screenshot with the result: Click "OK" button Open the file "MainWindow.xaml" in VS. Add this line as an attribute of the "Window" element: xmlns:opentk="clr-namespace:OpenTK;assembly=OpenTK.GLControl" Place this code inside of <Window></Window> element: <Grid> <DockPanel LastChildFill="True"> <StackPanel DockPanel.Dock="Right"> <Button x:Name="buttonSetBGColor" Content="Set BG Color" Margin="5" Click="buttonSetBGColor_Click"></Button> <Button x:Name="buttonSetTRColor" Content="Set TR Color" Margin="5" Click="buttonSetTRColor_Click"></Button> </StackPanel> <WindowsFormsHost Margin="5" Initialized="WindowsFormsHost_Initialized"> <opentk:GLControl x:Name="glControl" Load="glControl_Load" Paint="glControl_Paint" /> </WindowsFormsHost> </DockPanel> </Grid> Copy the code below to "MainWindow.xaml.cs" and run the project MainWindow.xaml.cs using System; using System.Windows; using OpenTK; using OpenTK.Graphics; using OpenTK.Graphics.OpenGL; namespace Triangle_OpenGL31WPF { /// <summary> /// Interaction logic for MainWindow.xaml /// </summary> public partial class MainWindow : Window { private Utils.ShaderProgram _program; private Matrix4 _projMatrix; private int _startIndex = 0; private int _amountOfVertices = 3; public MainWindow() { InitializeComponent(); } private void WindowsFormsHost_Initialized(object sender, EventArgs e) { glControl.MakeCurrent(); } private void glControl_Load(object sender, EventArgs e) { GL.ClearColor(new Color4(0.631f, 0.6f, 0.227f, 1f)); _program = new Utils.ShaderProgram( "Shaders/vShader.glsl", "Shaders/fShader.glsl"); if (_program.Id == -1) { MessageBox.Show(string.Format("Error: see the file \"{0}\"", Utils.Logger.logFileName)); return; } InitVertexBuffers(); SetTriangleColor(Color4.Red); int uProjMatrix = GL.GetUniformLocation(_program.Id, "uProjMatrix"); if (uProjMatrix < 0) { Utils.Logger.Append("Failed to get uProjMatrix location"); return; } _projMatrix = Matrix4.CreateOrthographicOffCenter(-1f, 1f, -1f, 1f, 1f, -1f); GL.UniformMatrix4(uProjMatrix, false, ref _projMatrix); } private void InitVertexBuffers() { float[] vertices = new float[] { // Triangle 0.0f, 0.5f, // (x, y) -0.5f, -0.5f, 0.5f, -0.5f }; // Create a vertex buffer object int vbo; GL.GenBuffers(1, out vbo); // Bind the VBO to target GL.BindBuffer(BufferTarget.ArrayBuffer, vbo); // Write the data into the VBO GL.BufferData(BufferTarget.ArrayBuffer, vertices.Length * sizeof(float), vertices, BufferUsageHint.StaticDraw); // Get the storage location of the aPosition int aPosition = GL.GetAttribLocation(_program.Id, "aPosition"); if (aPosition < 0) { Utils.Logger.Append("Failed to get the storage location of the aPosition"); return; } // Assign the VBO to aPosition variable GL.VertexAttribPointer(aPosition, 2, VertexAttribPointerType.Float, false, 0, 0); // Enable the assignment GL.EnableVertexAttribArray(aPosition); } private void glControl_Paint(object sender, System.Windows.Forms.PaintEventArgs e) { GL.Viewport(0, 0, glControl.Width, glControl.Height); // Fill a canvas GL.Clear(ClearBufferMask.ColorBufferBit); if (_amountOfVertices > 0) { GL.DrawArrays(PrimitiveType.TriangleStrip, _startIndex, _amountOfVertices); } // Swap the front and back buffers glControl.SwapBuffers(); } private void buttonSetBGColor_Click(object sender, RoutedEventArgs e) { var dialog = new System.Windows.Forms.ColorDialog(); if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK) { float r = dialog.Color.R / 255f; float g = dialog.Color.G / 255f; float b = dialog.Color.B / 255f; GL.ClearColor(new Color4(r, g, b, 1f)); glControl.Invalidate(); } } private void buttonSetTRColor_Click(object sender, RoutedEventArgs e) { var dialog = new System.Windows.Forms.ColorDialog(); if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK) { float r = dialog.Color.R / 255f; float g = dialog.Color.G / 255f; float b = dialog.Color.B / 255f; SetTriangleColor(new Color4(r, g, b, 1f)); glControl.Invalidate(); } } private void SetTriangleColor(Color4 color) { int uTriangleColor = GL.GetUniformLocation(_program.Id, "uTriangleColor"); if (uTriangleColor < 0) { Utils.Logger.Append("Failed to get uTriangleColor location"); return; } Vector3 c = new Vector3(color.R, color.G, color.B); GL.Uniform3(uTriangleColor, ref c); } } } MainWindow.xaml <Window x:Class="Triangle_OpenGL31WPF.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:local="clr-namespace:Triangle_OpenGL31WPF" xmlns:opentk="clr-namespace:OpenTK;assembly=OpenTK.GLControl" mc:Ignorable="d" Title="Triangle" Height="256" Width="290"> <Grid> <DockPanel LastChildFill="True"> <StackPanel DockPanel.Dock="Right"> <Button x:Name="buttonSetBGColor" Content="Set BG Color" Margin="5" Click="buttonSetBGColor_Click"></Button> <Button x:Name="buttonSetTRColor" Content="Set TR Color" Margin="5" Click="buttonSetTRColor_Click"></Button> </StackPanel> <WindowsFormsHost Margin="5" Initialized="WindowsFormsHost_Initialized"> <opentk:GLControl x:Name="glControl" Load="glControl_Load" Paint="glControl_Paint" /> </WindowsFormsHost> </DockPanel> </Grid> </Window>