[Code] Neuen Beispielcode ergänzt

This commit is contained in:
Andre Meyering 2018-10-24 15:03:05 +02:00
parent ec4663e293
commit e12a6f70a1
5 changed files with 283 additions and 10 deletions

View file

@ -1,5 +0,0 @@
cmake_minimum_required (VERSION 3.8)
add_executable (hello_world helloWorld.c)
target_include_directories(hello_world PRIVATE ${OPENGL_INCLUDE_DIRS} ${GLUT_INCLUDE_DIRS} )
target_link_libraries(hello_world ${OPENGL_LIBRARIES} ${GLUT_LIBRARY} )

View file

@ -1,8 +1,8 @@
#include <GL/glut.h>
#include <string.h>
int width = 640;
int height = 480;
static int width = 640;
static int height = 480;
void init(int argc, char** argv)
{
@ -22,7 +22,7 @@ void init(int argc, char** argv)
void display(void)
{
char* myText = "Hello World!";
int j;
unsigned long j;
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(1.0, 0.0, 0.0);
@ -36,7 +36,7 @@ void display(void)
glColor3f(1.0, 1.0, 1.0);
glRasterPos2i((width / 2) - (width / 4) + 10, (height / 2) - (height / 4) + 10);
for (j = 0; j < strlen(myText); j++) {
for (j = 0ul; j < strlen(myText); j++) {
glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18, myText[j]);
}