Jump to content

  • Log In with Google      Sign In   
  • Create Account

White Screen Using GLEW functions


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
1 reply to this topic

#1 Levent Cpp   Members   -  Reputation: 289

Like
0Likes
Like

Posted 11 June 2014 - 02:24 AM

Hey i recently found out there is something wrong with my GLEW when i use its functions it's a white screen and when i resize my window it removes the white parts but not all (Image Attached To Post) some functions like glMultiDrawElements Or glDrawRangeElements  .

 

(i linked to glew32s(static) and freeglut , I used #define GLEW_STATIC , glewInit )

 

When I link to glew32 instead of glew32s and i don't define GLEW_STATIC Nothing will Change , Still The White screen.

 

Here is My Code :

#define GLEW_STATIC

#include <GL/glew.h>
#include <GL/glut.h>



void init(void){
	glClearColor(0,0,0,1);
	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);

	double v[] = { 
		0,1,
		0,-1,
		1,-0.5,
		-1,-0.5,
		0,0
	};

	glLoadIdentity();
	
	glEnableClientState(GL_VERTEX_ARRAY);

	glVertexPointer(2,GL_DOUBLE,0,v);
	
	unsigned int index[] = {0,1,1,2};
	
	glDrawRangeElements(GL_LINES,1,3,4,GL_UNSIGNED_INT,index);
	//glDrawElements(GL_LINES,4,GL_UNSIGNED_INT,index);

	glDisableClientState(GL_VERTEX_ARRAY);
	
	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

Attached Thumbnails

  • Untitled.jpg


#2 BitMaster   Crossbones+   -  Reputation: 8495

Like
4Likes
Like

Posted 11 June 2014 - 02:30 AM

That cannot work. GLEW requires an active OpenGL context before you can initialize it. I'm not sure when GLUT guarantees you an active OpenGL context (check the documentation), but certainly not before the first GLUT call.

Edit: You should really get into the habit of checking return values. Checking the result of glewInit() would have put you onto the right track much sooner.

Edited by BitMaster, 11 June 2014 - 02:31 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.




PARTNERS