Jump to content




[CCGPU] Basic Shapes API [v1.0]



  • You cannot reply to this topic
5 replies to this topic

#1 xuma202

  • Members
  • 288 posts
  • LocationBonn Germany

Posted 03 June 2012 - 11:17 AM

Hi,

This is a simple API for the CCGPU peripheral. I mad this for those not familiar with OpenGL.

Link to Code

You can use it like this:

Code = LineCode(x1, y1, x2, y2, r, g, :)/>/>..CircleCode(x, y, radius, r, g, :D/>/>
drawFrame("back", 1, Code)


Functions:

PointCode(x, y, r, g, b )

  The x, y of the Pixel.
  The RGB-Values of the pixels color (range 0-1).

  Will return a String containing the OpenGL Code.

LineCode(x1, y1, x2, y2, r, g, b )

  The Points (x1|y1), (x2|y2) to line up.
  The RGB-Values of the lines color (range 0-1).

  Will return a String containing the OpenGL Code.


RectangleCode(x1, y1, x2, y2, r, g, b )

  The left- and top-most Point (x1|y1).
  The right- and bottom-most Point (x2|y2).

  The RGB-Values of the rectangles color (range 0-1).

  Will return a String containing the OpenGL Code.


TriangleCode(x1, y1, x2, y2, x3, y3 r, g, b )

  The 1st Point (x1|y1).
  The 2nd Point (x2|y2).
  The 3rd Point (x3|y3).

  The RGB-Values of the triangles color (range 0-1).

  Will return a String containing the OpenGL Code.


CircleCode(x, y, rad, r, g, b )

  The center of the Circle (x|y).
  The radius of the circle rad.

  The RGB-Values of the circles color (range 0-1).

  Will return a String containing the OpenGL Code.

  NOTE: This will generate the outline of a circle. To draw a filled circle use filledCircleCode!


filledCircleCode(x, y, rad, r, g, b )

  The center of the Circle (x|y).
  The radius of the circle rad.

  The RGB-Values of the circles color (range 0-1).

  Will return a String containing the OpenGL Code.

DrawFrame(side, mon_id, code)

  The side on which the GPU is attached to.
  The mon_id.
  The OpenGL code.

  NOTE you can simply concat the functions results.



The Monitors Coordinate system starts with 0 on the x-axis and ends with 127. For the y-axis it starts with 1 and ends with 128. This is caused by the mod itself.

DEMO:
Code = filledCircleCode(63.5, 64.5, 64, 1, 1, 0)..filledCircleCode(32, 32, 8, 1, 1, 1)..filledCircleCode(96, 32, 8, 1, 1, 1)..filledCircleCode(32, 32, 2, 0, 0, 0)..filledCircleCode(96, 32, 2, 0, 0, 0)..TriangleCode(57, 57, 70, 57, 63.5, 70, 0, 1, 0)..LineCode(40, 80, 87, 80, 1, 0, 0)..LineCode(40, 82, 87, 82, 1, 0, 0)

drawFrame("left", 1, Code)

Will generate a this:
Posted Image


xuma202

#2 con2000

  • New Members
  • 28 posts

Posted 03 June 2012 - 11:37 AM

Nice.

#3 Megolas

  • New Members
  • 8 posts

Posted 04 June 2012 - 02:27 PM

The CCGPU doesnt work for the current version, does it?

#4 xuma202

  • Members
  • 288 posts
  • LocationBonn Germany

Posted 04 June 2012 - 03:12 PM

No it doesn't. But I'm not responsible for that. Hopefully Mast3rPlan will update it soon.

#5 xuma202

  • Members
  • 288 posts
  • LocationBonn Germany

Posted 06 June 2012 - 09:25 PM

I'm currently working on a text output method. This will not be Texture based since there is no support yet but I'll add letters that will be drawn pixel by pixel

#6 FuzzyPurp

    Part-Time Ninja

  • Members
  • 510 posts
  • LocationHarlem, NY

Posted 09 August 2012 - 09:18 PM

Cloudy updated it, checked the 2nd to last page on the thread for 1.2.5 - Also moving this to the API section.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users