OpenGL

★Windows 10 64bit ! VS2013 Good!!

Setting in Visual Studio 2013 on Windows 10 64bit

★Ubuntu installation

sudo apt-get install libglu1-mesa-dev freeglut3-dev mesa-common-dev

★ Gute codes for working really

Display List

Tesselation

rotation

3D model viewer for obj file – pan mit keyboard

perfect – rotate,zoom,menu mit mouse

Quarterion – xyz rotaion mit mouse

☆References

SongHo

Official Site

OpenGL de プログラミング

Natural Science

WIKIBOOKS

Streaming (referred from opengl-wiki)

Streaming is the process of frequently uploading data to a buffer object and then using that buffer object in some OpenGL process.

The key to effective streaming is avoiding this synchronization.

sample code (GLEssentials) for Mac OS X

This includes usages of Vertex Buffer Objects (VBOs), Vertex Array Objects (VAOs), Framebuffer Objects (FBO), and GLSL Program Objects.

sourceUtil.c : Functions for loading source files for shaders

vectorUtil.c : Functions for performing vector math.

modelUtil.c : Functions for loading a model file for vertex arrays. The model file format used is a simple “binary blob” invented for the purpose of this sample code.

matrixUtil.c

Shader- In the field of computer graphics, a shader is a computer program that is used to do shading – the production of appropriate levels of light and color within an image – or, in the modern era, also to produce special effects or do postprocessing.

OpenGLBook.com

OpenGL Programming Guide

OpenGL uses geometry primitives to draw different objects in the 3D world. A geometry primitive, which may be a set of points, lines, triangles, or polygonal faces, determines how  OpenGL sorts and renders its associated vertex data.

Buffer Object

Vertex Buffer Object reference (Dr.Tokoi/Wakayama Univ.) and opengl-wiki

A Vertex Buffer Object (VBO) is an OpenGL feature that provides methods for uploading data (vertex, normal vector, color, etc.) to the video device for non-immediate-mode rendering. VBOs offer substantial performance gains over immediate mode rendering primarily because the data resides in the video device memory rather than the system memory and so it can be rendered directly by the video device.

frame buffer – VBO, PBO

(functions)

glGenLists

glGenBuffers : generate VBO

glBindBuffer

glBufferData/glBufferSubData : upload and download data to the device / copy data to buffer

GL_STATIC_DRAW: The vertex data will be uploaded once and drawn many times (e.g. the world).

GL_DYNAMIC_DRAW: The vertex data will be changed from time to time, but drawn many times more than that.

GL_STREAM_DRAW: The vertex data will change almost every time it’s drawn (e.g. user interface)

glDeleteBuffers

glMapBuffer/glUnmapBuffer : A more efficient way to upload data to the device is to get a pointer to the internal drivers’ memory with the functions glMapBuffer and glUnmapBuffer.

OpenGL Interoperability (referred from NVIDIA_CUDA_PROGRAMMING_GUIDE.pdf)

 A buffer object must be registered to CUDA before it can be mapped. This is done with cudaGLRegisterBufferObject();

Once it is registered, a buffer object can be read from or written to by kernels using the device memory address returned by cudaGLMapBufferObject():

Unmapping is done with cudaGLUnmapBufferObject() and unregistering with cudaGLUnregisterBufferObject().

Mac Cool Site!

スクリーンショット(2013-01-29 22.40.30)

MAC

 

 

 

 

LINUX

g++ torus.c -o torus -lm -lGL -lGLU -lglut

simpleGL page

-OpenGL + CUDA

sine curve program

VBO : Vertex Buffer Object

glGenBuffers(1, &bufferID); //Generate a buffer ID

glBindBuffer(GL_ARRAY_BUFFER, vbo)

glBufferData

vertex array

glBindBuffer

glVertexPointer : Specify pointer to vertex coords array

 

Example Page1 page2 ← Visual C ++ 2010

Animation

glBegin (primType);

glEnd();

Primitives Type:

GL_POINTS, GL_LINES, GL_LINE_STRIP, GL_LINE_LOOP, GL_POLYGON, GL_QUAD_STRIP, GL_TRIANGLE_STRIP, GL_TRIANGLE_FAN, GL_TRIANGLES, GL_QUADS

glBegin (GL_POINTS);

glEnd();

 

<references>

GLUTでOpenGL 3Dプログラミング

<samples>

1zip for mac os x in XCODE GL_LINE_STRIP

add framework-GLUT.framework, OpenGL.framework

explanation of source

2.sample 2 for mac os x in XCODE ← GL_POINTS < ← MMS point cloud data

g++ main.c -o go -lglut -lGL -lGLU

void display(void)

{

glClear(GL_COLOR_BUFFER_BIT); //must

glColor3f (0, 1.0, 1.0);  //←glColor3ub (0, 1, 2);

glBegin(GL_POINTS);

glVertex3f(1, 1, 1);  // ← glVertex3f(x,y,z); //example; Airborne Lidar, MMS

glVertex3f(0.9, 0.8, 0.7);

glEnd();

glFlush();

}

3.GL_QUADS file

 

<MMS point cloud>

→ Read Text — Comma Separated

while (fscanf(fpr, “%f,%f,%f,%f,%f,%f,%f,%f,%d,%d,%d”, &x,&y,&z,&lat,&lon,&elh,&gps,&er,&r,&g,&b) != EOF)

x座標y座標H(レーザ3次元データ標高値),B,L,h,GPS時刻,誤差、(RGB色)R値G値B値

スクリーンショット(2013-01-28 23.48.44)

 

<Read Text Data>

reference

<example 1>

Displaying a Window

glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH);
glutInitWindowPosition(100, 100);
glutInitWindowSize(640, 480);

glutCreateWindow(“Animation Cube”);

glutReshapeFunc(reshape);
glutIdleFunc(idle);
glutDisplayFunc(display); //gluLookAt

glutMainLoop();

<example 2>

glutInitWindowSize(200, 200);

glutInit(&argc, argv);

glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);

glutCreateWindow(argv[0]);

init();

glutReshapeFunc(reshape); //

glutKeyboardFunc(keyboard);

glutDisplayFunc(display);

glutMainLoop();

return 0;

<Callbacks>

glutKeyboardFunc()

glutSpecialFucn()

glutMouseFunc()

glutMotionFunc()

glutPassiveMotionFunc()