Beispiel #1
0
//void xeeSubmit() {}
void xeeSubmit()
{	
	// never draw this one
	if (gl_cull_mode == GL_FRONT_AND_BACK)
		return;
		
	// update states if dirty
	XeUpdateStates();

	// update if dirty
	XeGlCheckDirtyMatrix(&projection_matrix);
	XeGlCheckDirtyMatrix(&modelview_matrix);
	
    // Xe_SetStreamSource(xe, 0, pVbGL, xe_PrevNumVerts * sizeof(glVerticesFormat_t), 10);
    Xe_SetShader(xe, SHADER_TYPE_VERTEX, pVertexShader, 0);
    
    int i = 0;
    // setup texture    
    for(i=0; i<XE_MAX_TMUS; i++) {    
		// set texture
		if (xeTmus[i].enabled && xeTmus[i].boundtexture) {
			Xe_SetTexture(xe, i, xeTmus[i].boundtexture->teximg);
		}
		else {
			Xe_SetTexture(xe, i, NULL);
		}
	}
	// setup shaders
	GL_SelectShaders();
	
	// draw
	Xe_DrawPrimitive(xe, Gl_Prim_2_Xe_Prim(xe_PrimitiveMode), xe_PrevNumVerts, Gl_Prim_2_Size(xe_PrimitiveMode, (xe_NumVerts - xe_PrevNumVerts)));
	
	//printBlendValue();
}
Beispiel #2
0
static void GL_SubmitVertexes()
{	
	// never draw this one
	if (gl_cull_mode == GL_FRONT_AND_BACK)
		return;
	//Xe_SetFillMode(xe, XE_FILL_WIREFRAME, XE_FILL_WIREFRAME);
		
	// update states if dirty
	XeUpdateStates();

	// update if dirty
	XeGlCheckDirtyMatrix(&projection_matrix);
	XeGlCheckDirtyMatrix(&modelview_matrix);
	
    // Xe_SetStreamSource(xe, 0, pVbGL, xe_PrevNumVerts * sizeof(glVerticesFormat_t), 10);
    Xe_SetShader(xe, SHADER_TYPE_VERTEX, pVertexShader, 0);
    
   
	// setup shaders and textures
	GL_SelectShaders();
	GL_SelectTextures();
	
	// draw
	if (use_indice_buffer == 0)
	{	
		/*  Xe_DrawPrimitive(struct XenosDevice *xe, int type, int start, int primitive_count) */
		Xe_DrawPrimitive(xe, Gl_Prim_2_Xe_Prim(xe_PrimitiveMode), xe_PrevNumVerts, Gl_Prim_2_Size(xe_PrimitiveMode, (xe_NumVerts - xe_PrevNumVerts)));
	}
	else {
		/* Xe_DrawIndexedPrimitive(struct XenosDevice *xe, int type, int base_index, int min_index, int num_vertices, int start_index, int primitive_count) */
		Xe_SetIndices(xe, pIbGL);
		
		Xe_DrawIndexedPrimitive(xe, Gl_Prim_2_Xe_Prim(xe_PrimitiveMode), 
		0, 0,
		(xe_NumVerts - xe_PrevNumVerts), xe_PrevNumIndices, (xe_NumIndices - xe_PrevNumIndices));
		
		/*
		Xe_DrawIndexedPrimitive(xe,XE_PRIMTYPE_TRIANGLELIST, 
		0, 0,
		(xe_NumVerts - xe_PrevNumVerts), xe_PrevNumIndices, 2);
		*/ 
	}
	
	//printBlendValue();
}
Beispiel #3
0
/**
 * mode / type
 **/ 
void glDrawElements(GLenum mode, GLsizei numIndexes, GLenum type, const GLvoid * indices)
{
	int i = 0;
	
	union {
		float f;
		unsigned int u32;
	} color;
	
	// Begin
	xe_PrevNumVerts = xe_NumVerts;
	xe_PrevNumIndices = xe_NumIndices;
	
	unsigned int * indexes = (unsigned int*)indices;
	void * vertice_ptr = vertexPointer.pointer;
	void * color_ptr = colorPointer.pointer;
	void * texcoords0_ptr = texCoordPointer[0].pointer;
	void * texcoords1_ptr = texCoordPointer[1].pointer;
	
	// vertices
	for (i = 0 ; i < vertexPointer.count ; i++) {
		float * v = (float*) vertice_ptr;
		float * t0 = (float*) texcoords0_ptr;
		float * t1 = (float*) texcoords1_ptr;
		unsigned char * c = (unsigned char*) color_ptr;
		color.u32 = COLOR_ARGB(c[3], c[2], c[1], c[0]);
		//color.u32 = 0xFFFFFFFF;
		
		*xe_Vertices++ = v[0];
		*xe_Vertices++ = v[1];
		*xe_Vertices++ = v[2];
		*xe_Vertices++ = 1;
		
		if (texcoords0_ptr) {
			*xe_Vertices++ = t0[0];
			*xe_Vertices++ = t0[1];
		} else {
			*xe_Vertices++ = 0;
			*xe_Vertices++ = 0;
		}
		
		if (texcoords1_ptr) {
			*xe_Vertices++ = t1[0];
			*xe_Vertices++ = t1[1];
		} else {
			*xe_Vertices++ = 0;
			*xe_Vertices++ = 0;
		}
		
		*xe_Vertices++ = color.f;		
		
		vertice_ptr += vertexPointer.stride;
		if (texcoords0_ptr) {
			texcoords0_ptr += 2 * sizeof(float);
		}
		if (texcoords1_ptr) {
			texcoords1_ptr += 2 * sizeof(float);
		}
		color_ptr += 4 * sizeof(char);
				
		xe_NumVerts++;
	}
	
	// indices
	for (i = 0 ; i < numIndexes ; i++) {
		*xe_indices++ = indexes[i] + xe_PrevNumVerts;
		xe_NumIndices++;
	}
	
	
	XeUpdateStates();
	XeGlCheckDirtyMatrix(&projection_matrix);
	XeGlCheckDirtyMatrix(&modelview_matrix);
	
	// setup shaders and textures
	Xe_SetShader(xe, SHADER_TYPE_VERTEX, pVertexShader, 0);
	GL_SelectShaders();
	GL_SelectTextures();
	
	Xe_SetIndices(xe, pIbGL);
	Xe_SetStreamSource(xe, 0, pVbGL, 0, 10);
		
	Xe_DrawIndexedPrimitive(
		xe, 
		XE_PRIMTYPE_TRIANGLELIST, 
		0, 0,
		vertexPointer.count, 
		xe_PrevNumIndices, 
		numIndexes/3
	);
}