These are chat archives for opentk/opentk

13th
Jul 2016
Alexander Klingenbeck
@mode777
Jul 13 2016 13:42
Hello everyone, I wonder if this is the right place to post questions but since the message board is overrun by spammers, this seems like the most active option: I recently tried the the ogl android template bundled with vs2015 and xamarin. I noticed the version of opentk is terribly outdated so I checked out the git repo. I see that there is actually a seperate opentk project for android which will work just fine on android but which I cant use for desktop (and vice versa). So my question is: Are there plans to merge these branches into one universal opentk package or is this going to stay like that? I was hoping to have one common backend for my renderer which wont work as a there a seperate versions of opentk to be referenced
varon
@varon
Jul 13 2016 13:43
Hi @mode777. It's definitely the right place to ask questions!
KlimiCZE
@KlimiCZE
Jul 13 2016 13:43
hi @varon
varon
@varon
Jul 13 2016 13:44
@mode777 I think a recent PR actually introduced this functionality. Check out #391.
Alexander Klingenbeck
@mode777
Jul 13 2016 13:47
Wow nice to see that, this is so active. Opentk seems like a great option for cross platform opengl even more so that xamarin is free now. Good to see that its not as dead as the main page makes it seem. @varon thanks I will check this out.
varon
@varon
Jul 13 2016 13:48
@mode777 Yeah! We're currently working on a totally new website, actually.
As soon as @amulware merges my PR and swaps a logo out, we'll be good to go.
KlimiCZE
@KlimiCZE
Jul 13 2016 13:51
@varon what url of site will be?
it will be that on github?
varon
@varon
Jul 13 2016 13:51
It's a Github pages site. My fork is here: https://varon.github.io/opentk-gitpages/
KlimiCZE
@KlimiCZE
Jul 13 2016 13:52
i saw that... yesterday... they are good
varon
@varon
Jul 13 2016 13:53
When it's up, we'll get it hosted on OpenTK.com, too.
KlimiCZE
@KlimiCZE
Jul 13 2016 13:53
@varon you well know OpenTK ?
varon
@varon
Jul 13 2016 13:53
Well, I'm one of the maintainers, and I'm using it for my own work, so I'd say somewhat.
Alexander Klingenbeck
@mode777
Jul 13 2016 13:53
#391 seems to be merged opentk:develop already so this should be the version I built my assemlies from. But the main project opentk does not contain the android namespace for instance and the android assemly wontbwork on desktop. Am I missing something?
varon
@varon
Jul 13 2016 13:54
Yep, @mode777. Basically, the actual NuGet packages, and even the pre-release don't yet include that.
So you'll probably have to build from source.
KlimiCZE
@KlimiCZE
Jul 13 2016 13:55
Can you help me With GL.TexImage2D ?
varon
@varon
Jul 13 2016 13:55
Where are you having trouble?
Alexander Klingenbeck
@mode777
Jul 13 2016 13:55
@varon thats what i did. Built from Opentk:develop but I 'll double check..
KlimiCZE
@KlimiCZE
Jul 13 2016 13:55
I am not using System.drawing
i am using imageprocessor for loading image
and in that method i am giving Pixel array to it
varon
@varon
Jul 13 2016 13:56
@mode777 Hmhrmhrm... Checked the namespaces added in the PR?
KlimiCZE
@KlimiCZE
Jul 13 2016 13:57
varon
@varon
Jul 13 2016 13:59
It's probably an image format issue, klimi.
KlimiCZE
@KlimiCZE
Jul 13 2016 13:59
in that library?
@varon Can i do it other way?
varon
@varon
Jul 13 2016 14:01
There's basically three things that could be going wrong, I suspect:
a) You're loading it in with the wrong format or something (which is scrambling the data)
b) The way you're extracting it from the image might be off
c) the declared OpenGL format doesn't match the loaded format or extracted format.
Can you show me the code you're using?
KlimiCZE
@KlimiCZE
Jul 13 2016 14:01
sure
code with loading image?
Alexander Klingenbeck
@mode777
Jul 13 2016 14:02
@varon I will thanks! @KlimiCZE what did you use to load the bitmap I used to use System.Drawing.Bitmap but this doesnt seem to be avilable for android.
KlimiCZE
@KlimiCZE
Jul 13 2016 14:02
i am using imageprocessor
it is crossplatform
based on .Net Core
@varon What part of code u want?
Alexander Klingenbeck
@mode777
Jul 13 2016 14:03
Thanks I'll check it out
varon
@varon
Jul 13 2016 14:03
Well, a minimum example would be ideal, @KlimiCZE.
Failing that, the image loading code, and the GL code for starters.
I just want to see if I can spot any obvious errors.
KlimiCZE
@KlimiCZE
Jul 13 2016 14:04
okay
varon
@varon
Jul 13 2016 14:04
Pastebin is probably the best bet for that.
KlimiCZE
@KlimiCZE
Jul 13 2016 14:04
i will upload it on github
varon
@varon
Jul 13 2016 14:04
Ah, perfect.
KlimiCZE
@KlimiCZE
Jul 13 2016 14:05
:)
i dont know how to work with github lol xD
KlimiCZE
@KlimiCZE
Jul 13 2016 14:08
wrong directory yay
KlimiCZE
@KlimiCZE
Jul 13 2016 14:13
maybe it is uploading
Alexander Klingenbeck
@mode777
Jul 13 2016 14:21
@varon you say that starting with this commit I just have to build Opentk.sln to get support for all platforms?
KlimiCZE
@KlimiCZE
Jul 13 2016 14:22
i dont understand
what do you want?
varon
@varon
Jul 13 2016 14:25
That's perfect, @KlimiCZE. Thanks.
I'm just reading through it.
KlimiCZE
@KlimiCZE
Jul 13 2016 14:25
ok
it is in ContentPipe
varon
@varon
Jul 13 2016 14:32
What file type are you trying to load?
Can you try explicitly stating it?
@mode777 , I'm not actually sure. Probably the best option is going to be asking @cra0zy or @xen2 about it.
KlimiCZE
@KlimiCZE
Jul 13 2016 14:32
@varon what?
varon
@varon
Jul 13 2016 14:33
@KlimiCZE The image you're loading, what file type is it? JPG, PNG, GIF, TGA, TIFF?
KlimiCZE
@KlimiCZE
Jul 13 2016 14:33
it is jpg
but output from jpg and png is same
Game.cs
varon
@varon
Jul 13 2016 14:33
Roger.
KlimiCZE
@KlimiCZE
Jul 13 2016 14:34
it is Content/Images/box.jpg
but if you load box.png
it is same
varon
@varon
Jul 13 2016 14:34
Got it.
So, your issue is you're telling OpenGL that the image format is RGB.
KlimiCZE
@KlimiCZE
Jul 13 2016 14:35
ye
ya
varon
@varon
Jul 13 2016 14:35
the actual image format should be RGBA, because
ImageProcessorCore always gives them in that format when you call bitmap.Pixels
KlimiCZE
@KlimiCZE
Jul 13 2016 14:35
because if i call it is rgba it is pretty transparent
i know
try it
it will be transparent
Alexander Klingenbeck
@mode777
Jul 13 2016 14:35
@varon ok I'll do that
KlimiCZE
@KlimiCZE
Jul 13 2016 14:35
but samewith transparency
varon
@varon
Jul 13 2016 14:36
Set PixelInternalFormat.RGB
without the 'a'.
KlimiCZE
@KlimiCZE
Jul 13 2016 14:36
?
varon
@varon
Jul 13 2016 14:36
GL.TexImage2D(TextureTarget.Texture2D, 0,
                PixelInternalFormat.Rgb,
                bitmap.Width, bitmap.Height, 0,
                OpenTK.Graphics.OpenGL.PixelFormat.Rgba,
PixelType.UnsignedByte, bitmap.Pixels);
try that.
KlimiCZE
@KlimiCZE
Jul 13 2016 14:37
that was mine first code
updated to rgb
uploading image
varon
@varon
Jul 13 2016 14:41
And that's with the exact line?
KlimiCZE
@KlimiCZE
Jul 13 2016 14:41
i think
varon
@varon
Jul 13 2016 14:41
Try copy paste, if you still get the same error I'll be surprised.
KlimiCZE
@KlimiCZE
Jul 13 2016 14:41
no
not same
varon
@varon
Jul 13 2016 14:44
That's really odd... We've at least established it's a format issue. Can you try do the same thing with System.Drawing and see if you get the same issue?
KlimiCZE
@KlimiCZE
Jul 13 2016 14:44
ohhh
i dont have that library
i must create new project
varon
@varon
Jul 13 2016 14:45
Yeah, but at least you'll be able to narrow if it's your ImageProcessorCore code or what this way.
KlimiCZE
@KlimiCZE
Jul 13 2016 14:53
oh...
OpenTK for .net 46 doesnt have primitive type
@varon done
varon
@varon
Jul 13 2016 15:10
Did it work, Klimi?
KlimiCZE
@KlimiCZE
Jul 13 2016 15:38
yeah
but problem
i need to work with imageprocessor
Alexander Klingenbeck
@mode777
Jul 13 2016 15:46
@KlimiCZE imageprocessorcore seems to be in very early stages isn't it? JimBobSquarePants/ImageProcessor#402. Aren't there any other ways to load Textures in a cross fashion way. It just boils down to decode an image and get some pixel data out of it which you can push to opengl. There must be an alternative...?
KlimiCZE
@KlimiCZE
Jul 13 2016 15:49
i want to load picture
thats all
and work with that
Mark Clark
@daerogami
Jul 13 2016 16:01
@varon Do you know where we left off on the website status? I recall there being talk of moving to github pages or something similar.
varon
@varon
Jul 13 2016 16:01
If you scroll up a bit you'll find some status. Current design is here: https://varon.github.io/opentk-gitpages/
We're basically ready, just waiting for @amulware to get the thing up for us.
KlimiCZE
@KlimiCZE
Jul 13 2016 16:02
@varon any idea?
varon
@varon
Jul 13 2016 16:02
@KlimiCZE I'm just using System.Drawing, as I'm on the desktop and my image loading requirements aren't crazy.
KlimiCZE
@KlimiCZE
Jul 13 2016 16:03
but i need to work with .net core
@varon any non System.Drawing idea?
varon
@varon
Jul 13 2016 16:05
My suggestion isn't to use System.Drawing, but it's to check if it WORKS as expected.
if we know System.Drawing is working, then the bug must like with ImageProcessorCore
Which gives us a more clear direction to try and figure out what's going wrong.
KlimiCZE
@KlimiCZE
Jul 13 2016 16:05
but it doesnt have to be bug
okay
Alexander Klingenbeck
@mode777
Jul 13 2016 16:05
@varon: Just to wrap things up. I had a look at the Repo. OpenTK.Android is different from the main OpenTK Project. Mostly it relies on some mono.android libs e.g. mono.android.drawing instead of system.drawing. It also seems to be some sort of xamarin assembly, but I have zero experience with xamarin and dont know the differences.
varon
@varon
Jul 13 2016 16:06
@mode777 IIRC, there's an ancient Android branch, I don't think that has any relation to the newly merged PR.
Alexander Klingenbeck
@mode777
Jul 13 2016 16:07
I'm basically having the same problem as Klimi, system.drawing.imaging is not available on android. @KlimiCZE : What is your target platform? Android seems to have it's own Bitmap class for example.. Maybe you just need to handle some things platform specific
KlimiCZE
@KlimiCZE
Jul 13 2016 16:09
linux windows mac
main linux and windows
-> .net Core
Alexander Klingenbeck
@mode777
Jul 13 2016 16:09
why net core? system.drawing.imaging works flawless on windows and linux. I did it for my project
varon
@varon
Jul 13 2016 16:09
If I can suggest, why are you using dot net core anyway? Does it really offer much advantage on those platforms? It's still very immature at the moment.
KlimiCZE
@KlimiCZE
Jul 13 2016 16:10
system.drawing for linux? only with mono
varon
@varon
Jul 13 2016 16:10
System.Drawing works fine on my Mac/mono, even.
KlimiCZE
@KlimiCZE
Jul 13 2016 16:11
but i want .net core
Alexander Klingenbeck
@mode777
Jul 13 2016 16:11
@varon : I'm talking about Opentk.Android.sln it seems to have the same codebase as the Opentk.sln except for the differences I mentioned (and not having platform classes for x86 systems, as these are missing the android classes)
KlimiCZE
@KlimiCZE
Jul 13 2016 16:11
no mono
i had problems with mono
Alexander Klingenbeck
@mode777
Jul 13 2016 16:12
I'm guessing you will have even more problems with .net core
KlimiCZE
@KlimiCZE
Jul 13 2016 16:14
hm
varon
@varon
Jul 13 2016 16:14
@mode777 Yeah. both projects include the same files.
What exactly is the difficulty, though? Where are you running into trouble?
My approach would be to do the same thing as they've done at your project level.
Create a second project for YourApp.Android
and reference the different DLL there.
you should still get a large amount of code sharing.
KlimiCZE
@KlimiCZE
Jul 13 2016 16:17
@varon so use mono? :C
Alexander Klingenbeck
@mode777
Jul 13 2016 16:18
@varon well I tried importing the platform classes for android into the main project. I will then need to include mono.android, which will then clash with system.drawing types - You might kind of see the problem here. Probably there are a lot of more problems comming up - so this is not going anywhere right now.
varon
@varon
Jul 13 2016 16:18
@KlimiCZE I'd advise it. Mono is actually pretty solid. It's come a long way since it first started. You can always move to .Net core later.
Ah, right, I understand now, @mode777.
Alexander Klingenbeck
@mode777
Jul 13 2016 16:18
@varon thats exactly what i've done so far.
KlimiCZE
@KlimiCZE
Jul 13 2016 16:19
okay @varon thanks for your time
varon
@varon
Jul 13 2016 16:19
No problem, @KlimiCZE!
KlimiCZE
@KlimiCZE
Jul 13 2016 16:19
i am now downloading linux
sooo
problems with luks and lvm xD
varon
@varon
Jul 13 2016 16:19
Wait, why are you downloading linux? If you're on windows at present, just use Dot net 4.6?
you don't need mono for that.
KlimiCZE
@KlimiCZE
Jul 13 2016 16:19
but i want linux
it is fun
Alexander Klingenbeck
@mode777
Jul 13 2016 16:19
That's why I initially asked if this situation is going to change. Probably the best solution would be to split opentk platform specific code into different modules. I think it has been discussed before
KlimiCZE
@KlimiCZE
Jul 13 2016 16:19
and no spy
i was on linux last time
and now i have connected ssd to my laptop so new space for operating system
varon
@varon
Jul 13 2016 16:21
@mode777 Are you referring to splitting the modules in OpenTK or your own project?
Alexander Klingenbeck
@mode777
Jul 13 2016 16:21
@KlimiCZE : I test my projects on both windows and linux(vm) and I can run even without recompiling on mono. Worked with SDL2 and Winforms. Right now I have some problems with the shader but this seems to be a virtualbox graphics driver problem
KlimiCZE
@KlimiCZE
Jul 13 2016 16:22
okay
varon
@varon
Jul 13 2016 16:22
Yeah. my build server compiles on Mono on linux, I can run it on both windows and OSX, too. The cross-platform is very solid.
KlimiCZE
@KlimiCZE
Jul 13 2016 16:22
sooo
Alexander Klingenbeck
@mode777
Jul 13 2016 16:22
@varon: I'm splitting them for my own project for now. But I was asking if there where future plans to do so for opentk
KlimiCZE
@KlimiCZE
Jul 13 2016 16:22
use mono?
and net 46?
varon
@varon
Jul 13 2016 16:23
@mode777 Yeah. I'm strongly in favour of splitting it up. Stuff like OpenTK.Math could probably live in a nice PCL.
See #411
Mark Clark
@daerogami
Jul 13 2016 16:23
@varon I forked your opentk-gitpages project, will github.io run the fork or does that only work for repo owners?
varon
@varon
Jul 13 2016 16:24
Nope, it should run totally fine for the fork, too.
Mark Clark
@daerogami
Jul 13 2016 16:25
:/ im doing something wrong then, ill keep digging, if I still cant get it i may poke you again
you can see amulware's fork here, for example.
Alexander Klingenbeck
@mode777
Jul 13 2016 16:27
@varon Seems like the reasonable thing to do. Would be glad to help but I'm inexperienced with the project and sadly also the github workflow
varon
@varon
Jul 13 2016 16:27
Ah, right, I remember. @daerogami - You'll probably need to turn it on in the repo settings.
@mode777 Yeah. The current OpenTK structure is pretty crazy (at present), so making it easy for new people to contribute is one of my major goals here.
@mode777 feel free to clone that fork and try build it locally. You should be able to just call ./build.cmd NuGet
Your thoughts on that process alone would be useful enough.
Alexander Klingenbeck
@mode777
Jul 13 2016 16:31
@varon : What do you think about the system.drawing classes like Color, Point, Rectangle etc.. Seems like they are really in there for convenience, yet they already are a major headache for me. Not only does mono.android have its own partial implementation, but the Opentk.android Project does for example has it's own Color implementation which is missing in the normal Project. Maybe Opentk should bring it's own?
varon
@varon
Jul 13 2016 16:32
OpenTK does bring it's own, largely.
Color4, Vector, etc.
I think we also have Box2D to replace rectangle, too.
Alexander Klingenbeck
@mode777
Jul 13 2016 16:33
@varon : I already did, for now I'll live with the two seperate dlls I built from it. Regarding the classes: My solution was, so just avoid using these overloads altogether
varon
@varon
Jul 13 2016 16:34
Yeah. that's the suggested approach.
Mark Clark
@daerogami
Jul 13 2016 16:53
got it, apparently you have to push to force a build. solution found here http://stackoverflow.com/questions/8587321/are-github-pages-created-automatically-in-the-fork-of-a-repo-which-has-a-gh-page should anyone else run into the issue
Alexander Klingenbeck
@mode777
Jul 13 2016 17:10
Another question (sorry for spamming): Do I have to call GL.GetError manually and throw an exception or will OpenTK do it for me?
Mark Clark
@daerogami
Jul 13 2016 17:20
@mode777 Last time I checked you need to handle OpenGL errors (I would get confirmation from someone more experienced). This post should give an example http://www.opentk.com/node/1040
varon
@varon
Jul 13 2016 17:21
@mode777 Manually. It mimics the C API, and the error checking would add way too much overhead.
I'd advise wrapping calls to GL.GetError in a conditional void method for C#.
Alexander Klingenbeck
@mode777
Jul 13 2016 17:23
Ok thx. I thought so, just wanted to make sure. Actually I was calling this at the end of my draw callback and throwing an exception if it returend anything other than NoError, but I never got any so I started to get suspicious
Alexander Klingenbeck
@mode777
Jul 13 2016 18:37
Anyone got experience with android? I'm getting 07-13 20:33:48.997 D/Mono (25980): Searching for 'glCompileShader'. 07-13 20:33:48.997 E/libEGL (25980): called unimplemented OpenGL ES API on both the emulator and my Galaxy S3 mini which has ES2 support. Any ideas?
KlimiCZE
@KlimiCZE
Jul 13 2016 18:43
OpenTK is old ? OpenTK.next is new?
Alexander Klingenbeck
@mode777
Jul 13 2016 18:50
Alexander Klingenbeck
@mode777
Jul 13 2016 19:11
Just in case anyone is running into the same problem: AndroidGameView is using ES1 by default to switch to es2 I called:
            var v = (AndroidGameView)window;
            v.ContextRenderingApi = OpenTK.Graphics.GLVersion.ES2;
