View Full Version : getting max and min coordinate values after using glVertex* several times
MarcinD
08-05-2003, 01:53 AM
For example We use glVertex* 10 times and after that we want to know what were the maximum and minimum values of coordinates used in x,y,z direction. Is it possible to get such information from OpenGL?
Is so is it possible to 'tell' opengl state machine: 'reset old max and min values and start checking it from now'?
errno
08-05-2003, 02:51 AM
AFAIK, no. maybe using vp ...
is it possible to have persistant registers ?
jebus
08-05-2003, 04:13 AM
instead of throwing OpenGL numbers, use variables. then, after the glVertex* calls, you have 10 variables...and from these you can find the min and max.
jebus
GlutterFly
08-05-2003, 06:33 AM
for example:
float curMax;
GLfloat tenVerts[10][3];
//set the value of the ten verts with the tenVerts[10][0] = x coord;
tenVerts[10][1] = y coord;
tenVerts[10][2] = z coord;
// after display
for(int i = 0; i < 3; i++)
{
switch(i)
{
case0: curMax=minXVal;// suply min x val
case1: curMax=minYVal;// suply min y val
case2: curMax=minZVal;// suply min z val
}
for(int k = 0; k < 9; k++)
{
if(tenVerts[k][i] > curMax)
{
curMax = tenVerts[k][i];
}
}
}
MarcinD
08-05-2003, 05:25 PM
Thank You for your help,
I know i can remember values and later calculate it but im writting library based on OpenGL so i must allow other user which will use this library for freely using glVertex* (without limits and inconveniences like 'remember your value in the table') and thats why i wanted to take these informations after use glVertex* from OpenGL.
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.