This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| using System.Collections.Generic; | |
| using System.IO; | |
| using System.Linq; | |
| using System.Text.Encodings.Web; | |
| using System.Threading.Tasks; | |
| using Microsoft.AspNetCore.Components; | |
| using Microsoft.AspNetCore.Http; | |
| using Microsoft.AspNetCore.Mvc; | |
| using Microsoft.AspNetCore.Mvc.Abstractions; |
When learning OpenGL, one of the most common sources of bugs you'll encounter is from performing OpenGL API calls with invalid arguments, performing them in the wrong order, or performing calls that assume some OpenGL state that differs from the actual state.
With most well-written C# APIs, you'd get an exception thrown the moment you do something you shouldn't. By default, this doesn't happen with OpenGL, but there are still ways to tell if there are errors:
The common way to check for errors is to use GL.GetError() to check for errors, often with a helper method such as the following:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| [1]: Make a flex container so all our items align as necessary | |
| [2]: Prevent items from wrapping | |
| [3]: Automatic overflow means a scroll bar won’t be present if it isn’t needed | |
| [4]: Make it smooth scrolling on iOS devices | |
| [5]: Hide the ugly scrollbars in Edge until the scrollable area is hovered | |
| [6]: Hide the scroll bar in WebKit browsers | |
| */ | |
| .scroll { | |
| display: flex; /* [1] */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public interface IPromiseCallbackHandler | |
| { | |
| void SetResult(string json); | |
| void SetError(string error); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| In this post, .net platform has this pinvoke mechanism where it is allowed that you call into the Native windows . | |
| this is extremely useful when you have some 3rd party libraries or if you try to program against with the low-level windows APIS. | |
| One of the typic application htat utilize the Lowe-level windows apis are those Native win32 applications. Where you creat a message pump with the necessary WNDCLASSEX to represent/register the window message pump and message handler process. What you will deal with the win32 applications include the following. | |
| RegisterClassEx, CreateWindowEx, GetMessage(), TranslateMesage(), and DispatchMessage(...). | |
| to be able to use the Window API, you have to declare tons of Structure and PInvoke Method, while you can find help from the Pinvoke.Net. | |
| First, we will introduce some of the win32/user32 functions and their relative structure definitions. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| using System.Collections.Generic; | |
| using System.IO; | |
| using System.Linq; | |
| using System.Net.Http; | |
| using System.Security.Cryptography; | |
| using System.Security.Cryptography.X509Certificates; | |
| using System.Text; | |
| using System.Threading; | |
| using System.Threading.Tasks; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| using System.Net; | |
| using System.Net.Sockets; | |
| using System.Text; | |
| namespace UDP | |
| { | |
| public class UDPSocket | |
| { | |
| private Socket _socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); |