KlimiCZE
@KlimiCZE
Jul 13 2016 19:16
Hello
i am getting uknow error
1>C:\Users\KlimiCZ\Documents\Visual Studio 2015\Projects\FluffyStone\FluffyStone\Game.cs(35,22,35,58): error CS0234: The type or namespace name 'PrimitiveType' does not exist in the namespace 'OpenTK.Graphics.OpenGL' (are you missing an assembly reference?)
Alexander Klingenbeck
@mode777
Jul 13 2016 19:20
I'm guessing you have the assembly. Sometimes it helps to just manually rebuild everything. Maybe do project cleanup first
KlimiCZE
@KlimiCZE
Jul 13 2016 19:20
i have nuget package opentk and opentk.next
Alexander Klingenbeck
@mode777
Jul 13 2016 19:22
You should use either one not both you should uninstall opentk. Also opentk.next failed to reference itself on installation for me. Do you actually have a reference to opentk in your references list?
Mark Clark
@daerogami
Jul 13 2016 19:26
@KlimiCZE I ran into this before. The latest Nuget of OpenTK's GL.DrawElements() is expecting a BeginMode enum in the first param. I think the PrimitiveType enum was depricated. Once again, someone more experienced will need to correct me.
KlimiCZE
@KlimiCZE
Jul 13 2016 19:26
i dont know what to use with it
Alexander Klingenbeck
@mode777
Jul 13 2016 19:37
Doesn't intellisense suggest anything? Most of the time you can just use the All enum when in doubt.
varon
@varon
Jul 13 2016 20:05
Chaps, if you're writing new applications, I'd strongly advise against using immediate mode.
Anything with Begin/End should generally not be used. A good profile to target is 4.1 Core.
Mark Clark
@daerogami
Jul 13 2016 20:07
@varon if you instantiate GameWindow with the later OpenGL versions wont GL throw an error if you try to use immediate mode?
varon
@varon
Jul 13 2016 20:07
It depends on if you're using the core profile or not. I think it defaults to include them.
KlimiCZE
@KlimiCZE
Jul 13 2016 20:07
hmmmm
Mark Clark
@daerogami
Jul 13 2016 20:09
@varon also im about to send a PR your way for the opentk-gitpages project or better yet you can see the new page here https://daerogami.github.io/opentk-gitpages/resources/
varon
@varon
Jul 13 2016 20:09
@daerogami - Could you send it to @amulware ? He's actually the guy doing the website.
Mark Clark
@daerogami
Jul 13 2016 20:09
just notice the CSS isnt working right :/
varon
@varon
Jul 13 2016 20:11
How does CSS work anyway?
Why doesn't the web just offer one nice OpenGL API? :)
Mark Clark
@daerogami
Jul 13 2016 20:12
WebGL
varon
@varon
Jul 13 2016 20:12
Yeah yeah :)
Mark Clark
@daerogami
Jul 13 2016 20:12
Ill do that instead :P
KlimiCZE
@KlimiCZE
Jul 13 2016 20:12
how to draw in immediate mode?
Mark Clark
@daerogami
Jul 13 2016 20:12
dont
KlimiCZE
@KlimiCZE
Jul 13 2016 20:13
so what ? :O
Mark Clark
@daerogami
Jul 13 2016 20:13
OpenGL 4
varon
@varon
Jul 13 2016 20:13
Use modern OpenGL.
KlimiCZE
@KlimiCZE
Jul 13 2016 20:13
...
This is probably the best tutorial out there. It's very good for learning the basics.
KlimiCZE
@KlimiCZE
Jul 13 2016 20:13
but... this supports only modern opengl ?
Mark Clark
@daerogami
Jul 13 2016 20:13
Ive been learning the basics for like... 2 years now. I almost understand something XD
KlimiCZE
@KlimiCZE
Jul 13 2016 20:14
it isnt commatible with older graphic cards?
varon
@varon
Jul 13 2016 20:14
It's 100% compatible, 'modern' openGL is defined as 3.0+.
KlimiCZE
@KlimiCZE
Jul 13 2016 20:14
okaay
...
Alexander Klingenbeck
@mode777
Jul 13 2016 20:14
@KlimiCZE Not much use in learning the old api anymore. Just learn shaders!
KlimiCZE
@KlimiCZE
Jul 13 2016 20:15
hmmm
i am total newbie
Mark Clark
@daerogami
Jul 13 2016 20:16
Dont worry @KlimiCZE , Everyone begins monopoly on the same corner of the board. Some of us just build a house there :P
varon
@varon
Jul 13 2016 20:16
Yeah. Just play with it, you'll get it eventually.
KlimiCZE
@KlimiCZE
Jul 13 2016 20:16
but i cant make the move... only the move
i want some as Love2D
but in C#
rip
varon
@varon
Jul 13 2016 20:16
Urho3D?
KlimiCZE
@KlimiCZE
Jul 13 2016 20:16
O.o
2D
Alexander Klingenbeck
@mode777
Jul 13 2016 20:16
I did love2d for a long time
Urho3D is... 2D as well.
KlimiCZE
@KlimiCZE
Jul 13 2016 20:17
fuuu
Alexander Klingenbeck
@mode777
Jul 13 2016 20:17
It isnt so much different from opengl
KlimiCZE
@KlimiCZE
Jul 13 2016 20:17
why i dont found that
... hm
stay on openTK or ... use that
Alexander Klingenbeck
@mode777
Jul 13 2016 20:17
...well for 2d stuff that is
varon
@varon
Jul 13 2016 20:17
You'll learn a lot more using OpenTK, because it hides nothing from you.
KlimiCZE
@KlimiCZE
Jul 13 2016 20:17
so whats better?
varon
@varon
Jul 13 2016 20:17
It's not really a question of better, they're very different.
Mark Clark
@daerogami
Jul 13 2016 20:18
@varon lies, it hides the illuminati
KlimiCZE
@KlimiCZE
Jul 13 2016 20:18
varon
@varon
Jul 13 2016 20:18
It has C# bindings.
UrhoSharp, I think.
KlimiCZE
@KlimiCZE
Jul 13 2016 20:18
hm
varon
@varon
Jul 13 2016 20:18
OpenTK gives you all the tools with no instruction on how to use them. A framework or game engine (i.e. Unity/Urho/etc.) gives you instructions on how to use them but not all the tools...
KlimiCZE
@KlimiCZE
Jul 13 2016 20:18
i dont know that funkcions
like warrper
i dont know that
varon
@varon
Jul 13 2016 20:19
Exactly.
Alexander Klingenbeck
@mode777
Jul 13 2016 20:19
If you just want to make a game opentk is probably not your best option - use unity or udk4
KlimiCZE
@KlimiCZE
Jul 13 2016 20:19
unity
i hate that think
i used that
varon
@varon
Jul 13 2016 20:19
So do I, but I'd still use it over OpenTK If I needed results on a tight deadline.
OpenTK allows me to preserve my sanity, though.
KlimiCZE
@KlimiCZE
Jul 13 2016 20:20
i am 15years ols
old
i have some time
Here's the Urho3D tutorial.
You could also try MonoGame if you want a bit more abstraction than OpenTK.
KlimiCZE
@KlimiCZE
Jul 13 2016 20:21
monogame
... writing script that display image takes me whole day
withou image!
varon
@varon
Jul 13 2016 20:21
OpenTK is even lower level than MonoGame, by the way.
KlimiCZE
@KlimiCZE
Jul 13 2016 20:21
i know
openTK is only OpenGL with some funcions
fu i dont knowhow to say that in English
... ( i am not native English speaker)
varon
@varon
Jul 13 2016 20:22
It's easy enough to understand. Don't worry.
KlimiCZE
@KlimiCZE
Jul 13 2016 20:22
ye
i want learn that
but i didnt find tutorials
varon
@varon
Jul 13 2016 20:23
Well, the one I linked earlier
varon
@varon
Jul 13 2016 20:23
is perfect for OpenTK. Just change the function names.
Yeah.
KlimiCZE
@KlimiCZE
Jul 13 2016 20:23
but this is C++
?
Alexander Klingenbeck
@mode777
Jul 13 2016 20:23
@KlimiCZE : You can just do normal opengl tutorials, the syntax is almost the same for opentk
varon
@varon
Jul 13 2016 20:23
It doesn't matter. If you see gl_
just replace it with GL.
and you're good to go.
KlimiCZE
@KlimiCZE
Jul 13 2016 20:24
ohhh
if i know that earlier...
my life is now better!
// Define the function's prototype
typedef void (GL_GENBUFFERS) (GLsizei, GLuint);
// Find the function and assign it to a function pointer
GL_GENBUFFERS glGenBuffers = (GL_GENBUFFERS)wglGetProcAddress("glGenBuffers");
// Function can now be called as normal
GLuint buffer;
glGenBuffers(1, &buffer);
This will be GL.GenBuffers?
Mark Clark
@daerogami
Jul 13 2016 20:25
I think hes got it
varon
@varon
Jul 13 2016 20:25
Yep.
Mark Clark
@daerogami
Jul 13 2016 20:25
weve created a monster :O
varon
@varon
Jul 13 2016 20:25
It's actually even simpler. GL.GenBuffer() should work.
KlimiCZE
@KlimiCZE
Jul 13 2016 20:25
Pizza! i want pizza
Alexander Klingenbeck
@mode777
Jul 13 2016 20:25
Correct, just type it in visual studio and see what parameters it needs. Most of the time it is easier in c# than in c
KlimiCZE
@KlimiCZE
Jul 13 2016 20:25
and cafe
and energy :sleeping:
how to paste code?
i want it will be black backgroud ( in this chat )
Mark Clark
@daerogami
Jul 13 2016 20:27
use pastebin dont post code directly
varon
@varon
Jul 13 2016 20:27
If it's a snippet, you can use a backtick (`) on either side.
KlimiCZE
@KlimiCZE
Jul 13 2016 20:27

