i have function adds billboard quads map texture. texture moves around 3d globe rotated. drawinrect looks this:
- (void)glkview:(glkview *)view drawinrect:(cgrect)rect { // clear buffer , prepare draw glclearcolor(1.0f, 1.0f, 1.0f, 1.0f); glclear(gl_color_buffer_bit | gl_depth_buffer_bit); // enable earth texture self.effect.texture2d0.name = _earthinfo.name; self.effect.texture2d0.target = _earthinfo.target; // bind earth vertex array glbindvertexarrayoes(_earthvertexarray); // render object glkit [self.effect preparetodraw]; // draw elements index array , uv / vertex / normal info gldrawelements(gl_triangles,earth_polygoncount*3,gl_unsigned_short,0); // draw skybox -- draw skybox centered on eye position // _skyboxeffect.center = _eyeposition; // _skyboxeffect.transform.projectionmatrix = self.effect.transform.projectionmatrix; // _skyboxeffect.transform.modelviewmatrix = self.effect.transform.modelviewmatrix; // [_skyboxeffect preparetodraw]; // [_skyboxeffect draw]; // turn on blending before displaying satellites // satellite image ( has alpha ) // shows ok glblendfunc(gl_one, gl_one_minus_src_alpha); glenable(gl_blend); // billboard [self createbillboardatlat:35 andlon:-97]; // billboard [self createbillboardatlat:0 andlon:0]; // billboard [self createbillboardatlat:-65 andlon:-137]; }
in createbillboardat function, draw so:
// create billboard faces camera - (void)createbillboardatlat:(float)lat andlon:(float)lon { ... stuff .... // assign new matrix draw - no translation self.effect.transform.modelviewmatrix = notranslationinfo; // render object glkit [self.effect preparetodraw]; // draw elements index array , uv / vertex / normal info gldrawelements(gl_triangles,billboard_polygoncount*3,gl_unsigned_short,0); // restore original matrix self.effect.transform.modelviewmatrix = originalmat; }
i turn on blending before adding billboards @ orientations, textures hte satellites blend fine globe not each other. please see screenshot... doing wrong?
i've tried of these options none work - 1 ( foremost ) satellite eclipses 1 of other satellites - not both. please help!
// turn on blending before displaying satellites // satellite image ( has alpha ) // shows ok glblendfunc(gl_src_alpha, gl_one_minus_src_alpha); glenable(gl_blend); //glenable(gl_depth_test); //gldepthfunc(gl_lequal); //gldepthmask(true);
Comments
Post a Comment