Jump to content

View more

Image of the Day

#ld38 #screenshotsaturday Mimosa Fizz action gif #2 https://t.co/TUzdppvfUL
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now

White Screen When Using glMultiDrawElements

4: Adsense

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.


  • You cannot reply to this topic
No replies to this topic

#1 Levent Cpp   Members   

289
Like
0Likes
Like

Posted 07 June 2014 - 08:18 AM

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, 09 June 2014 - 11:32 AM.





Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.