Draw Geometric Primitives in Torque
by Brian Batchelor · in Technical Issues · 05/30/2005 (12:13 am) · 5 replies
I been trying to render OpenGL primitives in theTorque space, without success. The code that I have been using is as follows.
#include "gui/guiBitmapCtrl.h"
#include "console/consoleTypes.h"
#include "console/consoleObject.h"
#include "console/console.h"
#include "dgl/dgl.h"
#include "platformWin32/gl_types.h"
...
ConsoleFunction(DrawLines, void, 7,7, "A simple Test function")
{
F32 y;
for(y = 1.0f; y < 90.0f; y +=1.0f)
{
glColor3f(1.0f, 0.0f, 0.0f);
glBegin(GL_LINES);
glVertex3f(dAtof(argv[1]),dAtof(argv[2]),dAtof(argv[3])+y);
glVertex3f(dAtof(argv[4]),dAtof(argv[5]),dAtof(argv[6])+y);
glEnd();
}
Con::printf("working");
}
Can anyone give me some pointer? Sorry for the bad grammar, I been plugging at this for hours and I'm burned out.
Brian B
#include "gui/guiBitmapCtrl.h"
#include "console/consoleTypes.h"
#include "console/consoleObject.h"
#include "console/console.h"
#include "dgl/dgl.h"
#include "platformWin32/gl_types.h"
...
ConsoleFunction(DrawLines, void, 7,7, "A simple Test function")
{
F32 y;
for(y = 1.0f; y < 90.0f; y +=1.0f)
{
glColor3f(1.0f, 0.0f, 0.0f);
glBegin(GL_LINES);
glVertex3f(dAtof(argv[1]),dAtof(argv[2]),dAtof(argv[3])+y);
glVertex3f(dAtof(argv[4]),dAtof(argv[5]),dAtof(argv[6])+y);
glEnd();
}
Con::printf("working");
}
Can anyone give me some pointer? Sorry for the bad grammar, I been plugging at this for hours and I'm burned out.
Brian B
#2
05/30/2005 (5:28 am)
Or have a look at the Tic Tac Toe tutorial, which shows how to set up Torque to do some custom rendering. Replace the rendering lines (e.g. "roundStoneShapeInstance->render();") with your own primitive code. I know it's not a perfect example for this, but it might just help set up the right states and such for testing custom rendering.
#3
Thanks alot, I got fxRenderObject working, I'm starting on Tic Tac Toe.
Brian B
05/30/2005 (9:23 pm)
Matthew and Thijs Thanks alot, I got fxRenderObject working, I'm starting on Tic Tac Toe.
Brian B
#4
I modifying the fxRenderObject code and realized that "glScalef" does not effect the object. It not a major issue, because changing the QuadSize haves the same effect. I was just wonder why?
Brian B.
05/31/2005 (9:23 pm)
@MatthewI modifying the fxRenderObject code and realized that "glScalef" does not effect the object. It not a major issue, because changing the QuadSize haves the same effect. I was just wonder why?
Brian B.
#5
In renderObject() I just added the glScalef() call:
Maybe you have the wrong matrix mode set at the time?
05/31/2005 (10:01 pm)
Odd...I use glScalef() in my Collision Tutorial Object which is fxRenderObject expanded to include collision capabilities.In renderObject() I just added the glScalef() call:
// Transform by the objects' transform e.g move it. dglMultMatrix(&getTransform()); glScalef(mObjScale.x, mObjScale.y, mObjScale.z);
Maybe you have the wrong matrix mode set at the time?
Associate Matt Fairfax
PopCap