c++ - Understanding glTexCoord2f(), glVertex3f() in OpenGL -


i'm trying build in oculusrift support our car simulator software @ our institute. due way simulator software setup decided fix distortion due lenses client side build display list opengl run first tests.

basically i'm struggly bit understanding how opengl drawing (for display list). used info different tutorials , if understand correctly following for-loop select coordinates tex 0,1,2 vignetting , bind each vetice. glbegin(gl_triangles) automatically draw triangles out of vertices.

the coordinates of vertices stored in struct address ov pointing to. additionally have offsets each color channel.

is following code snipped opengl viewpoint correct?

ovrhmd_createdistortionmesh(phmd, eyerenderdesc[eyenum].eye, eyerenderdesc[eyenum].fov, ovrdistortioncap_chromatic | ovrdistortioncap_vignette, &meshdata);  ovrdistortionvertex * ov = meshdata.pvertexdata;  // new compiled distortion-rendering display list glnewlist(drlist, gl_compile);  // make triangles out of vertices glbegin(gl_triangles);  (unsigned int vertnum = 0; vertnum < meshdata.vertexcount; vertnum++) {     // tex0,1,2 have been activated     glmultitexcoord2f(gl_texture0, ov->taneyeanglesr.x, ov->taneyeanglesr.y);     glmultitexcoord2f(gl_texture1, ov->taneyeanglesg.x, ov->taneyeanglesg.y);     glmultitexcoord2f(gl_texture2, ov->taneyeanglesb.x, ov->taneyeanglesb.y);     glcolor4f(     (ovr::ubyte)(ov->vignettefactor * 255.99f),     (ovr::ubyte)(ov->vignettefactor * 255.99f),     (ovr::ubyte)(ov->vignettefactor * 255.99f),     (ovr::ubyte)(ov->timewarpfactor * 255.99f));     glvertex3f(ov->screenposndc.x, ov->screenposndc.y, 0.5); // z: constant     ov++; }  glend(); glendlist(); 

i'm trying build in oculusrift support our car simulator software @ our institute. due way simulator software setup decided fix distortion due lenses client side build display list opengl run first tests.

stop right there! you're targeting vr display, means must use highest performance drawing method can draw dynamic meshes (required timewarping). display lists can't this. immediate mode (glbeginglend) creates lots of cpu overhead don't want have.


Comments

Popular posts from this blog

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -