Conversation
|
Try putting the area in a box and marking it stretchy, then adding a button. There's glitches involving the sizing of areas that are by themselves in windows on GTK+. |
|
Did that work? |
Yes! |
This comment has been minimized.
This comment has been minimized.
|
@andlabs Is the macOS area refactoring acceptable? Also, why are the macOS classes in lowerCameCase (Cocoa's arent: |
Old one isn't documented at all
|
Do we want a scrolling opengl view? |
|
I'll look at all of that after releasing Alpha 4. lowerCaseCamelCase is a habit I acquired from various places, including Go. The new convention is |
|
Instead of GLX, EGL could be used on Wayland (the native interface there). But I dont know how to detect this at runtime and if these libraries would need to be loaded dynamically regarding these: That should then be the same behaviour as the Gtk GLArea. |
|
Hi, I was wondering what the current state of this feature is? The 3.0 changelog seems to indicate this was planned for the 4.0 release, but I don't believe this feature has made it in yet, has it? CI seems to be failing for 32-bit Linux, because it can't find "-lGL", (the GL library), but when looking at the CMakeLists.txt I was wondering why you are manually specifying the library names instead of using FindOpenGL? |
Waiting for @andlabs' feedback/review.
Fixed. 😄 Let's see what happens. |
|
@andlabs ? |
|
I don't know; that's weird. Travis still lets me see the status of libui, but it's behind... |
|
Okay I guess I needed to just log in again and it seems to be back. I should probably get to updating both the issues and pull requests for this now (I was taking a break after releasing Alpha 4 and package |
|
The Mac example doesn't start rendering until the window is resized, and then, it flickers a lot. Any idea what's going on? |
Some tweaks in libsimpleservo C API - Adding logs. - Adding OpenGL support for OSX. - Fixing file reading issue. With this, I can load Servo into a C app (with the C version of libui + andlabs/libui#405). <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/22832) <!-- Reviewable:end -->
Could you please check if diff --git a/examples/opengl/main.c b/examples/opengl/main.c
index 1fff59c9..ab19e5a7 100644
--- a/examples/opengl/main.c
+++ b/examples/opengl/main.c
@@ -277,6 +277,7 @@ static void onInitGL(uiOpenGLAreaHandler *h, uiOpenGLArea *a)
static void onDrawGL(uiOpenGLAreaHandler *h, uiOpenGLArea *a, double width, double height)
{
GLCall(glViewport(0, 0, width, height));
+ printf("%f %f\n", width, height);
GLCall(glClear(GL_COLOR_BUFFER_BIT));Should print:
Maybe disabling VSync ( diff --git a/examples/opengl/main.c b/examples/opengl/main.c
index 1fff59c9..5e1c9914 100644
--- a/examples/opengl/main.c
+++ b/examples/opengl/main.c
@@ -362,8 +363,6 @@ int main(void)
uiOpenGLArea *glarea = uiNewOpenGLArea(&AREA_HANDLER, attribs);
uiBoxAppend(b, uiControl(glarea), 1);
- uiTimer(1000/60, render, glarea);
-
uiControlShow(uiControl(mainwin));
uiMain();Works fine for me (macOS 10.13.6, Intel Graphics). |
|
onDrawGL is called before resizing. It's printing the right size I believe (600x416). Disabling vsync doesn't change anything. Still flickers without the timer. I think every odd frame is transparent: Screencast: https://streamable.com/12xcn |
Some tweaks in libsimpleservo C API - Adding logs. - Adding OpenGL support for OSX. - Fixing file reading issue. With this, I can load Servo into a C app (with the C version of libui + andlabs/libui#405). <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/22832) <!-- Reviewable:end -->
|
@paulrouget I guess you're running Mojave? This should definitely fix the blank-before-resize-issue: diff --git a/darwin/openglarea.m b/darwin/openglarea.m
index d98dbb9e..8d289c05 100644
--- a/darwin/openglarea.m
+++ b/darwin/openglarea.m
@@ -82,6 +83,8 @@ static void assignNextPixelFormatAttribute(NSOpenGLPixelFormatAttribute *as, uns
self->libui_a->ctx = [[NSOpenGLContext alloc] initWithFormat:self->libui_a->pixFmt shareContext:nil];
if(self->libui_a->ctx == nil)
uiprivUserBug("Couldn't create OpenGL context!");
+ [self->libui_a->ctx setView:self];
+ [self->libui_a->ctx update];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(viewBoundsDidChange:) name:NSViewFrameDidChangeNotification object:self];
}When setting diff --git a/darwin/openglarea.m b/darwin/openglarea.m
index d98dbb9e..8d289c05 100644
--- a/darwin/openglarea.m
+++ b/darwin/openglarea.m
@@ -42,6 +42,8 @@ static void assignNextPixelFormatAttribute(NSOpenGLPixelFormatAttribute *as, uns
[self setupNewTrackingArea];
self->libui_enabled = YES;
+ [self setWantsLayer:NO];
+
NSOpenGLPixelFormatAttribute attrs[ATTRIBUTE_LIST_SIZE];
unsigned int attrIndex = 0;
assignNextPixelFormatAttribute(attrs, &attrIndex, NSOpenGLPFAColorSize); |
Yes. 10.14.1.
This change changes nothing.
Setting Setting No matter the configuration/changes, it's flickering. |
|
The flickering could be related to double buffering? @pcwalton You have investigated this some time ago, any suggestion? |
|
Will this work on mac os? |
I updated @pcwalton's work onto master.
Closes #265. Closes #34
On Linux,

mesa-common-devis needed for building (orlibgl1-mesa-dev?)TODO:
This is the modern way of creating an OpenGL context (needed for multisampling and sRGB frambuffers):
SetPixelFormat)SetPixelFormatthe actual format.SetPixelFormatcan only be called once per Window, so a "fake window" needs to be created for the fake context.areaDoEvents:uMsg == msgAreaKeyDownfor uiAreauMsg == WM_KEYDOWfor uiOpenGLAreaareaFilterworking for uiOpenGLArea as well?onMouseCrossedstops working after clicking once onto the area (does this happen withuiAreaas well?)To discuss:
General:
uiprivUserbugcan't be caught so a program can't even display "Your graphics card is not supported".Linux:
macOS:
https://twitter.com/pcwalton/status/1055528025247240192