GithubHelp home page GithubHelp logo

opentk / opentk.net Goto Github PK

View Code? Open in Web Editor NEW
24.0 24.0 33.0 56.27 MB

The OpenTK website

Home Page: https://opentk.net/

License: Creative Commons Attribution 4.0 International

Batchfile 0.06% CSS 99.94%

opentk.net's Introduction

OpenTK

OpenTK is a large project. There are many components to work on, and we'd welcome almost any contribution. The community is friendly, welcoming and always ready to help you get your PRs merged!

We have a very active discord server, if you need help, want to help, or are just curious, come join us!

Discord

The Open Toolkit library is a fast, low-level C# binding for OpenGL, OpenGL ES, OpenAL, and OpenCL. It runs on all major platforms and powers hundreds of apps, games and scientific research.

Use OpenTK to add cross-platform 3d graphics, audio, compute and haptics to your C# application. Integrate it into your existing user interface or use it standalone without any external dependencies.

OpenTK comes with simple and easy to follow tutorials for learning modern OpenGL. These are written by the community and represent all of the best practices to get you started.

Learn how to use OpenTK here: https://github.com/opentk/LearnOpenTK

Older OpenTK 3 tutorials here: https://opentk.net/learn/index.html

Project website: https://opentk.net

Official git repository: https://github.com/opentk/opentk

Build Status

Platform Status
Windows Build status
Mono/Linux Build status

Features

  • Create cutting-edge graphics with OpenGL 4.6 and OpenGL ES 3.0
  • Spice up your GUI with 3d acceleration
  • Improve your code flow with strong types and inline documentation
  • Windowing systems to help get you started
  • Input, and other game essentials.
  • Performant, highly optimized and reliable linear algebra library
  • Write once run everywhere

OpenTK is available for Windows, Linux, Mac OS X, *BSD and SteamOS. It can be used standalone or integrated into a GUI (Windows.Forms, WPF, GTK+, Qt, VTK, ...)

An old, unsupported version of OpenTK 1.0 may be included in the Xamarin Android and iOS distribution. The Xamarin fork is not supported or maintained by this project.

Adding support for mobile again is a future goal of the OpenTK project, but is somewhat frustrated by Apple's deprecation of OpenGL. Contributions to re-add support for these platforms are welcomed.

Instructions

OpenTK is available as a NuGet Package.

As of OpenTK 4.8 "Visual C++ Redistributable 2015" is not longer required to run OpenTK 4 on windows. For earlier versions of OpenTK 4 you can install any version of OpenTK.redist.glfw >= 3.3.8.35 to remove the "Visual C++ Redistributable 2015" requirement. See https://github.com/opentk/glfw-redist for more details.

News

2022-09-24

OpenTK 5.0.0 is still under active development and usage.

Preview releases are running non-trivial applications successfully on .Net 6 across all platforms.

Please drop by the discord for the latest updates!

2020-10-02

OpenTK 4.0.0 is released with full availability.

Key changes:

  • Full support for .Net Core 3.1
  • Brand new GLFW-based windowing system
  • Brand new GLFW-based input system
  • Removed all platform-specific backends (and fixed every xplat bug!)
  • Math library performance improvements and fixes
  • All new OpenAL bindings
  • All new OpenCL Bindings
  • Total restructure of all packages into a modular system with a number of packages. The OpenTK Nuget package is now a metapackage that will automatically download all of these for you.

OpenTK 4.0.0 is entirely MIT licensed.

We're excited to see what you can build with this!

https://www.nuget.org/packages/OpenTK

2020-04-06

Oops! Forgot to update the news! OpenTK 4.0.0 PREVIEW is now available on Nuget.

https://www.nuget.org/packages/OpenTK

2020-04-06

OpenTK 3.2.0 is available.

This adds bindings for the wgl_dx_interop extension and support for joysticks with > 64 buttons.

https://www.nuget.org/packages/OpenTK/3.2.0

2019-08-04

OpenTK 3.1.0 is available.

https://www.nuget.org/packages/OpenTK/3.1.0

https://www.nuget.org/packages/OpenTK.GLControl/3.1.0

2018-10-19

Work is well underway on OpenTK 4.0, which targets .netstandard 2.0.

We would welcome any contributions!

Click here to view the tracking issue.

2018-06-07

OpenTK 3.0.1 is available.

https://www.nuget.org/packages/OpenTK/3.0.1

https://www.nuget.org/packages/OpenTK.GLControl/3.0.1

2018-01-05

OpenTK 3.0.0 is available.

https://www.nuget.org/packages/OpenTK/3.0.0

