Skip to main content
gamedev.net
🔒 Locked

glVertexPointer

Started by xyz Jul 19, 2003 at 12:09 PM 0 replies 300+ views
Original Post
xyz
xyz
Hi, This is part of my vector class:
CVector(float newX=0.0f, float newY=0.0f, float newZ=0.0f)
	{ x=newX;	y=newY;		z=newZ; }
	CVector(const CVector &rhs)
	{ x=rhs.x;	y=rhs.y;	z=rhs.z; }
	~CVector() {}
 
this is how I define a vertex position:
CVector position;
 
and this is how I use it:
		glVertexPointer(3, GL_FLOAT, sizeof(vertex_t), position);
 
however I cannot use this CVector here:
error C2664: ''glVertexPointer'' : cannot convert parameter 4 from ''CVector'' to ''const GLvoid *''
 
I understand... but how can I make something like this work? Thanks
Yann L
Yann L
Well, as the name implies, glVertexPointer() expects a pointer to a vertex array. So you should do something like this:


CVector *positions = new CVector[...]

glVertexPointer(3, GL_FLOAT, sizeof(vertex_t), positions);


Or use a fixed size array instead.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.