About Store Forum Documentation Contact



Post Reply 
[Resolved] - Draw shape being drawn in wrong place
Author Message
Ozmodian Offline
Member

Post: #1
[Resolved] - Draw shape being drawn in wrong place
Hi All,

I found something weird today which looks like a bug.

I am using 14 - Game Basics - 14 - Camera Modes and I added a second camera and viewport. I wanted to draw a pyramid and an edge to show where the camera is pointing which works great. However, if I add a terrain type object to the world, the shape will be drawn there unless I am actually looking at the camera.

I have attached my draw function below, the whole source to the post and a video showing it. I also attached the tree in question because i tried the same thing with the rock model and it did not happen which i find even weirder.....

Code:
void Draw()
{
   Camera mainCam = Cam;
   Renderer(Render);
   D.text  (0, 0.9, "Press Tab to switch camera modes");
  
   Pyramid(.5, 2.0 ,Cam2.matrix.pos, !(Cam2.at-Cam2.matrix.pos)).draw(BLUE, false);
   Edge(Cam2.matrix.pos, Cam2.at).draw(BLUE);
   Cam2.set();
   //D.viewFov(1.309);
   Rect MiniMap = Rect((D.viewRect().max - D.viewRect().max/2.0),D.viewRect().max);
   D.viewRect(MiniMap);
  
  
   Renderer(Render);
   mainCam.set();
   D.viewRect(null);






**EDIT - Removed Bug from description **


Attached File(s)
.txt  Sample.txt (Size: 6.53 KB / Downloads: 0)
.rar  t_bamboo1.rar (Size: 127.77 KB / Downloads: 1)
(This post was last modified: 05-08-2013 07:44 AM by Ozmodian.)
05-08-2013 05:50 AM
Find all posts by this user Quote this message in a reply
SamNainocard Offline
Member

Post: #2
RE: Bug? Draw shape being drawn in wrong place
Try put SetMatrix() on first line of Draw()
05-08-2013 07:02 AM
Find all posts by this user Quote this message in a reply
Ozmodian Offline
Member

Post: #3
RE: Bug? Draw shape being drawn in wrong place
Hi Sam,

That is a good thought. I added SetMatrix() right before the draw Pyramid and that seems to have worked. I did not even think about the matrix being moved in the previous render call, nice one.

I think that resolves it. Still not too sure why it only happens with the bamboo model but hey, whatever works.

Thanks a lot!!!
05-08-2013 07:43 AM
Find all posts by this user Quote this message in a reply
Post Reply