VBO Problems

Hello from germany

I have stored some objects as VBOs an everything works fine.
If i draw an additional text - created with wglUseOutlineFonts and stored as display lists
the VBO color - which is not transparent alpah=255 becomes transparent and the
normals look scrambled??
Hoe is it possible to modify the content of a VBO without accessing its memory??

kind regards

Code please.


any combination of VBOs with any color combinations etc. works fine.
As soon as I display text the VBO colors are transparent.

extern void Str_3D( Vertex_Struct* pos, char str, int32_t fnt_ind, RGBA_Struct col, BOOL cen_flag )
float lg = 0;
uint32_t c1;

if ( str == NULL ) return;

if( cen_flag )
for( c1 = 0; c1 < strlen( str ); c1++ ) lg +=__gmf[ fnt_ind ][ str[ c1 ] ].gmfCellIncX;
glTranslatef( -lg / 2.0f + pos->x, pos->y - 0.35f, pos->z + 0.005f );
glTranslatef( pos->x, pos->y - 0.35f, pos->z + 0.005f );

glPushAttrib( GL_LIST_BIT );
glColor4ubv( &col->red );
glListBase( __f_base[ fnt_ind ] );
glCallLists( strlen( str ), GL_UNSIGNED_BYTE, str );

static void Draw_GL_Scene( void )
int32_t c1;
int32_t c2;
VBO_Data_Struct* vbd;


glRotatef( _c_ang, 1.0, 0.0, 0.0 );
glCallList( _ax_3d );

Str_3D( &vx_0, “CE_WIN”, 0, &_col[ 1 ], TRUE );
Draw_VBO( _vbo[ 0 ] );
Draw_VBO( _vbo[ 1 ] );



_c_ang += 0.03f;


kind regards

Ah display lists, aren’t they just fun?

Have you tried


instead of


? If this changes everything back to normal, you can assume it’s stuff in the WGL generated DLs that messes up your state.

What state is set for the list called with

glCallList( _ax_3d );


EDIT: Please format you post to use ‘[‘code’]’ … ‘[’/code’]’ tags. It’s hard enough to read as it is.

Hi thanks for your reply

if I change to GL_ALL_ATTRIB_BITS the text does not display any more
I have taken out glCallList( _ax_3D )

the first frame is rendered correct - the second is bad

I’ve just seen you are from germany - me too -> so we can go on german???

Is there any possibility to place the chars in VBOs - I need to rotate scale… them

so we can go on german???

Nope, the language is this forum is English. Period.

Can you revert the attrib push and post screen shots of correct vs. incorrect? I fail to see what’s going wrong with your colors at the moment.

Thank god this is not a japanese forum

Assume a solid cube color = 255, 255, 255, 255 -> white no transparency,
in the center of the cube is my text.
The first frame shows only the cube -> correct
the second frame shows the cube transparent with the text visible at its center

When I change to GL_ALL_ATTRIB_BITS there is no text anywhere.

Thank god this is not a japanese forum

Stop being racist. :wink:

the second frame shows the cube transparent

I just read the MSDN docs about wglUseFontOutline and before coming to a conclusion I’d like to know, do you mean invisible when saying transparent?


no the cube is visible - but as its color is like 255, 255, 255, 128 -> with a scaled alpha value

_col is defined how?


Yeah, I meant more like the actual values…

EDIT: BTW, why do you have blending enabled anyway? I can’t see wglUseFontOutlines doing that.


Dude, glColorMaterial is a state setting command taking only GL defined compile time constants. It says nothing about actual color values specified for the allowed parameters.

The reason I want to know is because you call glColor4ubv before calling the font lists.

I cannot follow you, I hand a rgba value to the function that holds the base color of the text.
whats wrong with it??
I thought a vbo whose vertics color alpha value is 255 can never be transparent, no matter who the lightning or material setup is…wrong???

How can I know if you have defined a vertex color array that sets the vertices color values when rendering? I know nothing about your VBO setup, I know nothing about state settings you have done at init time or somewhere else, I know nothing about how you render vertex data and I know nothing about what what color values you pass to glColor4ubv.

So, tell me, how am I supposed to help you if you won’t even supply me with information I’m specifically asking for?

All I can deduce is that you probably have blending enabled, maybe have not specified a vertex color array and that you don’t reset the the state of GL_CURRENT_COLOR to whatever value it’s supposed to have after glColor4ubv…

My vbos keep koordinates, normals and colors for each Vertex - no textures.
There is no need to specify any color, if I want a different I modify the color fileds of the vbo vertices.
The display lists as delivered from wgl… hold only polygon vertics - so the color must be defined external.
Sorry if my description was incomplete.
Hope this helps - somehow the execution of the lists changes the opengl state - as I told you before the first frame is ok,
on the second frame the vbo color is transparent.
If I only work with vbos everything works perfect.
Maybe I should define the characters as vbos.

somehow the execution of the lists changes the opengl state

Yes, that’s definitely possible. However, they would have to enable GL_BLEND for blending to happen - unless you don’t enable it somewhere else yourself. And even if it was enabled, if you have a valid color array used when rendering with correctly setup VBO, color state should be pulled from the VBOs. Please post your VBO and array (gl*Pointer() ) setup code and Draw_VBO().

I use 3 function for every primitive - example here ( I cut out the other planes ) VBO_Quad -> creates the data in the machines memory
Upload_VBO transfers everything to GPU memory
Draw_VBO displays it

