PowerVR Series1

Up
QuickStart1
QuickStart2
QuickStart3
QuickStart4
QuickStart5

 

PowerVR SGL Direct Quickstart Tutorial - Step 1

 

Developing a 3D application on PowerVR is easy.
To illustrate this, a very simple PowerSGL Direct example is presented here
which simply draws a triangle on the screen. This can be done in very few steps :

 

#include "sgl.h"
#define RGB(r, g, b) ((sgl_uint32) (((r) << 16) | ((g) << 8) | (b)))
SGLCONTEXT SGLContext;
SGLVERTEX  Vertices[] = {
            /* x      y     z   (1/W)    col       spec.col (u/W)(v/W)*/
            {  0.0f,  0.0f,0.0f,0.1f,RGB(255,0,0),RGB(0,0,0),0.0f,0.0f},
	    {639.0f,  0.0f,0.0f,0.8f,RGB(255,0,0),RGB(0,0,0),0.0f,0.0f},
	    {320.0f,479.0f,0.0f,0.1f,RGB(255,0,0),RGB(0,0,0),0.0f,0.0f}
			};
int        TriFaceData[][3] = {0,1,2};
int        Device;

1

Define the triangle vertices and the triangle face.

void main ()
{
   Device = sgl_create_screen_device (0,640,480,sgl_device_16bit,TRUE);
   if (Device >= 0)
   {

2

Create a screen device

      sgltri_startofframe (&SGLContext);
      sgltri_triangles    (&SGLContext, 1, TriFaceData, Vertices);
      sgltri_render       (&SGLContext);

3

Render !

      sgl_delete_device   (Device);
   }
}

4

Close Screen Device


You may view this source code.

 

Now that the first step is done, we can easily modify this example step by step to make it more fancy.

Firstly, we will simply add another triangle to the scene.
Click here to see how it's done ...

Go to PowerSGL Direct QuickStart Page 2 - 3 - 4 - 5

 

Confidential / provided under Non-Disclosure Agreement
Copyright © 1999-2000, PowerVR Technologies and partners. PowerVR Technologies is a division of Imagination Technologies Limited.