Click Here
home features news forums classifieds faqs links search
6071 members 
Amiga Q&A /  Free for All /  Emulation /  Gaming / (Latest Posts)
Login

Nickname

Password

Lost Password?

Don't have an account yet?
Register now!

Support Amigaworld.net
Your support is needed and is appreciated as Amigaworld.net is primarily dependent upon the support of its users.
Donate

Menu
Main sections
» Home
» Features
» News
» Forums
» Classifieds
» Links
» Downloads
Extras
» OS4 Zone
» IRC Network
» AmigaWorld Radio
» Newsfeed
» Top Members
» Amiga Dealers
Information
» About Us
» FAQs
» Advertise
» Polls
» Terms of Service
» Search

IRC Channel
Server: irc.amigaworld.net
Ports: 1024,5555, 6665-6669
SSL port: 6697
Channel: #Amigaworld
Channel Policy and Guidelines

Who's Online
22 crawler(s) on-line.
 145 guest(s) on-line.
 1 member(s) on-line.


 kolla

You are an anonymous user.
Register Now!
 kolla:  1 min ago
 amigakit:  25 mins ago
 Rob:  40 mins ago
 Tuxedo:  1 hr 10 mins ago
 zipper:  1 hr 14 mins ago
 OlafS25:  1 hr 17 mins ago
 OneTimer1:  1 hr 19 mins ago
 matthey:  1 hr 38 mins ago
 RobertB:  2 hrs 56 mins ago
 pavlor:  3 hrs 29 mins ago

/  Forum Index
   /  Amiga Development
      /  MiniGL & Bitmaps
Register To Post

PosterThread
AmiDARK 
MiniGL & Bitmaps
Posted on 30-May-2011 16:00:48
#1 ]
Regular Member
Joined: 28-Mar-2007
Posts: 469
From: South France

Hi,

is there a way to create a bitmap and use it temporarly to draw some graphics on it using MiniGL (as a buffer) ?
Didn't find how to ~

Kindest Regards,
AmiDARK

 Status: Offline
Profile     Report this post  
BinoX 
Re: MiniGL & Bitmaps
Posted on 30-May-2011 16:09:12
#2 ]
Cult Member
Joined: 2-Nov-2005
Posts: 711
From: Cornwall, UK

@AmiDARK

Can you not just use glReadPixels after creating the image?

Then just run through the data and save it as a bitmap...

Or am I misunderstanding your request?

Last edited by BinoX on 30-May-2011 at 04:09 PM.

_________________
Back to action!

 Status: Offline
Profile     Report this post  
AmiDARK 
Re: MiniGL & Bitmaps
Posted on 30-May-2011 16:31:54
#3 ]
Regular Member
Joined: 28-Mar-2007
Posts: 469
From: South France

@BinoX
No.

I need to have an alternate RGB buffer and have the capability to switch from one RGB buffer to another one.

Regards,
AmiDARK

 Status: Offline
Profile     Report this post  
broadblues 
Re: MiniGL & Bitmaps
Posted on 30-May-2011 20:24:57
#4 ]
Amiga Developer Team
Joined: 20-Jul-2004
Posts: 4446
From: Portsmouth England

@AmiDARK

You can allocate your bitmaps with graphics library then create a minigl context with private buffers. ie one where you provide the buffers yopurself, and no window is opened directly by minigl.



m_frontBuffer = m_IGraphics->AllocBitMap(w,h,8,BMF_MINPLANES | BMF_DISPLAYABLE,m_window->RPort->BitMap);
m_backBuffer = m_IGraphics->AllocBitMap(w,h,8,BMF_MINPLANES | BMF_DISPLAYABLE,m_window->RPort->BitMap);

if(!(m_mglcontext = (struct GLContextIFace *)IMiniGL->CreateContextTags(
MGLCC_PrivateBuffers, 2,
MGLCC_FrontBuffer,m_frontBuffer,
MGLCC_BackBuffer,m_backBuffer,
MGLCC_Buffers, 2, /* double buffered */
MGLCC_PixelDepth, 16,
MGLCC_StencilBuffer, TRUE,
MGLCC_VertexBufferSize, 1 << 17,
MGLCC_FBDirtyHook,fbdirtyhook,
MGLCC_FBDirtyHookData,this ,
TAG_DONE)))
{




If you only need one buffer at atime ie no backbuffer then set MGLCC_PrivateBuffers to 1 instead.

swap buffers by using

IMiniGL->MGLUpdateContextTags()

with the same tag names for front and back buffers.

Is this waht you mean?

What do you want to do with these buffers?

Last edited by broadblues on 30-May-2011 at 08:26 PM.

_________________
BroadBlues On Blues BroadBlues On Amiga Walker Broad

 Status: Offline
Profile     Report this post  
AmiDARK 
Re: MiniGL & Bitmaps
Posted on 30-May-2011 21:08:08
#5 ]
Regular Member
Joined: 28-Mar-2007
Posts: 469
From: South France

@broadblues
Your idea is really interesting.

However, I don't need double buffer .. single buffer is enough... Drawn mades in that buffer will never be directly displayed.

Sample :
1. Create virtual bitmap
2. Load a big image
3. Paste the image in the buffer
4. Create small images from the big images
5. Close the bitmap

I think that I have resumed things.
Your sample should be enough to give me a direction to search to.

Do you think I can change context even if main display is initialisez using GLUT ?

Thank you
@ +
AmiDARK

Last edited by AmiDARK on 30-May-2011 at 09:28 PM.

 Status: Offline
Profile     Report this post  
Antique 
Re: MiniGL & Bitmaps
Posted on 30-May-2011 21:25:16
#6 ]
Cult Member
Joined: 9-Jun-2005
Posts: 887
From: Norway

@AmiDARK

C'est la vie.

_________________
I'm an antique. Don't light my fuse

 Status: Offline
Profile     Report this post  
elwood 
Re: MiniGL & Bitmaps
Posted on 30-May-2011 21:26:59
#7 ]
Elite Member
Joined: 17-Sep-2003
Posts: 3428
From: Lyon, France

@AmiDARK

Broadblues is english and I don't think he reads french

_________________
Philippe 'Elwood' Ferrucci
Sam460 1.10 Ghz
AmigaOS 4 betatester
Amiga Translator Organisation

 Status: Offline
Profile     Report this post  
AmiDARK 
Re: MiniGL & Bitmaps
Posted on 30-May-2011 21:28:41
#8 ]
Regular Member
Joined: 28-Mar-2007
Posts: 469
From: South France

@elwood
Just edited my previous post.

Sometimes brain act *so fast* that I don't mind to what I do :p
Fixed now :)

Regards,
AmiDARK

Last edited by AmiDARK on 30-May-2011 at 09:29 PM.
Last edited by AmiDARK on 30-May-2011 at 09:29 PM.

 Status: Offline
Profile     Report this post  
K-L 
Re: MiniGL & Bitmaps
Posted on 30-May-2011 21:32:42
#9 ]
Super Member
Joined: 3-Mar-2006
Posts: 1411
From: Oullins, France

@AmiDARK

Arf, You thought you were on Amiga-NG, didn't you ?

@Broadblues

He finds your idea very interesting but he doesn't need double buffer, only one buffer sincegraphics drawed in this bitmap would never be displayed. It would be used as a "hidden" buffer

Example :

1. Creating a "virtual" bitmap
2. Loading of a big size picture in this buffer
3. Paste image in the bitmap
4. Creating small size picture which are actually pieces of the big size one
5. Closing of the virtual bitmap

Your example should be enough for what he plans to do

He finally asks if your example could be used evn if the main context is initialized with MGLUT.

He thanks you a lot

_________________
PowerMac G5 2,7Ghz - 2GB - Radeon 9650 - MorphOS 3.14
AmigaONE X1000, 2GB, Sapphire Radeon HD 7700
FPGA Replay + DB 68060 at 85Mhz

 Status: Offline
Profile     Report this post  
broadblues 
Re: MiniGL & Bitmaps
Posted on 30-May-2011 22:37:06
#10 ]
Amiga Developer Team
Joined: 20-Jul-2004
Posts: 4446
From: Portsmouth England

@AmiDARK

If you don't need doublebuffering the set the the value of MGLCC_PrivateBuffers to 1 and set the buffer using MGLCC_FrontBuffer only. (see minigl/gl.h for afraction more info

If you are going to use these functions alongside GLUT things could get alittle 'hacky' really they are designed to write a replacement for GLUT (they were specifically writen to implement Ghost, blenders window / GL management system, though I did try to make them general)

This assumes you have allready started GLUT

The current GLUT library interface is held in a global variable

struct GlutIFace * __glut_current_context;

to get the glutcontext from the interface use the GET_INSTANCE macro define in glut.h

GLUTcontext ctx = (GLUTcontext)GET_INSTANCE(__glut_current_context);

The minigl context used by glut can be found by doing

struct MiniGLIFace * glut_miniglcontext = ctx->__glutContext;


If say your custom context is amidarkspecial_miniglcontext then before you call any GL function that you want to operate on your speacial rgb buffer call:


mglMakeCurrent(amidark_special_miniglcontext);

then restore the glut context with


mglMakeCurrent(glut_miniglcontext);

You should probably ensure that you have called GLEnd() before swapping contexts like this. Maybe GLWait()

Your going to have to be particularly careful if you are multitasking.

This is abit nasty to be honest. I would be tempted abandon Glut, if you need to do much of this kind of stuff, but then ofcourse you will need to write your own event handlers etc so you may not like to do that.



_________________
BroadBlues On Blues BroadBlues On Amiga Walker Broad

 Status: Offline
Profile     Report this post  
broadblues 
Re: MiniGL & Bitmaps
Posted on 30-May-2011 22:38:55
#11 ]
Amiga Developer Team
Joined: 20-Jul-2004
Posts: 4446
From: Portsmouth England

@translators




_________________
BroadBlues On Blues BroadBlues On Amiga Walker Broad

 Status: Offline
Profile     Report this post  
AmiDARK 
Re: MiniGL & Bitmaps
Posted on 30-May-2011 22:48:35
#12 ]
Regular Member
Joined: 28-Mar-2007
Posts: 469
From: South France

@broadblues

Actually, my objective is to have a working environment.
So the faster is the best (even if it's not 100% the faster engine).
After, when Gallium 3D will be out and ready, I'll start a new version of the engine using Gallium3D ...

Thank you for these extra informations.

Kindest Regards,
AmiDARK

 Status: Offline
Profile     Report this post  
thellier 
Re: MiniGL & Bitmaps
Posted on 31-May-2011 8:46:46
#13 ]
Regular Member
Joined: 2-Nov-2009
Posts: 263
From: Paris

@AmiDARK

Hello AmiDark

Have a look to cow3d on aminet : it use Warp3d for drawing on a non visible bitmap
(then it copy the bitmap to the window)
This example dont use minigl but directly warp3d but certainly the idea stay the same

Alain Thellier

 Status: Offline
Profile     Report this post  
Jupp3 
Re: MiniGL & Bitmaps
Posted on 1-Jun-2011 15:26:23
#14 ]
Super Member
Joined: 22-Feb-2007
Posts: 1225
From: Unknown

@BinoX

Quote:
Can you not just use glReadPixels after creating the image?

glReadPixels() is really slow function (as it requires GFX RAM => RAM transfers) and should be avoided, whenever possible. Of course it won't matter that much if done "only at initialization", but should definitely be avoided, if it's per frame, or even worse, multiple times per frame. Not sure which one this case is.

Also, this approach can downgrade 24bit images to 15/16bit, if the screenmode isn't 24/32bit (in case that matters)

@AmiDARK

Quote:
Sample :
1. Create virtual bitmap
2. Load a big image
3. Paste the image in the buffer
4. Create small images from the big images
5. Close the bitmap

One question, why are you doing this?

If you are f.ex. sprite sheets to single textures, why are you doing that? You can just use a single texture, and change texture coords accordingly. You can get the X & Y coordinates for same size sprites in sheet from single ID number with / and % operators nicely.

With this approach, you might also be able to reduce glBindTexture() calls, use of which should also be reduced, whenever possible.

Note: With sprite sheets, there can be blending issues at the borders of the image with blending in use.

 Status: Offline
Profile     Report this post  
AmiDARK 
Re: MiniGL & Bitmaps
Posted on 1-Jun-2011 17:27:28
#15 ]
Regular Member
Joined: 28-Mar-2007
Posts: 469
From: South France

Hi Jupp3,

AmiDARK Engine is a GDK ( Game Development Kit ) highly inspired from DarkBASIC Professional and DarkGDK ( from TheGameCreators : http://www.thegamecreators.com )

Their GDK contains functions to create and use *virtual non displayable bitmaps*
For Example : Create Bitmap bNumber, Width, Height
And we can draw inside these bitmaps.

I just need to reproduce these commands/functions
The sample was just to show on of the possible usage of virtuals bitmaps.

Kindest Regards,
AmiDARK

 Status: Offline
Profile     Report this post  

[ home ][ about us ][ privacy ] [ forums ][ classifieds ] [ links ][ news archive ] [ link to us ][ user account ]
Copyright (C) 2000 - 2019 Amigaworld.net.
Amigaworld.net was originally founded by David Doyle