Skip to content
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

Failed to create GL context on mac when attempting to initalize #239

Open
maxall41 opened this issue Jul 28, 2022 · 0 comments
Open

Failed to create GL context on mac when attempting to initalize #239

maxall41 opened this issue Jul 28, 2022 · 0 comments

Comments

@maxall41
Copy link

maxall41 commented Jul 28, 2022

Hello,
Im trying to use SDL2_gpu to draw a few primitive shapes but I'm running into some issues. Mainly that I just get a blank screen with the draw color and none of the shapes. I turned on debugging with GPU_SetDebugLevel(GPU_DEBUG_LEVEL_MAX); and I get:

GPU_CreateTargetFromWindow: BACKEND ERROR - Failed to create GL context.
GPU_InitRendererByID: BACKEND ERROR - Renderer OpenGL 4 failed to initialize properly

I think this has something todo with me needing to add:

find_package(OpenGL REQUIRED)
include_directories( ${OPENGL_INCLUDE_DIRS}  ${GLUT_INCLUDE_DIRS} )
target_link_libraries(flame_engine ${OPENGL_LIBRARIES} ${GLUT_LIBRARY} )

to my cmake file to avoid getting a bunch of symbol errors about OpenGL not being found. Does anybody know what might be causing this?
Full CMake:

cmake_minimum_required(VERSION 3.22)
project(flame_engine)

set(CMAKE_CXX_STANDARD 14)

link_directories(/opt/homebrew/Cellar/sdl2/2.0.22/lib/)

add_executable(flame_engine main.cpp)

find_package(OpenGL REQUIRED)
include_directories( ${OPENGL_INCLUDE_DIRS}  ${GLUT_INCLUDE_DIRS} )
target_link_libraries(flame_engine ${OPENGL_LIBRARIES} ${GLUT_LIBRARY} )

target_link_libraries(flame_engine SDL2)
target_link_libraries(flame_engine SDL2_gpu)

target_include_directories(flame_engine
        PRIVATE
        /opt/homebrew/Cellar/sdl2/2.0.22/include/)

System:
macOS Monterey
MacBook Pro 14 inch (M1 Max)
With 32GB of memory

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

No branches or pull requests

1 participant