Closed Planet99 closed 6 years ago
BTW - Even in the POC app, 441x246 is the value of the Forms displayRect property
GlControl does not call glViewport, do you? The default viewport is the framebuffer size on which the GL context is created.
Or maybe the WPF hosting control is not resizing the GlControl instance.
No but I am doing the math myself and as said the POC works well. It does appear there is some kind of resizing issue but I don't know where.
That property displayRect is on the forms scroll control and I think that may be affecting this. I am not using any scrolling though.
It is very very strange that those numbers (441,246) are the numbers in your GlControl.Designer.cs file. During resize something is not being handled correctly somewhere.
I'll get back to it at some point and let you know anything I find.
Thanks
OK. I am new to GL and trying to go modern all the way. Since we are doing all the matrix stuff ourselves and using shaders I thought you just get a window and go (and it seemed to work in the POC). But I see now that glViewport is essential.
Thank You Sir
I created WPF app as POC and everything seems fine. I moved the relevant parts to the main WPF app and things were not displaying correctly. My display/offscreen rects are 600x600 but things were in the lower right and clipped at the top. After scouring my source for hours I looked into the GLControl and Forms and found the Forms member displayRect was 441x246 even though DisplayRectangle was 600x600. When I measured where the clipping occurred, it was at exactly these dimensions. Then I found this in InitializeComponent for GLControl: this.Size = new System.Drawing.Size(441, 246);
In my standalone none of this causes problems but somehow integrated into a larger app I am getting clipping. After the app inits I am resetting the sizes exactly the same in both apps. I will be more than happy to look into this and would like any potential hints. I am not a Forms guy.
BTW, if I set the Size in InitComponent to 600x600 things are fine but that locks me in then and I don't want to do something I don't understand - especially since it works everywhere else. (Obviously I will do that or some other hack in the short term - those deadlines)
Any ideas at all?
Thanks for the great work.