使用 SDL2 和 OpenGL 显示蓝色
Displaying blue with SDL2 and OpenGL
这个问题的标题有点误导,因为我知道如何显示颜色感谢 this tutorial. After getting it to work I decided to use it so I gutted one of my old bits of code that was a test of SDL2 when I first started using SDL2, and replaced all the renderer stuff and some other stuff, and replaced it with an OpenGL context and tried to get it to display blue, but with no luck it just displayed a black screen. Not sure what the exact issue is. here is a gist
P.S。如果能想到一个更好的标题,我洗耳恭听:)
给定代码中有硬编码的绿色,而不是蓝色。无论如何,您永远不会将 window 分配给 window_p
指针,而是使用它来创建上下文和交换。如果你查看 SDL_GetError
,它会报告 "Invalid window"。
除此之外:
- 请 post 问题本身的代码,而不是外部 link
loop
中的递归一点也不好
- 您在创建上下文后设置上下文参数
.h
中的函数实现很可能会出现问题
这个问题的标题有点误导,因为我知道如何显示颜色感谢 this tutorial. After getting it to work I decided to use it so I gutted one of my old bits of code that was a test of SDL2 when I first started using SDL2, and replaced all the renderer stuff and some other stuff, and replaced it with an OpenGL context and tried to get it to display blue, but with no luck it just displayed a black screen. Not sure what the exact issue is. here is a gist
P.S。如果能想到一个更好的标题,我洗耳恭听:)
给定代码中有硬编码的绿色,而不是蓝色。无论如何,您永远不会将 window 分配给 window_p
指针,而是使用它来创建上下文和交换。如果你查看 SDL_GetError
,它会报告 "Invalid window"。
除此之外:
- 请 post 问题本身的代码,而不是外部 link
loop
中的递归一点也不好- 您在创建上下文后设置上下文参数
.h
中的函数实现很可能会出现问题