-
Notifications
You must be signed in to change notification settings - Fork 521
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Backend: SDL2 SDL_Renderer #280
Backend: SDL2 SDL_Renderer #280
Conversation
@1bsyl just a small curiosity..is this is meant to be working with the SDL_Renderer, why the need to specify those OpenGL attributes? Is there any limitation? I'm asking this because I use SDL and don't want to drop D3D11 :) |
@gabrielrad I'll clean up this example if the SDL branch is merged. (so please don't merge the branch right now). This example should also run on with D3D11 / METAL / opengl / gles2 / and software. |
Thank you for being awesome @1bsyl ! Fingers crossed it gets merged in SDL2! I'm very happy on using SDL2 for everything especially the drawing aspect, and having also the ability to use something like dear imgui alongside would be a dream come true! |
@1bsyl undefined reference for SDL_RenderGeometryRaw |
@gabrielrad |
@gabrielrad I have pushed so stuff to SDL branch (not yet the METAL nor the D3D11 implementation) |
@gabrielrad : I've pushed METAL and D3D11 backend updates |
@1bsyl In Also did you figure out how to draw textures? |
@gavriil07 |
@1bsyl Not quite right..You should check
(https://wiki.libsdl.org/SDL_RenderGetClipRect) This seems to work nice: I know SDL has support for drawing textures, that is why it would be nice that your example would include some image buttons also, because nuklear supports this. I for myself could not get it working.. |
@gavriil07 yes you're right you need to check if clipping was enabled Sorry I don't know the Nuklear API, I modified the existing example to test SDL_RenderGeometry. |
I don't really understand this stack-trace.
If you think there is a bug with RenderGeometry, you can as well write a
small SDL test-case
…On Sun, 4 Apr 2021 at 18:21, gavriil07 ***@***.***> wrote:
@1bsyl <https://github.com/1bsyl> I think I might have caught a bug. This
causes a segmentation fault:
SDL_Texture *Texture = GetTextureData(E_ICON_BOX);
if (Texture) {
struct nk_image Image = nk_image_handle(nk_handle_ptr(Texture));
nk_image(ctx, Image);
nk_button_image(ctx, Image);
}
The root of the problem(taken from CLion GDB):
SDL_RenderGeometryRaw_REAL SDL_render.c:3638
nk_sdl_render nuklear_sdl_sdlrenderer.h:133
EndDrawing draw.c:98
Draw ssssss.c:165
UpdateAndRenderPlay ssssss.c:146
RunGame sssss.c:87
SDL_main main.c:22
main_getcmdline SDL_windows_main.c:69
__tmainCRTStartup 0x00000001400013c1
WinMainCRTStartup 0x00000001400014d6
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#280 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAGH4KEWBVVFKVDJRXDZLL3THCGYHANCNFSM4Z26AJAQ>
.
--
Sylvain Becker
|
SDL 2.0.18 was released on 30. Nov 2021 with official Support for SDL_RenderGeometry() and SDL_RenderGeometryRaw() :-) |
…_example_sdl_rendergeometry
#ifdef INCLUDE_ALL | ||
#define INCLUDE_STYLE | ||
#define INCLUDE_CALCULATOR | ||
#define INCLUDE_OVERVIEW | ||
#define INCLUDE_NODE_EDITOR | ||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mind adding the Canvas demo too?
#include <limits.h> | ||
#include <time.h> | ||
|
||
#include <SDL.h> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SHould this be #include <SDL2/SDL.h>
instead?
#ifndef NK_SDL_GL2_H_ | ||
#define NK_SDL_GL2_H_ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Incorrect header define.
#ifndef NK_SDL_GL2_H_ | ||
#define NK_SDL_GL2_H_ | ||
|
||
#include <SDL.h> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#include <SDL2/SDL.h>
?
* | ||
* =============================================================== | ||
*/ | ||
#ifdef NK_SDL_GL2_IMPLEMENTATION |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Incorrect define.
Brought over to #396 ... Thanks so much! |
Provide an example to build Nuklear using SDL2 / SDL_RenderGeometry (using this PR libsdl-org/SDL#4195)
Which makes Nuklear using the platform backend available (opengl, opengles2, Direct3D11, Metal, or software rendering).