extern  VBO_Struct* VBO_Quad( GLfloat lg_x, GLfloat lg_y, GLfloat lg_z, RGBA_Struct* base_col  )
  VBO_Struct*               vbo;  
  VBO_Index_Buffer_Struct*  ib;
  VBO_Data_Struct*          vdr;  
  int                       c1;

  lg_x /= 2.0f;  lg_y /= 2.0f;  lg_z /= 2.0f;
  vbo = Create_VBO_Struct();                                   // Erzeuge das VOB_1_Struct 
  Init_VBO_Struct( vbo, 24, 1 );                               // Initialisiere es mit 8 vboertices und 1 Indexbuffer
  vbo->idb_ptr[ 0 ] = Init_VBO_Index_Buffer_Struct( 24 );      // ein Indexbuffer mit 24 Einträgen

  vdr = vbo->vb;

  /*   Vertics Vorderseite <> 0 -- 3   */
  vdr->vx.x = -lg_x;  vdr->vx.y = -lg_y;  vdr->vx.z =  lg_z;      memcpy( &vdr->v_norm, &_z_plus_norm, vertex_struct_size );      memcpy( &vdr->col, base_col, rgba_struct_size );  vdr++; 
  vdr->vx.x =  lg_x;  vdr->vx.y = -lg_y;  vdr->vx.z =  lg_z;      memcpy( &vdr->v_norm, &_z_plus_norm, vertex_struct_size );      memcpy( &vdr->col, base_col, rgba_struct_size );  vdr++; 
  vdr->vx.x =  lg_x;  vdr->vx.y =  lg_y;  vdr->vx.z =  lg_z;      memcpy( &vdr->v_norm, &_z_plus_norm, vertex_struct_size );      memcpy( &vdr->col, base_col, rgba_struct_size );  vdr++; 
  vdr->vx.x = -lg_x;  vdr->vx.y =  lg_y;  vdr->vx.z =  lg_z;      memcpy( &vdr->v_norm, &_z_plus_norm, vertex_struct_size );      memcpy( &vdr->col, base_col, rgba_struct_size );  vdr++; 

  ib = vbo->idb_ptr[ 0 ];
  ib->draw_id = 8;                                       // Quads
  for( c1 = 0; c1 < 24; c1++ ) ib->i_ptr[ c1 ] = c1;

  return( vbo );


extern int32_t  VBO_Upload( VBO_Struct* vbo )
  VBO_Index_Buffer_Struct*  v_idb;
  uint32_t                  c1;

   glGenBuffers( 1, &vbo->id );                                                                                   
  glBindBuffer( GL_ARRAY_BUFFER, vbo->id );                                                
  glBufferData( GL_ARRAY_BUFFER, vbo->vb_size, vbo->vb, GL_DYNAMIC_DRAW );                   

   for( c1 = 0; c1 < vbo->idb_numb; c1++ )
    v_idb = vbo->idb_ptr[ c1 ];                                                                              
    glGenBuffers( 1, &v_idb->id );                                                          
    glBindBuffer( GL_ELEMENT_ARRAY_BUFFER, v_idb->id );                                    
    glBufferData( GL_ELEMENT_ARRAY_BUFFER, v_idb->size, v_idb->i_ptr, GL_STATIC_DRAW );    
  return( 1 );

extern void Draw_VBO( VBO_Struct* vbo )
  VBO_Index_Buffer_Struct*  v_ib;
  uint32_t                  c1;

  glBindBuffer( GL_ARRAY_BUFFER, vbo->id );               
  glColorPointer ( 4, GL_UNSIGNED_BYTE, vbo->stride, vbo->col_offset    );   // Colorpointer setzen
  glVertexPointer( 3, GL_FLOAT,         vbo->stride, vbo->vertex_offset );   // Vertexpointer setzen
  glNormalPointer(    GL_FLOAT,         vbo->stride, vbo->normal_offset );   // Normalenpointer setzen

  for( c1 = 0; c1 < vbo->idb_numb; c1++ )
    v_ib = vbo->idb_ptr[ c1 ];                                            // Pointer auf Indexbuffer
    glBindBuffer( GL_ELEMENT_ARRAY_BUFFER, v_ib->id );                 // Indexbuffer aktivieren 
    switch( v_ib->draw_id )

    case 2:  // GL_LINE_STRIP
        glDrawElements( GL_LINE_STRIP, v_ib->numb, GL_UNSIGNED_INT, NULL  );  // TRIANGLES zeichnen

    case 4:  // GL_TRIANGLES
        glDrawElements( GL_TRIANGLES, v_ib->numb, GL_UNSIGNED_INT, NULL  );  // TRIANGLES zeichnen

    case 5:  // TRIANGLE_FAN
        glDrawElements( GL_TRIANGLE_FAN, v_ib->numb, GL_UNSIGNED_INT, NULL  );  // TRIANGLE_FAN zeichnen

    case 7:  // POLYGON
        glDrawElements( GL_POLYGON, v_ib->numb, GL_UNSIGNED_INT, NULL  );        // POLYGON zeichnen

    case 8:  // GL_QUADS
        glDrawElements( GL_QUADS, v_ib->numb, GL_UNSIGNED_INT, NULL );          // QUADS zeichnen

    case 9:  // GL_STRIP
        glDrawElements( GL_QUAD_STRIP, v_ib->numb, GL_UNSIGNED_INT, NULL );     // QUADS_STRIP zeichnen

    }  // Ende des switch Blocks


  glBindBuffer( GL_ARRAY_BUFFER, 0 );
  glBindBuffer( GL_ELEMENT_ARRAY_BUFFER, 0 );


Maybe it’s just me, but other than finding your code extremely hard to read, I’m not yet able to see how your complete data is put into the VBO data store. Aside from that, if your data is all in one buffer, I doubt that a single vbo->stride argument will suffice because it looks to me as if you try to interleave your data and thus a single stride parameter cannot be appropriate. Please post the definitions of:

VBO_Struct* vbo;
VBO_Index_Buffer_Struct* ibM
VBO_Data_Struct* vdr;