Graphics module

BlitzMax Forums/BlitzMax Beginners Area/Graphics module

jankupila(Posted 2010) [#1]
I am not very advanced programmer with Blitzmax. Which graphics module you recommend for me? If I use one, is it easy to turn my codes to .exe files? Can my include my images and music to the .exe file?


Zeke(Posted 2010) [#2]
use opengl. and use 'IncBin' command.


jankupila(Posted 2010) [#3]
I thought slightly higher level module than opengl. And what I mean by that, assembly and C++ are lower level than Blitzmax.

Last edited 2010


Zeke(Posted 2010) [#4]
then you need to make own gfx module..


jankupila(Posted 2010) [#5]
Haven't somebody done it already?


Zeke(Posted 2010) [#6]
whats wrong brl modules (openGL,Directx7,DirextX9)??


jankupila(Posted 2010) [#7]
Well, maybe I have to start to learn OpenGl. Am I right, does blitzmax support OpenGl or do I have to import module for it? I am quite new with these things.


Zeke(Posted 2010) [#8]
if you speak finnish then i may help you with Email.


Czar Flavius(Posted 2010) [#9]
Don't give him confusing advice.

jankupila, BlitzMax comes with OpenGL and DirectX 2d graphics as standard. You don't need another module or to use OpenGL directly.

Here is an example

SetGraphicsDriver GLMax2DDriver()
  
Graphics 640, 480

SetColor 255, 0, 0
DrawRect 50, 50, 100, 100
SetColor 0, 255, 255
DrawOval 400, 100, 50, 50
SetColor 255, 255, 0
DrawText "Drawing graphics!", 300, 300
Flip
WaitKey()


When you run your program, an exe is automatically made for you in the same folder as your source code file. You can run this independantly of BlitzMax.


jankupila(Posted 2010) [#10]
I speak Finnish and I take advice more than happily.


jankupila(Posted 2010) [#11]
I would like to have a link for good OpenGL tutorial.


GaryV(Posted 2010) [#12]
You do not need an OpenGL tutorial, you only need a BlitzMax tutorial. Using OpenGL/DirectX is transparent in BlitzMax. Simply set the driver and there is no API specific code required as long as you are using BM's syntax.


_Skully(Posted 2010) [#13]
http://www.cs.uccs.edu/~semwal/indexGLTutorial.html


John G(Posted 2010) [#14]
"I thought slightly higher level module than opengl."
As GaryV says above, you should start with BlitzMax Max2D module which is higher level and much simpler than OpenGL.


jankupila(Posted 2010) [#15]
_Skully, thanks for the link.

Last edited 2010


jankupila(Posted 2010) [#16]
I figured it out how to use Incbin, here is small example for those who are not familiar with it.

Strict

Incbin "D:\kuva-library\hahmoja\face002.png" 'put here your image

Graphics 800,600
Local img:TImage = LoadImage("incbin::D:\kuva-library\hahmoja\face002.png")                'and same to here.

While Not KeyDown(key_escape)
	Cls
	DrawImage img,MouseX(),MouseY()
	Flip
Wend



Last edited 2010


xlsior(Posted 2010) [#17]
Tip: I don't think it really makes a difference when you are using incbin, but in general it's a bad idea to use absolute paths.

Use relative paths, which don't depend on a specific computer configuration to work.

e.g. put your images inside of a subfolder under your application folder itself, and you can then load the image as "images\face002.png" (or "incbin::images\face002.png")
The advantage of that is that you don't have a dependency on the d:\ drive in the mix, allowing you to move the folder to different locations altogether, or be able to function on a computer that doesn't have a D:\ drive at all)


Czar Flavius(Posted 2010) [#18]
Well, maybe I have to start to learn OpenGL Am I right, does blitzmax support OpenGl or do I have to import module for it? I am quite new with these things.
You don't have to learn any OpenGL. Blitzmax works with OpenGL automatically for you. Paying money for Blitzmax just to write OpenGL with it kind of defeats the point of buying it.

Here is a good tutorial on getting starting with Blitzmax:
http://www.2dgamecreators.com/tutorials/gameprogramming/index.html


jankupila(Posted 2010) [#19]
Ok thanks :) I am now familiar with oop, types and Tlist.

Last edited 2010