Sign in to follow this  

White Screen When Using glMultiDrawElements

This topic is 1320 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey i was working with glMutiDrawElements and i faced a white screen when i comment this piece of code the white screen goes:

glMultiDrawElements(GL_LINES,(int*)4,GL_UNSIGNED_BYTE,(const void **)indices,2);

Code :

#if defined(__APPLE__)
#include <GLUT/glut.h>
#else
#include <GL/glew.h>
#include <GL/glut.h>
#endif



void init(void){
	glClearColor(0,0,0,0);
	glShadeModel(GL_FLAT);
}

void reshape(int w,int h){
	glLoadIdentity();
	glMatrixMode(GL_MODELVIEW);
	glOrtho(0.0, 1.0, 0.0, 1.0, -1.0, 1.0);

}



void display(void){

		
	glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);

	glLoadIdentity();
	
	double v[] = { 
		-1,-1,
		1,1,
		0.3,0,
		0.7,-0.5
	};

	GLubyte one[] = {0,1,3,1};
	GLubyte two[] = {0,2,3,2};
	
	GLvoid * indices[2] = {one,two};

	glEnableClientState(GL_VERTEX_ARRAY);

	glVertexPointer(2,GL_DOUBLE,0,v);

	glMultiDrawElements(GL_LINES,(int*)4,GL_UNSIGNED_BYTE,(const void **)indices,2);

	glutSwapBuffers();
}

int main(int argc , char** argv){

	glewInit();
	glutInit(&argc , argv);
	glutInitDisplayMode(GLUT_DOUBLE|GLUT_RGBA);
	glutInitWindowSize(500,500);
	glutInitWindowPosition(0,0);
	glutCreateWindow(argv[0]);
	init();
	glutDisplayFunc(display);
	glutReshapeFunc(reshape);
	glutMainLoop();
	return 0;
}

Thanks.

Edited by Levent Cpp

Share this post


Link to post
Share on other sites
Sign in to follow this