int main()
{
glfwInit();
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
glfwWindowHint(GLFW_RESIZABLE, GL_FALSE);

return 0;

}

so if i understand
this isnt anything i would have to take a part
varon
@varon
Jul 13 2016 20:28
You can do all of that in OpenTK by just extending GameWindow.
KlimiCZE
@KlimiCZE
Jul 13 2016 20:28
GLFWwindow* window = glfwCreateWindow(800, 600, "LearnOpenGL", nullptr, nullptr);
this is in C++
varon
@varon
Jul 13 2016 20:28
Yes. That's windowing code.
KlimiCZE
@KlimiCZE
Jul 13 2016 20:28
yeah
i think i wouldn't do it
varon
@varon
Jul 13 2016 20:29
Here's an old window creation sample: http://www.opentk.com/doc/chapter/0
try that to get a window up and running, then start with the actual OpenGL code from the tutorial I linked.
KlimiCZE
@KlimiCZE
Jul 13 2016 20:29
i know basic
and drawing in primitivemod
mode
varon
@varon
Jul 13 2016 20:30
Well, keep whatever you're doing to create the window, and just swap the code out for the modern OpenGL stuff.
KlimiCZE
@KlimiCZE
Jul 13 2016 20:30
okay
thank you guys
(maybe i am typing some shits... i am tired... really tired)
Mark Clark
@daerogami
Jul 13 2016 20:31
KlimiCZE
@KlimiCZE
Jul 13 2016 20:31
@daerogamit this is perfect
Mark Clark
@daerogami
Jul 13 2016 20:32
well, its ok, i still need to scour the internet for tutorials and populate the data set along with the versions they correspond to
varon
@varon
Jul 13 2016 20:33
Ah, right. I should mention that we're planning to take down the old website, so any tutorial links to that are... troublesome.
Probably the thing we most need is some basic windowing guide
Then 'how to use a C++ openGL tutorial guide'.
Then a link to the modern GL tutorial.
KlimiCZE
@KlimiCZE
Jul 13 2016 20:33
this will be nice
Thank you guys
Mark Clark
@daerogami
Jul 13 2016 20:34
Well, I intended on pulling all of the resources hosted on that site then finding a new hosting solution for them (since we dont want to pile on a bunch of junk to the new site) whereas any projects that have an external link can just be updated
KlimiCZE
@KlimiCZE
Jul 13 2016 20:35
@varon and what is that?
glfwPollEvents();
varon
@varon
Jul 13 2016 20:35
@KlimiCZE That probably reads input from your keyboard, I'd imagine. I'd skip that entire tutorial, FYI.
Alexander Klingenbeck
@mode777
Jul 13 2016 20:36
@daerogami Will the ressources on the old site by salvaged? The guides there helped me a lot
varon
@varon
Jul 13 2016 20:36
@mode777 Lol? They did? Which ones?
Mark Clark
@daerogami
Jul 13 2016 20:36
I will try. @varon what kind of timetable do I have to scour the site?
varon
@varon
Jul 13 2016 20:37
@daerogami Mhrm, basically as soon as we can get the domain pointed correctly, we'll be taking it offline.
KlimiCZE
@KlimiCZE
Jul 13 2016 20:38
why OpenTK and OpenGL use only X and Y range -1 - 1 ?
(-1) - (1 )
Mark Clark
@daerogami
Jul 13 2016 20:38
Would you be willing to send me a snapshot of the site?
Alexander Klingenbeck
@mode777
Jul 13 2016 20:38
@varon: glControl guides, texture loading, integrating in sdl2 and especially vbos @KlimiCZE : OpenGl always needs a context, glfw can do that for you but opentk can do that too
varon
@varon
Jul 13 2016 20:38
I don't have access to the server at the moment, @daerogami. I think there was a PDF floating around, though that someone made.
KlimiCZE
@KlimiCZE
Jul 13 2016 20:38
@varon but why it isnt on pixels?
varon
@varon
Jul 13 2016 20:39
Because "pixels" are only a thing at the final, final step of the renderer, when it rasterizes.
KlimiCZE
@KlimiCZE
Jul 13 2016 20:40
so there isn!t pixels?
Alexander Klingenbeck
@mode777
Jul 13 2016 20:40
@KlimiCZE: You can make a projection for this, to convert it to pixel coordinates, this only makes sense for 2d games though
KlimiCZE
@KlimiCZE
Jul 13 2016 20:40
so why is window creating with pixels?
okay
varon
@varon
Jul 13 2016 20:40
Because that tells OpenGL how the last step in the pipeline works.
KlimiCZE
@KlimiCZE
Jul 13 2016 20:40
ehm
okay
varon
@varon
Jul 13 2016 20:41
Basically, Klimi, OpenGL works on shapes in 3D space. It's all maths and numbers.
Alexander Klingenbeck
@mode777
Jul 13 2016 20:41
@KlimiCZE : It makes sense, so you can have different resolutions for your game and it will still look the same
KlimiCZE
@KlimiCZE
Jul 13 2016 20:41
so your advice is to learn from that sites and use shaders?
varon
@varon
Jul 13 2016 20:41
Definitely.
Shaders are the most amazing thing in Graphics programming today!
KlimiCZE
@KlimiCZE
Jul 13 2016 20:41
i know shaders only from Minecraft xD
and if iwant to use modern i would use using OpenTK.Graphics.OpenGL4; ?
or just using OpenTK.Graphics.OpenGL; with shaders?
varon
@varon
Jul 13 2016 20:42
OpenTK.Graphics.OpenGL4 is the right namespace to use.
KlimiCZE
@KlimiCZE
Jul 13 2016 20:43
oh
okay
i used openGL
Alexander Klingenbeck
@mode777
Jul 13 2016 20:43
@varon : If you want to run on android you should use OpenTK.Graphics.ES20
KlimiCZE
@KlimiCZE
Jul 13 2016 20:43
oh okay
Alexander Klingenbeck
@mode777
Jul 13 2016 20:43
sorry i meant @KlimiCZE
KlimiCZE
@KlimiCZE
Jul 13 2016 20:44
glUseProgram(shaderProgram); ...
varon
@varon
Jul 13 2016 20:45
GL.UseProgram(shaderProgram)
KlimiCZE
@KlimiCZE
Jul 13 2016 20:45
i see
┬┤this is what i want?┬┤
varon
@varon
Jul 13 2016 20:45
other direction symbol: `
Alexander Klingenbeck
@mode777
Jul 13 2016 20:45
http://www.opengl-tutorial.org/ this is also a good tutorial
KlimiCZE
@KlimiCZE
Jul 13 2016 20:45
what is tha symbol?
KlimiCZE
@KlimiCZE
Jul 13 2016 20:46
test
yeah
ty
Alexander Klingenbeck
@mode777
Jul 13 2016 20:47
BTW: Anyone got an idea how to handle multiple lights in a shader?
varon
@varon
Jul 13 2016 20:47
Yeah, I do, @mode777.
Important questions: How many lights, what are you drawing, etc?
Alexander Klingenbeck
@mode777
Jul 13 2016 20:47
Thats the point- do I have to know?
KlimiCZE
@KlimiCZE
Jul 13 2016 20:47
shaders... i will look at that tommorow
but for loading images no shaders right?
varon
@varon
Jul 13 2016 20:48
You'll need shaders to draw anything.
Alexander Klingenbeck
@mode777
Jul 13 2016 20:48
@KlimiCZE : You will need a shader to see ANYTHING
varon
@varon
Jul 13 2016 20:48
@mode777 - Yeah, you kinda need some estimates.
Alexander Klingenbeck
@mode777
Jul 13 2016 20:48
But no to load textures you wont
varon
@varon
Jul 13 2016 20:48
What kind of game/visualization are you making?
KlimiCZE
@KlimiCZE
Jul 13 2016 20:49
2D RPG
i wanted 2d rpg with multyplayer.. i didnt found any so i will create my own xD
varon
@varon
Jul 13 2016 20:49
And you, @mode777 ?
Alexander Klingenbeck
@mode777
Jul 13 2016 20:49
@varon : A simple dungeon crawler. The thing is I dont know how many lights there will be. But I could make an estimate - like not more than 10
varon
@varon
Jul 13 2016 20:50
I suppose I can re-phrase my question - how many lights on a character at once?
or rather, on a rendered object at once.
If it's around 4-6 at max, then I'd suggest just forward rendering, which is still very easy.
Alexander Klingenbeck
@mode777
Jul 13 2016 20:51
Not more than three
varon
@varon
Jul 13 2016 20:51
Ah, okay, then do this: Refactor your lighting code into a function that returns a vec4.
Alexander Klingenbeck
@mode777
Jul 13 2016 20:51
The alternative is deffered shading - right?
varon
@varon
Jul 13 2016 20:51
exactly.
iterate over a fixed size loop (important as it needs to avoid branching)
and add the values together.
Alexander Klingenbeck
@mode777
Jul 13 2016 20:51
Ok thats what I thought
varon
@varon
Jul 13 2016 20:52
For the control code, sort your lights by (distance * intensity), assuming linear falloff
and put the top n lights into your shader.
KlimiCZE
@KlimiCZE
Jul 13 2016 20:52
@varon so if i understand... inside the shader i will load texture?
varon
@varon
Jul 13 2016 20:52
Nope. Shader just draws the loaded texture on your screen.
Alexander Klingenbeck
@mode777
Jul 13 2016 20:52
@KlimiCZE : No the shader will get the texture you bin in opengl
*bind
KlimiCZE
@KlimiCZE
Jul 13 2016 20:53
okay
Mark Clark
@daerogami
Jul 13 2016 20:53
@KlimiCZE @mode777
From my recent revelations on shaders:
Vertex shaders are when you manipulate vertices (a gross over simplification is this is where you move, rotate, skew, ...etc your geometry)
Fragment shaders are for once your geometry exists and you need to apply calculated effects such as light/shadows
@varon you may want to correct any inaccuracies
Alexander Klingenbeck
@mode777
Jul 13 2016 20:54
@varon : Just out of couriosity: What is the deal about defered shading? Will it work in es20?
KlimiCZE
@KlimiCZE
Jul 13 2016 20:55
i dont need light and shadows
varon
@varon
Jul 13 2016 20:55
You can pretty much implement deferred shading in anything with RTT.
Alexander Klingenbeck
@mode777
Jul 13 2016 20:55
RTT?
varon
@varon
Jul 13 2016 20:55
Render to Texture
KlimiCZE
@KlimiCZE
Jul 13 2016 20:55
bye
i will go sleep
Alexander Klingenbeck
@mode777
Jul 13 2016 20:56
bye!
varon
@varon
Jul 13 2016 20:56
@daerogami You're pretty close, but they're a lot more flexible than that. It's really just to do with the different things they do:
Vertex -> Process Point Data
Geometry -> Process primitives
Fragment -> Process fragments (i.e. special sort-of-pixel-things)
Alexander Klingenbeck
@mode777
Jul 13 2016 20:56
@varon : I see so basically its like an after effect like bloom or SSAO.
varon
@varon
Jul 13 2016 20:57
Similar, yeah.
@daerogami You can do a lot of lighting in vertex shaders on mobile, for instance, because they're running once per vertex rather than once per pixel.
You can even do vertex texturing, believe it or not.
Mark Clark
@daerogami
Jul 13 2016 20:58
@varon I've been wondering, why roll one's own shaders. Isn't that kind of reinventing the wheel?
Alexander Klingenbeck
@mode777
Jul 13 2016 20:59
Ok cool, but I think I will stick to forward lightning for now @daerogami : good point I wondered too. Especially vertex shaders are very similar for standart applications
varon
@varon
Jul 13 2016 20:59
Oh, it's very simple. Firstly, layouts are kinda important. You have to make sure the output of Shader A matches the next one in the pipeline. If you used pre-made shaders you'd either have mismatches or be doing unnecessary work.
For instance, if I had a 'standard' vertex shader, I might be computing normals or texture UVs, which could be completely un-needed in my fragment.
Mark Clark
@daerogami
Jul 13 2016 20:59
So it depends on how you abstract your scene?
varon
@varon
Jul 13 2016 21:00
The second and more important part, I suppose, is that shaders are VERY simple and very high level. They're easy to write, and you can get loads of them for subtle differences.
The last point is that with standard shaders, everything looks the same.
Check out every unreal 4 game, for instance.
Because they're using literally the same shader for 95% of things.
Alexander Klingenbeck
@mode777
Jul 13 2016 21:01
Like fixed function
varon
@varon
Jul 13 2016 21:01
Well, it's deferred, physically-based rendering
Unity, Unreal, CryEngine, etc all do it.
Alexander Klingenbeck
@mode777
Jul 13 2016 21:01
Still it would be nice to have a standard shader, like in xna for prototyping
varon
@varon
Jul 13 2016 21:02
Write one! They're trivial.
I'd suggest a half lambert for a prototype shader.
Alexander Klingenbeck
@mode777
Jul 13 2016 21:03
Do you happen to know a tutorial for lambert. The math seems a bit intimidating
varon
@varon
Jul 13 2016 21:03
equation is dot(normal, normalize(lightDir))*0.5 + 0.5
that gives you the intensity.
then you can just multiply it by the light colour and object colour.
Alexander Klingenbeck
@mode777
Jul 13 2016 21:06
Ok, I'm already doing something similar
But I'll have a look, thanks
varon
@varon
Jul 13 2016 21:08
Sure.
Mark Clark
@daerogami
Jul 13 2016 21:08
I just made my first PR!
@varon it is including some of your commits, im not sure why amulware/opentk-gitpages#3
varon
@varon
Jul 13 2016 21:10
Because you forked my repo when you did it. It's no trouble at all. When both are merged there'll be no conflict.
Mark Clark
@daerogami
Jul 13 2016 21:10
what would be the alternative?
varon
@varon
Jul 13 2016 21:10
None, you did 100% the right thing.
Mark Clark
@daerogami
Jul 13 2016 21:11
:+1:
Alexander Klingenbeck
@mode777
Jul 13 2016 21:15
@varon : What do you use for model loading? I'm currently using https://github.com/ChrisJansson/ObjLoader any alternatives/suggestions
varon
@varon
Jul 13 2016 21:15
Ahahahahahahaha
Okay, so, being someone insane, I've written an entire parser for OpenGex.
I haven't open sourced it under the assumption that it's written in purely functional combinatorial parsing F#. (So nobody would be able to contribute anyway)
and it's still a bit rough. But it does work, and I can load in models, animations, scenes, etc.
Alexander Klingenbeck
@mode777
Jul 13 2016 21:17
Ok that just sounds a little obscure ;)
varon
@varon
Jul 13 2016 21:17
Well, yeah. It does work, though.
and it's fully covered by unit tests, too.
But it provides things as F# types, which makes it very hard to use from C#.
I'd consider opening it up if there was sufficient interest
KlimiCZE
@KlimiCZE
Jul 13 2016 21:19
Hello again!
Alexander Klingenbeck
@mode777
Jul 13 2016 21:19
I'd sure be interested but chances are slim I will end up using it :)
varon
@varon
Jul 13 2016 21:19
        /// Takes a parser of a function and a raw value, returns a new parser with the function applied to that value
        let inline (<&>) pF v = pF |>> (fun f -> f v)
It's even documented!
Alexander Klingenbeck
@mode777
Jul 13 2016 21:20
I guess functional languages are really handy for things like parsers
KlimiCZE
@KlimiCZE
Jul 13 2016 21:20
@varon should you send me again that websites? ( On phone lol)
Well, handy for things in general, actually. All of my programming is done from F#.
KlimiCZE
@KlimiCZE
Jul 13 2016 21:22
Thanks
Alexander Klingenbeck
@mode777
Jul 13 2016 21:23
Would be interested to check out a functional language sometimes, but I think I'll tackle OpenGL first
F# sharp is still very niche isn't it? Can you use any .net assembly with out?
*it
varon
@varon
Jul 13 2016 21:26
Let's continue this chat out of here, because it's not really on-topic.
Alexander Klingenbeck
@mode777
Jul 13 2016 21:27
sure
KlimiCZE
@KlimiCZE
Jul 13 2016 21:27
( @varon can you create private chat? , on mobile version isn't that supported)
varon
@varon
Jul 13 2016 21:28
You can on the web GUI. it's just an IRC wrapper, after all.
KlimiCZE
@KlimiCZE
Jul 13 2016 21:29
But i am on mobile
Alexander Klingenbeck
@mode777
Jul 13 2016 21:30
@varon : I think we'll have to postpone it - gf wants to sleep. good night
KlimiCZE
@KlimiCZE
Jul 13 2016 21:31
Ohh so cute
Good night
Alexander Klingenbeck
@mode777
Jul 13 2016 21:32
bye
KlimiCZE
@KlimiCZE
Jul 13 2016 21:33
Bye