https://www.nuget.org/packages/OpenTK.GLControl/3.0.0

Building from source

To build OpenTK from source you just need to clone the git repo and open OpenTK.sln in Visual Studio 2019 or later.

git clone https://github.com/opentk/opentk   # Download source code from git
cd opentk                                    # Enter the source directory
# open OpenTK.sln

Alternatively if you want to build using our buildscript you can use build.cmd / build.sh which require .net 6 to be installed.

git clone https://github.com/opentk/opentk   # Download source code from git
cd opentk                                    # Enter the source directory
./build.cmd / ./build.sh                     # Run the build script for your platform

To specify a specific target run:

./build.cmd -t <Target>

Contributing

OpenTK uses and encourages Early Pull Requests. Please don't wait until you're done to open a PR!

  1. Install Git and the .Net Core SDK
  2. Fork OpenTK
  3. Create a branch on your fork.
  4. Add an empty commit to start your work off (and let you open a PR): git commit --allow-empty -m "start of [thing you're working on]"
  5. Open a Pull request with [WIP] in the title. Do this before you actually start working.
  6. Make your commits in small, incremental steps with clear descriptions.
  7. Tag a maintainer when you're done and ask for a review!

Click here for good first issues.

Click here for everything we need help with.

Requirements

  • Windows (7/8,10), Linux, Mac OS X, *BSD, SteamOS, Android or iOS
  • For graphics, OpenGL drivers or a suitable emulator, such as ANGLE
  • For audio, OpenAL drivers or OpenAL Soft
  • To develop desktop applications: Visual Studio, Rider, or the command line tools.
  • To develop Android applications: Visual Studio and Xamarin
  • To develop iOS applications: Visual Studio, Xamarin and XCode

Documentation

API Documentation is available on the official website or inline from favourite IDE.

You can also browse the full API on the official website

Additional information can be found in the OpenTK Manual.

Technical documentation about the implementation of OpenTK can be found in the Technical Wiki.

Need Help?

Come chat with us on Discord.

We're happy to help with anything from learning OpenGL to advanced OpenTK questions.

License

The Open Toolkit is distributed under the permissive MIT/X11 license and is absolutely free.

opentk.net's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

opentk.net's Issues

Tutorial code checks for an empty string

In Chapter 1.2 there is a snippet of code that checks for an empty string

GL.CompileShader(VertexShader);

string infoLogVert = GL.GetShaderInfoLog(VertexShader);
if (infoLogVert != System.String.Empty)
    System.Console.WriteLine(infoLogVert);

GL.CompileShader(FragmentShader);

string infoLogFrag = GL.GetShaderInfoLog(FragmentShader);

if (infoLogFrag != System.String.Empty)
    System.Console.WriteLine(infoLogFrag);

Creating guides and recreating manual from old site

If there is something you want to see included in the guides, let me know.

Also, if you have a resource related to OpenTK (OpenGL, AssImp, OpenCL, OpenAL, Mono...) that you want to see linked on the resources page, drop a link in here!

Mistake in tutorial

I was starting the tutorial and it noticed that at https://opentk.net/learn/chapter1/1-creating-a-window.html#creating-a-window-1, this code snippet is given.

// This line creates a new instance, and wraps the instance in a using statement so it's automatically disposed once we've exited the block.
using (Game game = new Game(800, 600, "LearnOpenTK"))
{
    //Run takes a double, which is how many frames per second it should strive to reach.
    //You can leave that out and it'll just update as fast as the hardware will allow it.
    game.Run(60.0);
}

In reality, game.Run() doesn't accept any arguments in OpenTK 4.7.5, so tutorial must be out of date. I made sure that I was on the 4 switch instead of the 3 switch. It's worth noting that the code-only tutorial on GitHub does not have this problem: https://github.com/opentk/LearnOpenTK/blob/master/Chapter1/1-CreatingAWindow/Program.cs

Useless and slow code example

In Chapter 1.5, we are told to write the pixels from ImageSharp to a byte array.

foreach (Rgba32 p in tempPixels)
{
	pixels.Add(p.R);
	pixels.Add(p.G);
	pixels.Add(p.B);
	pixels.Add(p.A);
}

This is super slow, and the Rgba32 array is already exactly this format. So in fact you can pass tempPixels directly to the GL.TexImage2D call. Maybe a comment explaining the format that TexImage2D needs in case ImageSharp changes in the future.

Typo / consistency in docs for LearnOpenTK/Common

https://github.com/opentk/LearnOpenTK/blob/master/Common/Texture.cs
In the above, there is this line of text:

