Skip to content

Commit 589ac75

Browse files
committed
Created GLContext, added proper render calls
1 parent 3a7fa8d commit 589ac75

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/main.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ void drawCircle(float x, float y, float radius) {
113113
glEnd();
114114
}
115115

116-
void render(SDL_Renderer* displayRenderer) {
116+
void render(SDL_Window* displayWindow) {
117117
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
118118

119119
for(int row = 0; row < 8; row++) {
@@ -146,7 +146,8 @@ void render(SDL_Renderer* displayRenderer) {
146146
}
147147
glEnd();
148148

149-
SDL_RenderPresent(displayRenderer);
149+
glFlush();
150+
SDL_GL_SwapWindow(displayWindow);
150151
}
151152

152153

@@ -164,6 +165,8 @@ int main(int argc, char *argv[]) {
164165
return 0;
165166
}
166167

168+
SDL_GL_CreateContext(displayWindow);
169+
167170
initGame();
168171
initOpenGL();
169172

@@ -175,7 +178,7 @@ int main(int argc, char *argv[]) {
175178
while(SDL_PollEvent(&event)) {
176179
running = handleEvent(event);
177180
}
178-
render(displayRenderer);
181+
render(displayWindow);
179182
SDL_Delay(100);
180183
}
181184

0 commit comments

Comments
 (0)