PDA

View Full Version : Having trouble with rendering



dcr269
03-03-2016, 08:36 AM
Hello,
I have a very basic geometry renderer that I'm working on:
Basically the window is opened a background drawn and an XYZ tetrahedron is displayed.
After that as the user measures geometry the window should update the view to add the new geometry to the existing view. basic lines, circle, points,cones etc:
The problem I'm running into is that no mater what I can not get the window to update and show the new data.
This should be simple but I'm stumpted

Draw function:

begin

glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT);
glLoadIdentity;
DrawGradientBackGround;
DrawXYZOrientation;

glRotated(AX, 1.0, 0.0, 0.0);
glRotated(AY, 0.0, 1.0, 0.0);

SwapBuffers(wglGetCurrentDC);

end;

and the draw line function:
Begin

glBegin(GL_LINES);
glColor3f(1.0, 1.0, 0.0);
glvertex3f(0.0,0.0,0.0);
glvertex3f(3.0,3.0,3.0);
glEnd;

End;

Simple enough but the draw line function never shows anything in the window
Please help

Thanks
-Derrek

uwi2k2
03-04-2016, 01:42 AM
hi,

i guess we need to see the complete code, to see your main loop or your callback funcs.

uwi2k2

dcr269
03-04-2016, 06:17 AM
hi,

i guess we need to see the complete code, to see your main loop or your callback funcs.

uwi2k2

{---------------------------------------}
procedure DrawFeature(idx: integer);
begin
{
Draw a feature... idx is the index
of the FeatureList
}
// ent := CreateOLEObject('Blox.Entity');
df := TFeature(FeatureList[idx]);
// DebugOut('VIEW -> DrawFeature: ' + df.Name);
// Application.MessageBox('Im in DrawFeature',0,0);
case df.ftype of
ft_point: exit;
ft_arc: exit;
ft_circle: DrawCircle(TFCircle(df));
ft_line: DrawLine(TFLine(df));
ft_angle: DrawAngle(TFAngle(df));
ft_distance: DrawDistance(TFDistance(df));
ft_slot: DrawSlot(TFSlot(df));
// djb - 5/8/02 - added cylinderID and coneID
ft_cylinder, ft_cylinderID: DrawCylinder(TFCylinder(df));
ft_cone, ft_coneID: DrawCone(TFCone(df));
ft_sphere: DrawSphere(TFSphere(df));
ft_plane: DrawPlane(TFPlane(df));
ft_3dAngle: exit;
end;

//if draw = true then
// begin
//RefreshPartView();
// Application.MessageBox('Im past Draw Feature',0,0);
// if wirefeat then
// ent.Visual.Color := CurMode.PartLineColor
// else
// ent.Visual.Color := CurMode.PartPlaneColor;
// ent.Name := df.Name;
// end;
end;

{---------------------------------------}


{---------------------------------------}
procedure DrawLine(dline: TFLine);

begin

with dline do begin

// draw a line..
// with StartPoint do p1.Set(xn(plane),yn(plane),zn(plane));
// Application.MessageBox('Im in DrawLine',0,0);
// with EndPoint do p2.Set(xn(plane),yn(plane),zn(plane));

Form2.DrawOpenGlLine(StartPoint ,EndPoint);

end;
end;

procedure TForm2.DrawOpenGLLine(StartPoint, EndPoint : TObject) ;
Begin

glBegin(GL_LINES);
glColor3f(1.0, 1.0, 0.0);
glvertex3f(0.0,0.0,0.0);
glvertex3f(3.0,3.0,3.0);
glEnd;

End;

dcr269
03-04-2016, 06:24 AM
For whatever reason I cant post the actual opengl setup code

Basically a timer kicks the draw feature which if there is anything new It will draw I started with line but as you can see there are other feature I will get to once I figure out whats goning on with lines.

Derrek