// The format of the pixels, explained above. Since we loaded the pixels as ARGB earlier, we need to use BGRA.

This is followed by:

GL.TexImage2D(TextureTarget.Texture2D, 0, PixelInternalFormat.Rgba, image.Width, image.Height, 0, PixelFormat.Rgba, PixelType.UnsignedByte, image.Data);

Presumably one of these is wrong, since the comment contradicts the line of code.

Incorrect values for trans matrix in 1.7 Transformations tutorial

In the "In practice" section of the 1.6 Transformations tutorial - https://opentk.net/learn/chapter1/7-transformations.html#in-practice, the trans matrix in the first code box is incorrect. Based on the text description, the x and y values should be 1.0f, not 0.1f, i.e. it should be this:

Matrix4 trans = Matrix4.CreateTranslation(1.0f, 1.0f, 0.0f);

however it is written as this:

Matrix4 trans = Matrix4.CreateTranslation(0.1f, 0.1f, 0.0f);

Getting Started Guide : Hello Triangle incorrect method args type

Description:

In the Getting started guide in the Hello Triangle section , there is an Incorrect arguments type for the OnFramebufferResize method

Current content:

protected override void OnFramebufferResize(ResizeEventArgs e)
{
    base.OnFramebufferResize(e);

    GL.Viewport(0, 0, e.Width, e.Height);
}

https://github.com/opentk/opentk.net/blob/dd939cffe4680dc396b28af2c4c5d58dc222658d/learn/chapter1/2-hello-triangle.md?plain=1#L104C1-L112C1

Expected content:

protected override void OnFramebufferResize(FramebufferResizeEventArgs e)
        {
            base.OnFramebufferResize(e);
            GL.Viewport(0, 0, e.Width, e.Height);

        }

Minor tutorial issues (opentk.net/learn)

I am using VS2022, OpenTK 4, and .NET 6. Here are a few notes on minor issues I've found in the tutorials (opentk.net/learn). If I have time later on, I'll PR the fixes myself, but I thought I'd note them in an Issue as I run through the tutorial myself. (I know shader programming, but new to OpenTK, and also my wife wants to learn this stuff, so I thought I'd preview the material.)

In Shaders it is necessary to mark the shader.vert and shader.frag files as content to copy to the output directory, otherwise the File.ReadAllText calls in the Shader class constructor will fail. This is done by altering the Copy to Output Directory file property to Copy always:

image

In Compiling the Shaders, you can't use out int success twice within the same method; I used out int vertOk and out int fragOk (and similarly, later on, out int linkOk):

GL.GetShader(VertexShader, ShaderParameter.CompileStatus, out int success);
// snip
GL.GetShader(FragmentShader, ShaderParameter.CompileStatus, out int success);

In Linking Vertex Attributes it may be useful to note that the reader shouldn't add any of the code to their program. How to add that to the program is covered in the following Vertex Array Object section.

In Element Buffer Objects the reader is told, "in OnLoad, below where you initialize the VertexBufferObject, we initialize the ElementBufferObject" however, per the highlighted note which follows (element array buffer can only be bound if there is a VAO bound), that code should actually be added after the VertexArrayObject initialization, not the VertexBufferObject. If the code is written as instructed, the program throws a System.AccessViolation exception.

In Uniforms, the _shader field name is inconsistent with earlier sections; it should be shader without the leading underscore. Additionally earlier sections defined the Handle field in the Shader class as int Handle; which defaults to private scoping; it needs to be explicitly declared as public. Finally, it may be helpful to explicitly instruct the reader to add a new class-level field as Stopwatch timer = new(); and it is then necessary to call timer.Start(); in the constructor, otherwise the elapsed time is always zero and the color will not change.

If I notice anything else when I have time to get back to this, I'll add more posts.

Overall, very clear though!

Make OpenTK 4 tutorial tabs the default

At the moment the OpenTK 3 code tabs are selected by default, as OpenTK 4 is the "current" version of OpenTK we should default to having those show first.

If this is done by simply changing the order of the tabs or finding some way to set the default tab in docfx is undecided.

Hello Triangle Tutorial broken link.

Towards the bottom of the "Hello Triangle" page there is a broken link to the corresponding example repository page:
"The source code for the complete program can be found here"

It currently is:

https://github.com/opentk/LearnOpenTK/tree/master/Chapter%201/2%20-%20Hello%20Triangle`

It should be:

https://github.com/opentk/LearnOpenTK/tree/master/Chapter1/2-HelloTriangle

without the %20s (spaces)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.