Click here to Skip to main content
16,017,833 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: How to align toolbars? Pin
Anurag Gandhi4-Jun-07 1:38
professionalAnurag Gandhi4-Jun-07 1:38 
AnswerRe: How to align toolbars? [modified] Pin
Rajkumar R4-Jun-07 3:21
Rajkumar R4-Jun-07 3:21 
GeneralRe: How to align toolbars? Pin
Anurag Gandhi4-Jun-07 5:24
professionalAnurag Gandhi4-Jun-07 5:24 
QuestionVector of Pointers Pin
Kevin Brydon4-Jun-07 0:35
Kevin Brydon4-Jun-07 0:35 
AnswerRe: Vector of Pointers Pin
Maximilien4-Jun-07 0:56
Maximilien4-Jun-07 0:56 
AnswerRe: Vector of Pointers Pin
CPallini4-Jun-07 0:57
mveCPallini4-Jun-07 0:57 
GeneralRe: Vector of Pointers Pin
Rajkumar R4-Jun-07 1:19
Rajkumar R4-Jun-07 1:19 
GeneralRe: Vector of Pointers Pin
Kevin Brydon4-Jun-07 1:43
Kevin Brydon4-Jun-07 1:43 
Ok thanks for replying

Max:
Thats basically the design I have but without the geometry class. I am never going to be able to draw a point, it is simply used to construct a line (the system is only going to be able to draw lines)

Pallini, Rajkumar:

Heres some code:
---------------------------------
// holds all the lines
std::vector <line> lines;
// holds all the points
std::vector <point> allpoints;

struct Point
{
public:
GLfloat x, y, z;
bool selected;

/* constructors */
Point()
{
}
Point(const GLfloat & xval, const GLfloat & yval, const GLfloat & zval)
{
}
Point(const Point & from)
{
}

};
/* a class to describe a line in 3 dimensional space */
class Line
{
public:
// each pointer in this vector should point to a Point object in allpoints
std::vector <point*> points;
bool selected;

// Initializes variables
Line()
{

}

Line(int typein)
{

}

// Functions
void addPoint(Point & p)
{
points.push_back(&p);
}
void draw() // ive only included part of it
{

Point current;

glLineWidth(thickness);

glColor3fv(color);

glBegin(GL_LINE_STRIP);
for (int i = 0; i < points.size(); i++)
{
current = *(points[i]);
glVertex3f(current.x, current.y, current.z);
}
glEnd();

}
};
-----------------------------

the reason for storing all the points in one big data structure and then referencing them makes it easier to select the lines and points later on. the "allpoints" in the final implementation is really a vector

std::vector <point> sector[GRID_SIZE][5][GRID_SIZE];

when a point is created it is assigned to a sector based on its x, y, z coordinates (forget about that for now)

when a point is selected i want it to flag "selected = true" by changing its value through the allpoints vector. then when the line is drawn it checks the value of each of its points to see if any has been selected (this is why i use pointers so it checks the actual point and not a copy of it), if so it will change to a different colour.

Rajkumar:
I am using opengl with sdl and im not all that bothered about how fast the system runs as its only really a proof of concept. when i wasnt using pointers the system ran fast (but not using pointers meant that things couldnt be selected)

thanks

kevin
GeneralRe: Vector of Pointers Pin
Matthew Faithfull4-Jun-07 2:09
Matthew Faithfull4-Jun-07 2:09 
GeneralRe: Vector of Pointers Pin
Kevin Brydon4-Jun-07 2:17
Kevin Brydon4-Jun-07 2:17 
GeneralRe: Vector of Pointers Pin
Matthew Faithfull4-Jun-07 2:38
Matthew Faithfull4-Jun-07 2:38 
GeneralRe: Vector of Pointers Pin
Kevin Brydon4-Jun-07 2:39
Kevin Brydon4-Jun-07 2:39 
GeneralRe: Vector of Pointers Pin
CPallini4-Jun-07 2:14
mveCPallini4-Jun-07 2:14 
GeneralRe: Vector of Pointers Pin
Kevin Brydon4-Jun-07 2:23
Kevin Brydon4-Jun-07 2:23 
GeneralRe: Vector of Pointers Pin
Maximilien4-Jun-07 3:05
Maximilien4-Jun-07 3:05 
AnswerRe: Vector of Pointers Pin
Rajkumar R4-Jun-07 3:41
Rajkumar R4-Jun-07 3:41 
GeneralRe: Vector of Pointers Pin
Kevin Brydon4-Jun-07 5:16
Kevin Brydon4-Jun-07 5:16 
GeneralRe: Vector of Pointers Pin
Stephen Hewitt4-Jun-07 15:04
Stephen Hewitt4-Jun-07 15:04 
GeneralRe: Vector of Pointers Pin
led mike3-Mar-08 6:32
led mike3-Mar-08 6:32 
GeneralRe: Vector of Pointers Pin
Stephen Hewitt4-Jun-07 15:01
Stephen Hewitt4-Jun-07 15:01 
AnswerRe: Vector of Pointers [modified] Pin
Rajkumar R4-Jun-07 18:49
Rajkumar R4-Jun-07 18:49 
GeneralRe: Vector of Pointers Pin
Stephen Hewitt4-Jun-07 19:00
Stephen Hewitt4-Jun-07 19:00 
GeneralRe: Vector of Pointers Pin
Rajkumar R4-Jun-07 19:18
Rajkumar R4-Jun-07 19:18 
GeneralRe: Vector of Pointers Pin
Stephen Hewitt4-Jun-07 19:29
Stephen Hewitt4-Jun-07 19:29 
GeneralRe: Vector of Pointers Pin
Rajkumar R4-Jun-07 19:57
Rajkumar R4-Jun-07 19:57 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.