 |

01-13-2012, 11:53 AM
|
 |
Senior Contributor
|
|
Join Date: Feb 2008
Location: somewhere in space
Posts: 1,177
|
|
[VB6] - Starting basic using Directx on VB6
|
i need a nice toturial for directx itself... every toturials that i found was for games, but i need a start thing for learn directx on basic. can anyone advice me?
|
|

01-13-2012, 03:16 PM
|
 |
Lost Soul
Super Moderator * Guru *
|
|
Join Date: May 2001
Location: Vorlon
Posts: 18,882
|
|
Why is it a problem that the tutorials are game oriented?
In almost all cases DirectX is used for games or 3D applications.
http://directx4vb.vbgamer.com/
|
|

01-13-2012, 03:50 PM
|
 |
Senior Contributor
|
|
Join Date: Feb 2008
Location: somewhere in space
Posts: 1,177
|
|
Quote:
Originally Posted by Flyguy
Why is it a problem that the tutorials are game oriented?
In almost all cases DirectX is used for games or 3D applications.
http://directx4vb.vbgamer.com/
|
maybe because i learned on general. when we learn vb6, we don't learn for data, but how use the language and more 
maybe is why.... sorry i still confuse on starting learn directx... so many things for initializate\load it 
i need something for start learning, the basic.
i have 1 chm file from that page... thanks
|
|

01-13-2012, 04:52 PM
|
 |
Ultimate Contributor
Forum Leader * Expert *
|
|
Join Date: Nov 2003
Location: Wigan, UK
Posts: 1,676
|
|
|

01-14-2012, 06:27 AM
|
 |
Senior Contributor
|
|
Join Date: Feb 2008
Location: somewhere in space
Posts: 1,177
|
|
Quote:
Originally Posted by PlausiblyDamp
|
1 questiuon: i know these code is for clean the scren and give it a backcolor:
Code:
D3DDevice.Clear 0, ByVal 0, D3DCLEAR_TARGET, &HCCCCFF, 1#, 0
but '&HCCCCFF' can be expressesd in other way?(because i don't know what color is)
|
|

01-14-2012, 12:00 PM
|
 |
Bald Mountain Survivor
Super Moderator * Expert *
|
|
Join Date: Aug 2003
Location: Oregon, USA
Posts: 5,877
|
|
|
I would imagine that any vb construct that resolves to a color value could be used instead. RGB(204, 204, 255), 13421823, vbBlue, Etc...
|
__________________
Burn the land and boil the sea
You can't take the sky from me
~T
|

01-14-2012, 12:14 PM
|
 |
Senior Contributor
|
|
Join Date: Feb 2008
Location: somewhere in space
Posts: 1,177
|
|
Quote:
Originally Posted by Gruff
I would imagine that any vb construct that resolves to a color value could be used instead. RGB(204, 204, 255), 13421823, vbBlue, Etc...
|
but the directx works in same way(when recive these values the colors are real the same)?
|
|

01-15-2012, 11:55 AM
|
 |
Sinecure Expert
Super Moderator * Guru *
|
|
Join Date: Jun 2003
Location: Upstate New York, usa
Posts: 7,714
|
|
|
Yes, the color value is a long, and three of the bytes in the color represent the RGB (Red, Green, Blue) levels of the colors.
Gruff's first two examples are meant to be the same value as your example line of code, but Intel processors are little endian, and the red color comes first in memory, which is the lower byte of a long.
So, the same color that you have (which should be a very light red, (an off-white pink)), could be expressed in Hex, decimal, or RGB function
&HCCCCFF, 13421823, RGB(255,204,204).
Gruff just had the bytes reversed in the RGB function, following the big endian order that we print numbers in.
|
__________________
There Is An Island Of Opportunity In The Middle of Every Difficulty.
Miss That, Though, And You're Pretty Much Doomed.
|

01-15-2012, 12:27 PM
|
 |
Senior Contributor
|
|
Join Date: Feb 2008
Location: somewhere in space
Posts: 1,177
|
|
Quote:
Originally Posted by passel
Yes, the color value is a long, and three of the bytes in the color represent the RGB (Red, Green, Blue) levels of the colors.
Gruff's first two examples are meant to be the same value as your example line of code, but Intel processors are little endian, and the red color comes first in memory, which is the lower byte of a long.
So, the same color that you have (which should be a very light red, (an off-white pink)), could be expressed in Hex, decimal, or RGB function
&HCCCCFF, 13421823, RGB(255,204,204).
Gruff just had the bytes reversed in the RGB function, following the big endian order that we print numbers in.
|
i need ask anotherthing: why, when we use the directx, after close the program, the IDE size is changed and otherthings?
|
|

01-16-2012, 12:28 PM
|
 |
Sinecure Expert
Super Moderator * Guru *
|
|
Join Date: Jun 2003
Location: Upstate New York, usa
Posts: 7,714
|
|
|
I don't do DirectX, but I assume it is because you're running the DirectX in full screen mode, and the screen resolution you choose is not the same as what you have Windows set to.
DirectX has to change the screen resolution to what you asked for, and if it is smaller than what Windows' resolution is, Windows will resize windows and possibly re-layout icons to fit in the new smaller resolution. If you revert back to a higher resolution when DirectX exits, the smaller windows and icon positions will still fit, and won't be resized back to an unknown previous size (although the icons may reposition if you have auto placement turned on).
|
__________________
There Is An Island Of Opportunity In The Middle of Every Difficulty.
Miss That, Though, And You're Pretty Much Doomed.
|

01-16-2012, 01:45 PM
|
 |
Senior Contributor
|
|
Join Date: Feb 2008
Location: somewhere in space
Posts: 1,177
|
|
Quote:
Originally Posted by passel
I don't do DirectX, but I assume it is because you're running the DirectX in full screen mode, and the screen resolution you choose is not the same as what you have Windows set to.
DirectX has to change the screen resolution to what you asked for, and if it is smaller than what Windows' resolution is, Windows will resize windows and possibly re-layout icons to fit in the new smaller resolution. If you revert back to a higher resolution when DirectX exits, the smaller windows and icon positions will still fit, and won't be resized back to an unknown previous size (although the icons may reposition if you have auto placement turned on).
|
thanks for the help
note: my objective, using directx, is for speed up my graphics effects and image processing 
|
|

01-28-2012, 04:05 PM
|
 |
Senior Contributor
|
|
Join Date: Feb 2008
Location: somewhere in space
Posts: 1,177
|
|
ok.. by testing, i can't use the vb colors constants. why?
Code:
D3DDevice.Clear 0, ByVal 0, D3DCLEAR_TARGET, vbYellow, 1#, 0
instead give me the yellow color, give me the cyan color. and the vbcyan give me the yellow color. theres more examples of these problem. can anyone tell me why?
the directx have 1 property\const for work with colors?
|
|

01-28-2012, 07:01 PM
|
 |
Sinecure Expert
Super Moderator * Guru *
|
|
Join Date: Jun 2003
Location: Upstate New York, usa
Posts: 7,714
|
|
Well, as I said I'm not a DX programmer, but obviously the format of the D3D color is not the same as the VB colors.
The VB color constants do not include alpha values, so I would think that would be an issue to start with. The order of Red,Green,Blue is probably reveresed in D3D, which probably aligns with the order used on the Web and .Net. The .Net constants can probably be used, but you may as well just create your own constants in your code.
There are a number of methods provided to set the D3DCOLOR type, i.e.
D3DCOLOR_ARGB
D3DCOLOR_AYUV
D3DCOLOR_COLORVALUE
D3DCOLOR_RGBA
D3DCOLOR_XRGB
D3DCOLOR_XYUV
Just use whichever of those you like, define what colors you want, and move on.
There are only a handful of VB constants anyway, so you can create your own set of constants in your code to replace them.
There is any number of ways to pull the Red, Green and Blue values from the VB constants, but I'll give another example.
Code:
Option Explicit
Private Type Colr32
Colr As Long
End Type
Private Type RGBA
R As Byte
G As Byte
B As Byte
A As Byte
End Type
Private Sub Command1_Click()
Dim colorStruct As RGBA
Dim colorVal As Colr32
With colorStruct
colorVal.Colr = vbRed
LSet colorStruct = colorVal
Debug.Print .R, .G, .B
colorVal.Colr = vbCyan
LSet colorStruct = colorVal
Debug.Print .R, .G, .B
colorVal.Colr = vbWhite
LSet colorStruct = colorVal
Debug.Print .R, .G, .B
End With
End Sub
|
__________________
There Is An Island Of Opportunity In The Middle of Every Difficulty.
Miss That, Though, And You're Pretty Much Doomed.
|

01-29-2012, 06:52 AM
|
 |
Senior Contributor
|
|
Join Date: Feb 2008
Location: somewhere in space
Posts: 1,177
|
|
thanks for the help.
heres the line updated:
Code:
D3DDevice.Clear 0, ByVal 0, D3DCLEAR_TARGET, D3DColorRGBA(0, 0, 255, 255), 1#, 0
the order of the color is RGBA. in these case the selected color is Blue. and we don't need the alpha value, that's why we put 255(the max value).
thanks
|
Last edited by passel; 01-30-2012 at 02:50 PM.
|

01-30-2012, 02:44 PM
|
 |
Sinecure Expert
Super Moderator * Guru *
|
|
Join Date: Jun 2003
Location: Upstate New York, usa
Posts: 7,714
|
|
|
If you didn't need the Alpha (default to 255), you could have done.
D3DDevice.Clear 0, ByVal 0, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0, 0, 255), 1#, 0
|
__________________
There Is An Island Of Opportunity In The Middle of Every Difficulty.
Miss That, Though, And You're Pretty Much Doomed.
|

01-30-2012, 03:12 PM
|
 |
Senior Contributor
|
|
Join Date: Feb 2008
Location: somewhere in space
Posts: 1,177
|
|
Quote:
Originally Posted by passel
If you didn't need the Alpha (default to 255), you could have done.
D3DDevice.Clear 0, ByVal 0, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0, 0, 255), 1#, 0
|
thanks for that information 
now i'm with 1 problem: when i close the program(using the fullscreen code), the VB6 IDE window size is changed. can i avoid these problem?
|
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
|
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|
|