Amiga.org
Operating System Specific Discussions => Amiga OS => Amiga OS -- Development => Topic started by: kas1e on December 24, 2004, 03:57:09 PM
-
hi 2 all.
i have very funny problem in warp3d develop. i can't draw a line :)
So:
1. W3D_RequestModeTags for Mode it
2. OpenScreenTags for open screen
3. init bitmap for w3d_context (bm=screen->RastPort.BitMap)
4. create context by W3D_CreateContextTags
well, i check on error result from this func, and
i have W3D_Success.
5. Problem here :) I try:
line.v1.x = 0;
line.v1.y = 0;
line.v2.x = 100;
line.v2.y = 400;
res = W3D_DrawLine(context,&line);
if(res==W3D_SUCCESS){printf("we draww a line\n");};
I do not W3D_LockHardware, becouse use W3D_CC_FAST, TRUE in context.
So, if i run it, i have:
"create context succesul"
"we draw a line"
and nothink happening on my screen. I try use W3D_SetDrawRegion, W3D_SetCurrentColor, W3D_SetState(indirect) .. any case - i do not view my line :( Why ? (But W3D_DrawLine said "ok" as you can see).
thanks fro answers
-
Why do you think that you don't need to call W3D_LockHardware because of W3D_CC_FAST ? This wil only allow the driver to modify your vertex structures, and I think only the Virge driver actually makes use of this.
You still need to call W3D_LockHardware. The point of W3D_Lockhardware is to ensure that the bitmaps used for textures and the drawing region are in display memory, and can't move.
I should probably warn you that not all drivers can draw lines. You can use W3D_Query to check if it can draw lines by querying for W3D_Q_DRAW_LINE.
If it can, but you still don't get a line, then it's a bug... If it returns W3D_SUCCESS, then it's definitely a bug since the function should inform you that the context isn't locked...
What graphics card are you using ?
-
I do not using LockHardware now, becouse it HALT my system. It strange, look at this:
context=W3D_CreateContext(&CError,
W3D_CC_MODEID, MODEID,
W3D_CC_BITMAP, bm,
W3D_CC_YOFFSET, 0,
W3D_CC_DRIVERTYPE, W3D_DRIVER_BEST,
TAG_DONE);
line.v1.x=0;line.v1.y=0;
line.v2.x=100;line.v2.y=300;
res=W3D_LockHardware(context);
if(res==W3D_SUCCESS){printf("success\n");};
if(res==W3D_NOTVISIBLE){printf("bitmap problem\n");};
W3D_DrawLine(context,&line);
W3D_UnLockHardware(context);
Delay(100);
W3D_DestroyContext(context);
if i running it, i do not view my line, system HALT and only reboot can help :) I do somethinks wrong ?
So, i using indirect mode now .. And can draw a line, but problem with W3D_Query. I mean i can draw line, but W3D_Query(context,W3D_Q_DRAW_LINE,W3D_FMT_CLUT); said me "w3d_not_supported". But next string is a W3D_DrawLine and it work :)
I am use Voodoo3 in my mediator on a1200. All samples from Warp4.2 working.
-
I do not using LockHardware now, becouse it HALT my system. It strange, look at this:
Without LockHardware, you can't use 3D graphics. One thing to look out for is anything that would do a graphics operation on the screen. You call "printf". You can't do that in LockHardware, because amoung other things, LockHardware calls the CyberGraphics/Picasso96 equivalent of LockBitMap. LockBitmap is global, you can only lock one bitmap at a time. printf and the subsequent output in the shell will also call LockBitMap, which will lock up because you already hold another lock.
The only possibility to get around this is not to use printf or other functions during a W3D_LockHardware
-
thanks for answers :)
ok, printf get out, and lockhardware was ok.
I have check by W3D_Query on all possibly variants, and is strange (?), but my voodoo3 said 'can't supported draw a line, can't supported draw a point". But i can draw a line in indirect and direct mode :) where is true ?:)
-
It definitely can't draw points. The Voodoo chip itself can't draw line, either, so initially, it wasn't implemented. Later on, we implemented lines by drawing a thin triangle strip, but obviously forgot to update the query table. Thanks for the pointer.
-
"Later on, we implemented" - "we" mean we the Elbox ?:)
btw, where is the best way for create 640x480x16bit bitmap ?
i have 040/33 and want fast fading/scrolling/etc. can i do it
with warp3d ? For example, load picture as texture, upload to
memory, lockhardware and put picture to screen (as texture).
I hope it can be fast ? I tryed this by cybergraphics.library
(by WritePixelArray) and have slow speed with scrolling these screen and fading too..
-
Voodoo3 can only use 256x256 textures.
-
kas1e wrote:
"Later on, we implemented" - "we" mean we the Elbox ?:)
"We" means we, as in Hans-Jörg and me. The Warp3D drivers are never done by Elbox.
btw, where is the best way for create 640x480x16bit bitmap ?
i have 040/33 and want fast fading/scrolling/etc. can i do it
with warp3d ?
No, Warp3D can't allocate bitmaps. You need to allocate them via graphics.library, and make them a friend bitmap of your screen's or window's bitmap.
For example, load picture as texture, upload to
memory, lockhardware and put picture to screen (as texture).
I hope it can be fast ? I tryed this by cybergraphics.library
(by WritePixelArray) and have slow speed with scrolling these screen and fading too..
Forget WritePixelArray for such things. If you need to write an offscreen bitmap to the screen or a window, use ClipBlit, or Warp3D :-D It should be pretty fast with the Voodoo...
Note, though, as Crumb already said, that the Voodoo 3 can only do 256x256 textures... Yu can query that as well via W3D_Query... The P2, for example, supports up to 2048x2048.
If you need "odd" formats, create multiple textures, and draw them as "tiles", i.e. cut the picture into 256x256 blocks, and render them to the screen as 256x256 pixel quads or triangle fans.