Skip to content
This repository has been archived by the owner on Dec 2, 2019. It is now read-only.

Rendering to a framebuffer instead of OpenGL #917

Open
RossComputerGuy opened this issue Sep 30, 2019 · 10 comments
Open

Rendering to a framebuffer instead of OpenGL #917

RossComputerGuy opened this issue Sep 30, 2019 · 10 comments

Comments

@RossComputerGuy
Copy link

I was looking through the code because I'm wanting to use Nuklear but I don't want to use OpenGL, this is for a graphics system I'm developing. So I just need to be able to render to a framebuffer and it seems possible to render without OpenGL. Can I please get some help with rendering to a framebuffer if it's possible.

@dumblob
Copy link
Contributor

dumblob commented Oct 1, 2019

Sure, that's one of the main goals of Nuklear - to have extremely easily pluggable backends. Just look at the demo/ folder where you'll find all currently functional backends (there might be some also in pull requests to this repository). If you need more help, don't hesitate and ask 😉.

@RossComputerGuy
Copy link
Author

Ok, it looks pretty straight forward. I'll leave the issue open if I need help.

@RossComputerGuy
Copy link
Author

opticsgs/libopnuk on  master [!?] took 38m 28s
[I] ➜ ../build/demos/opnuk/demo-opnuk
** Message: 10:27:38.505: Using /run/user/1000/slatewm.sock for IPC path
demo-opnuk: /home/ross/RonixOS/opticsgs/libopnuk/nuklear/nuklear.h:16325: nk_begin_titled: Assertion `win->seq != ctx->seq' failed.

Got this error creating just doing this:

    if (nk_begin(&ctx.nkctx, "Overview", nk_rect(10, 10, 400, 600), NK_WINDOW_BORDER)) {
    }
    nk_end(&ctx.nkctx);

@RossComputerGuy
Copy link
Author

I took the rawfb header from the X11 RawFB example and integrated it, I only see a white box.

@dumblob
Copy link
Contributor

dumblob commented Oct 1, 2019

Got this error creating just doing this:
...

This is weird. Please post the full source code somewhere (pastebin, your github repo, ...) so that we can take a look.

I took the rawfb header from the X11 RawFB example and integrated it, I only see a white box.

Same as above - post the full source and I'll try to find some time to dig through it during the next two or three weeks.

@RossComputerGuy
Copy link
Author

https://github.com/ronixos/opticsgs is the repository I'm doing this all in, libopnuk is doing the Nuklear rendering stuff and demos/opnuk/src/main.c is where libopnuk is being used.

@RossComputerGuy
Copy link
Author

The code of the opnuk demo I'm working on.

  libopticsgs_win_t* win;
  if ((r = libopticsgs_window_create(&win, 0, 0, 0, 640, 480, 0)) != LIBOPTICSGS_ERROR_NONE) {
    g_error("Failed to create window: %s", libopticsgs_strerror(r));
    return EXIT_FAILURE;
  }
  opnuk_context_t ctx;
  if ((r = opnuk_init(win, OPNUK_RENDER_GL2, &ctx)) < OPNUK_ERROR_NONE) {
    libopticsgs_window_destroy(win);
    g_error("Failed to initialize opnuk: %d", r);
    return EXIT_FAILURE;
  }
  while (1) {
    struct nk_context* nk = opnuk_getnk(&ctx);
    if (nk_begin(nk, "Overview", nk_rect(0, 0, win->width, win->height), NK_WINDOW_BORDER|NK_WINDOW_MOVABLE|NK_WINDOW_CLOSABLE|NK_WINDOW_MINIMIZABLE|NK_WINDOW_TITLE)) {
      nk_layout_row_dynamic(nk, 20, 1);
      if (nk_button_label(nk, "button")) {}
    }
    nk_end(nk);
    if (ctx.renderer == OPNUK_RENDER_GL2) {
      glViewport(0, 0, win->width, win->height);
      glClear(GL_COLOR_BUFFER_BIT);
      glClearColor(0.10f, 0.18f, 0.24f, 1.0f);
    }
    opnuk_render(ctx);
  }

The green border is the window frame in the screenshots bellow.

Rendering with rawfb:
image
In this, it is rendering outside of the space its supposed to in the bottom and right.

Rendering with OpenGL 2.0:
image
In this, nothing is rendering

@hbiblia
Copy link

hbiblia commented Oct 23, 2019

https://github.com/ronixos/opticsgs error 404??

@RossComputerGuy
Copy link
Author

I stopped developing that since it wouldnt work

@hbiblia
Copy link

hbiblia commented Oct 24, 2019

I stopped developing that since it wouldnt work

oka, nad closes this thread if it is no longer necessary.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants