1. Graphical programming

Hi everyone,

I have been working with Euphoria for about a month or so now and interested in creating a small game if there is a graphic lib available. I checked out older posts but I am unable to find any working links to download one.

Is it possible to use native openGL within Euphoria, if so how can I get started?

Kirk

new topic     » topic index » view message » categorize

2. Re: Graphical programming

I certainly wish we had wrappers for 3d rendering open source cross platform engines such as Ogre or IrrLicht but from what Ive see on the list for 3d on rapideuphoria.com is Horde3D by Mark Brown which from what Ive just read (following his link) looks promising to dive into.

new topic     » goto parent     » topic index » view message » categorize

3. Re: Graphical programming

There are a few libraries to use for graphics programming. There are wrappers for SDL, Allegro and SFML for Euphoria. I had also planned on making a wrapper of Irrlicht 3D for Euphoria, but Irrlicht is so OOP based, not as easy as with a C written engine or library. There is also a OpenGL wrapper for Euphoria as well.

new topic     » goto parent     » topic index » view message » categorize

4. Re: Graphical programming

A while back somebody posted a 3D graphic animation of a hot looking babe walking though the woods. It was written Euphoria. I remember commenting that I would like to see her close off. He replied that he had thought of that but this was part of a game he was developing and he didn't want to go in that direction. This may have been a few years back. Does anybody remember that post? He said what library he was using in that post.

Anyhow Ken didn't say anything about 3D graphics in his post. I don't see why he couldn't use the standard commands in graphics.e and

func adjustBrightness(atom pColor, atom pAdjustment)   Applies a luminosity factor to a color supplied as a 24-bit integer.  
proc bitBlt( dst, dstX, dstY, src, srcX, srcY, wide, high, rop )   Copy image (or partial image) from source to destination.  
func colorValue(object Color)   Converts the parameter into the equivalent 24-bit color value.  
proc copyBlt( dst, dstX, dstY, src )   Copy full image from source to destination.  
func copyToBitmapFile( window, fileName, x1, y1, x2, y2 )    Copies image from window to file fileName.  
func copyToTrueColorBitmapFile( window, fileName, x1, y1, x2, y2 )    Copies image from window to file fileName.  
func createDIB( data )   Converts a Euphoria bitmap format into a Win32 bitmap.  
proc drawArc( window, filled, x1, y1, x2, y2, xStart, yStart, xEnd, yEnd )   Draw an arc.  
proc drawBitmap( window, DIB handle, x, y )    Draws DIB (device independant bitmap) in window at { x, y }.  
proc drawChord( window, filled, x1, y1, x2, y2, xStart, yStart, xEnd, yEnd )   Draw a chord.  
proc drawEllipse( window, filled, x1, y1, x2, y2 )   Draw an ellipse.  
proc drawLine( window, pStartX, pStartY, pEndX, pEndY )   Draw a line.  
proc drawLines( integer id, sequence coords )   Draws zero or more lines.  
proc drawPie( window, filled, x1, y1, x2, y2, xStart, yStart, xEnd, yEnd )   Draw a pie slice.  
proc drawPolygon( integer id, integer filled, sequence points )   Draw a polygon.  
proc drawRectangle( window, filled, x1, y1, x2, y2 )   Draw a rectangle.  
proc drawRoundRect( window, filled, x1, y1, x2, y2, xc, yc )   Draw a rounded rectangle.  
func extractIcon( sequence Filename )   Gets the an icon from the file (DLL, EXE or ICO) specified.  
func fillRectangle(integer id,object rectangle,integer isColor,object filler,integer transp)    Fills a rectangle in the window id with an arbitrary brush.  
func floodFill( atom pControl, integer pXStart, integer pYStart, object pColor, integer pFillType)   Performs a 'flood fill' operation.  
func getPixel( window, x, y )    Get a pixel value from window's client area.  
func loadBitmapFromFile( file name )   Loads a bitmap file.  
func mixColors(sequence colors,object weight,integer output_triple)    Computes the weighted average of the supplied colors by calling w32average()  
func newColor(sequence name,object val)    Attempts to define a new color named name with value value  
proc repaintFG( window )    Force window to be repainted but without clearing it first.  
proc repaintRect( window, x1, y1, x2, y2 )    Force window to be partially repainted.  
proc repaintWindow( window )    Force window to be entirely repainted.  
func rgb( integer red, integer green, integer blue )   Convert a {red, green, blue} tuple into a 24-bit color value.  
proc setBackColor( integer id, object color )    Set the color for used for the pen fill color in id.  
func setPaintPolicy(integer id,integer pFlag)   Possibly sets the paint policy flag.  
proc setPenBkColor( window, color )   Determines the background color for text.  
proc setPenBkMode( window, mode )   Determines if the background color for lines and text.  
proc setPenBrushColor( window, color )   Determines the solid brush color for filled shapes.  
proc setPenColor( window, color )    Set the the pen color used in window.  
proc setPenMode( integer id, integer mode )   Determines what mode graphics are drawn in.  
proc setPenStyle( window, style )   Set the style that lines are drawn in.  
proc setPenWidth( window, pixel width )    Set the the pen width used in window.  
proc setPixel( window, x, y, rgb color )    Set a pixel value in window's client area.  
func split_rgb( object pColor)   Convert a color into a {red, green, blue}.  
proc stretchBlt( dst, dstX, dstY, dstWide, dstHigh, src, srcX, srcY, srcWide, srcHigh, rop )   Copy image (or partial image) from source to destination, changing its size as you go.  
func textToBitmap( text )   Converts a sequence of text into a monochrome bitmap.  
proc transBlt( dst, dstX, dstY, src )   Copy full image from source to destination, with transparency.  
 
Found in win32lib.ew 
 
Also win32dib.ew for manipulating bitmaps. 
 
Don Cole 
new topic     » goto parent     » topic index » view message » categorize

5. Re: Graphical programming

Never mind that reply.

I wasn't familiar with openGL.

Don Cole

new topic     » goto parent     » topic index » view message » categorize

6. Re: Graphical programming

In 2000 it would have been great for a slow 2D game, jump forward to 2013. Blender, 3DS Max or some poly/mesh modeling toolkit skill is required to get any attention. OpenGL hits the low level operations for very fast display. the rendering engines we listed Don have figured out how to make certain things in scenes even easier for us (shading, shadows, etc), we just have to plug into them. I liken this to win32lib being a bridge to windows api.. and euphoria having its routes in C. Use whatever will get the job done, quickly.. :)

new topic     » goto parent     » topic index » view message » categorize

7. Re: Graphical programming

Thank you for your responses. I am using linux so the win32lib wouldn't work for me. That is why I am looking at openGL as its cross platform. After reading this http://www.rapideuphoria.com/platform.htm documentation from section 5 onwards, its possible to call c functions from within eurphoria so I can use openGL directly?

new topic     » goto parent     » topic index » view message » categorize

8. Re: Graphical programming

Don't reinvent the wheel. There are already a couple dozen variations on wrapping the OpenGL libraries: Euphoria Archive

new topic     » goto parent     » topic index » view message » categorize

9. Re: Graphical programming

Hello the answer to that question is yes, you can call C from euphoria.. :)

a search for opengl on rapideuphoria.com returns several demos and wrappers yet most are in the windows archive section.

OpenGL is by-far the lowest you can get to the hardware, well, for the modern graphics card GPU's like ATI and nVidia, both of these companies make their graphics drivers adhere very closely to accelerating the OpenGL code. You will hear in your prep work about "GLUT" and "freeGlut" they are simple windowing application programming interface (API) that allows you to create and manage windows containing OpenGL contexts on a wide range of platforms and also read the mouse, keyboard and joystick functions. "GLUT" makes it considerably easier to learn about and explore OpenGL programming. The original GLUT library seems to have been abandoned however freeglut continues to keep track with OpenGL making it a better alternative. And then there is "SDL" which acts as a cross-platform wrapper, providing support for 2D pixel operations, sound, file access, event handling, timing and threading. It is often used to complement OpenGL by setting up the graphical output and providing mouse and keyboard input, which are not supported by older versions of OpenGL.

get into one of the above mentioned wrappers that have been wrapped using euphoria..

WINDOWS OS
A library for accessing the powerful 3-D animated graphics of OpenGL by Mic
* http://www.rapideuphoria.com/euglr9.zip

A wrapper for GLUT by Mic
* http://www.rapideuphoria.com/glue4.zip

A wrapper for freeglut by Elliott Sales de Andrade
* http://www.rapideuphoria.com/freeglut-2.2.0.zip

LINUX (specific)

A wrapper for SDL by Mark Akita
* http://www.rapideuphoria.com/sdl_wrap.tar.gz

These are just a few, there are lots of wrappers in euphoria for these but Im not entirely sure all of them work with the latest version of euphoria..

I did test glue4 up there on windows 8 last night and it worked fine.
start hanging around some of the better known tutor sites for OpenGL.

Neon Helium http://nehe.gamedev.net/

OpenGL tutorials http://www.opengl-tutorial.org/

also, be prepared to learn 3D modeling using blender or 3DS Max..
Ive tried sketchup but it doesnt create the collada files properly

Good luck and have fun!

new topic     » goto parent     » topic index » view message » categorize

10. Re: Graphical programming

m_sabal said...

Don't reinvent the wheel. There are already a couple dozen variations on wrapping the OpenGL libraries: Euphoria Archive

I think reinventing the wheel is a great learning experience but is not pratical for a time critical project.

Euman said...

also, be prepared to learn 3D modeling using blender or 3DS Max.. Ive tried sketchup but it doesnt create the collada files properly

I will definatly look into some of these wrappers but I would be interested in giving it ago myself with openGL. I have had some exposure to Blender in the past but will look into again although 3D modelling is not something I am interested in.

Thank you for your replys.

Kirk

new topic     » goto parent     » topic index » view message » categorize

11. Re: Graphical programming

Kirkkaf13 said...
m_sabal said...

Don't reinvent the wheel. There are already a couple dozen variations on wrapping the OpenGL libraries: Euphoria Archive

I think reinventing the wheel is a great learning experience but is not pratical for a time critical project.

Euman said...

also, be prepared to learn 3D modeling using blender or 3DS Max.. Ive tried sketchup but it doesnt create the collada files properly

I will definatly look into some of these wrappers but I would be interested in giving it ago myself with openGL. I have had some exposure to Blender in the past but will look into again although 3D modelling is not something I am interested in.

Thank you for your replys.

Kirk

EDIT: Apparently my reading skills are awful today. You are using Linux so most of my recommendations below won't work out of the box. Some de-Windowsing will need to occur. The wrapped tutorials should be fairly easy to translate though as they are all pretty small.

If you want to give it a go using plain OpenGL then I would encourage you to utilize the OpenGL wrapper included in my Zapox engine. It has most of the modern openGL functions wrapped exposing custom shaders as well as VBOs. The engine itself has some additional features you are free to strip out as necessary as well. It includes examples on custom shaders, color picking (3d picking), a fully functioning rendering pipeline, on the fly geometry creation, model loading, and a bunch more. Most of it is working code but its a good start for learning OpenGL on Euphoria. I also wrapped several of the Modern OpenGL tutorials from http://en.wikibooks.org/wiki/OpenGL_Programming. That is on the rds archive as well. If you have used OpenGL in the past I highly recommend those tutorials to get up to speed on modern OpenGL - it is quite a bit different from the fixed function days.

I am about half way through wrapping the Assimp model loading library which will simplify loading different model formats. It works but I need to write some rendering examples.

Note: I would highly recommend using SDL as your basic windowing library. OpenGL by itself doesn't handle input support and it greatly simplifies setting up the initial OpenGL context.

Thanks,

Steve A.

new topic     » goto parent     » topic index » view message » categorize

12. Re: Graphical programming

Hi Steve,

Thank you for recommending your Zapox engine I will definately take a look as I don't currently have any experiencing with OpenGL so I might be throwing myself in the deep end. I have heard good things about SDL the main feature I need in a graphics lib is to be cross platform.

Kirk

new topic     » goto parent     » topic index » view message » categorize

13. Re: Graphical programming

ssallen said...

I am about half way through wrapping the Assimp model loading library which will simplify loading different model formats. It works but I need to write some rendering examples.


Awesome

I was looking at stblib last night https://code.google.com/p/stblib/ primarily stb_image.c http://nothings.org/
a single file image loading library for (jpg png bmp tga psd gif hdr pic) this might help with the texture loading
its suppose to be really fast.

new topic     » goto parent     » topic index » view message » categorize

14. Re: Graphical programming

Hi Guys,

I am attempting to run some of the examples in the SDL_Wrap lib for Linux.

After running the example Fireworx.ex I am getting the following error:

said...

Fireworx.ex:89 in procedure init() c_proc.c_func: bad routine number(-1)

Here is the routine at line 89:

dummy = SDL_Init(SDL_INIT_VIDEO+SDL_INIT_TIMER) 
    if dummy = -1 then 
        puts(1, "SDL_Init had a hissy fit!\n") 
    end if 

and here is the sdl_wrap:

xSDL_Init=define_c_func(sdl,"SDL_Init",{C_UINT},C_INT), 
xSDL_InitSubSystem=define_c_func(sdl,"SDL_InitSubSystem",{C_UINT},C_INT), 
xSDL_QuitSubSystem=define_c_proc(sdl,"SDL_QuitSubSystem",{C_UINT}), 
xSDL_Quit=define_c_proc(sdl,"SDL_Quit",{}), 
xSDL_WasInit=define_c_func(sdl,"SDL_WasInit",{C_UINT},C_UINT), 
xSDL_GetError=define_c_func(sdl,"SDL_GetError",{},C_UINT) 
 
-- SDL_Init -- Initializes SDL 
global function SDL_Init(atom flags) 
    return c_func(xSDL_Init,{flags}) 
end function## 

Anyone know why I am getting this error?

Thanks.

Edit: Removed duplicate post, added <eucode> tags. FYI, ## is for inline code, like this: function() and <eucode> is for blocks of Euphoria code. -Greg

new topic     » goto parent     » topic index » view message » categorize

15. Re: Graphical programming

I used the M Akita's wrap a couple years ago on red hat just fine. Let me look up some of my old code to see what changes I made.

Also, check which version of SDL your box has. If it has version 2 that function might be named differently.

new topic     » goto parent     » topic index » view message » categorize

16. Re: Graphical programming

ssallen said...

I used the M Akita's wrap a couple years ago on red hat just fine. Let me look up some of my old code to see what changes I made.

Also, check which version of SDL your box has. If it has version 2 that function might be named differently.

I wrote a wrapper for SDL 2. It should be cross platform. I have tested it under Windows, but I have not tested it under Linux. I also wrote wrappers for the new SDL_Image and SDL_Mixer as well. SDL 2 should be very suitable for graphical programming.

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu