Jump to content

[SOLVED] DrawLine and DrawRect do not draw


codeape
 Share

Recommended Posts

bool App::Loop()
{
//Close the window to end the program
if (window->Closed()) return false;

//Press escape to end freelook mode
if (window->KeyHit(Key::Escape))
{
window->ShowMouse();
return false;
}

context->SetColor(1,0,0);
context->DrawLine(0,0,200,200);
context->SetColor(0,1,0);
context->DrawRect(0,0,100,100);

Leadwerks::Time::Update();
world->Update();
world->Render();
context->Sync(false);

return true;
}

 

When I run this code (the default code) I only see the default map but no 2D Line or Rectangle:

 

I have also tried adding Clear() from the Command reference examples (could not find any doc on Clear though, is it OpenGL context clear?):

 

context->SetColor(0,0,0);
context->Clear();
context->SetColor(1,0,0);
context->DrawLine(0,0,200,200);
context->SetColor(0,1,0);
context->DrawRect(0,0,100,100);

 

I run Ubuntu 14:04:

lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 14.04.1 LTS
Release:	 14.04
Codename:	 trusty

Link to comment
Share on other sites

use the 2D draw commands after you have rendered not before or you will just over write them

 

Leadwerks::Time::Update();
world->Update();
world->Render();

context->SetColor(1,0,0);
context->DrawLine(0,0,200,200);
context->SetColor(0,1,0);
context->DrawRect(0,0,100,100);

context->Sync(false);

  • Upvote 3

Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590

LE / 3DWS / BMX / Hexagon

macklebee's channel

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...