.p, Battle Files 'n Milkshape 3D

  • Thread starter Thread starter Alhexx
  • Start date Start date
Status
Not open for further replies.
alhexx - i have very little knowledge in this field. But there is a possibility that i had previously forgotten about. My computer won't run q3a, and i think the reason is that, by default q3a runs on OpenGL instead of D3D. Prohaps a d3d version of your program would work. But i dont know if that would be hard or not.
 
heres the line that vb6 gave me when I debugged:  glColor3f ColorR(PolyP2(n%) + value3 * 2) / 255, ColorG(PolyP2(n%) + value3 * 2) / 255, ColorB(PolyP2(n%) + value3 * 2) / 255
 
To use textures ... that's *slightly* complicated.First of all you need to get some "raw" texture data into your program. It's up to you how you're going to do that ... not sure how VB'll work. Delphi can do it easily from BMP files for you.

Then, upload it to the video card using glTexImage2D. Note: Width/Height must be powers of two (2,4,8,16,32,etc).

Enable texturing with

glEnable(GL_TEXTURE_2D);

For each vertex, specify the texture coordinate (which position on the texture image to use) with glTexCoordinate. Works a lot like glColor. You can still (and should) specify a colour with glColor as well; it'll be blended into the texture. Specify white to leave the texture unchanged.

Hopefully that's all you need to use simple textures.

To use multiple textures at once you need to use texture bindings. You can do that using

glGenTextures

to create a new "texture object".

and

glBindTexture

to activate a texture.

Basically, say you generate two texture bindings, T1 and T2.

If you did

glBindTexture(T1);
glTexImage2D(....., SomeData1, ...);

glBindTexture(T2);
glTexImage2D(....., SomeData2, ...);

Texture T1 would contain the texture data held in SomeData1, T2 the data from SomeData2.

When you wanted to draw polygons using texture 1, just do

glBindTexture(T1);

to activate it, and so on.

Once you've finished with a texture, use

glDeleteTextures

to remove them.

That's the *basics*. You should really look at a proper tutorial if you get any problems.

How to get at TEX files? My LGP tools can convert them to BMP's easily. There's a Delphi unit on my website (PSXTex) that contains the code I used to do it, if that's any help.
 
nope. voodoo 3 2000 AGP and an abit.i guess it is also too complex for poly3. oh, and was the b instead of an f on purpose? I tried it both ways.
 
Alhexx: I just noticed your question about the DLL's  :wink: No, the conversion code isn't in either of the DLL's but I could very easily wrap it up into a DLL for you if you wanted.
 
ok, heres whats wrong: the second glcolor3f it reads makes the expression too complex.
 
Fice Tetxures: Ok, I'll try it out.Fice DLL: No need for now. I'll use your tex-to-bmp converter temporary...first I just want to check out, if my supose is right, that value3 has got to do with the textures (well, I'm quite sure...)

Darkness 1: The b means Byte; f means Float
Here's how the OpenGL commands are put together (AWAIK, Fice knows it better...)

glcolor3f - Type of arguments (float, nteger, ...)
 |     |
 |     Number of following arguments
 |
Command

Dakrness: hm, interesting...

- Alhexx
 
Yes, that's right.If the expression's too complex,

a) VB is crap
b) Work out some parts in advance and assign them to their own variables. Then just do

glColor3f(RVal, GVal, BVal);

...having stored the values in their own variables, so each line is simpler.
 
Fice: I guess u think answer a) is right, heh?  :wink:Fice 2: What do you mean talkin' 'bout 'raw' data? Only the RGB values?

I've read the MSDN (MicroSoft Developer Network) 'bout OpenGL. There was an example for how to decode a DIB image for OpenGL. But the Source was for C++...

So it'd be nice if u could wirte a DLL that reads out the 'raw' data out of a BMP or better TEX file...
I think I could programm that myself, but the result of programming it under VB would be REAL SH*T...  :D (that's u'r opinion, too, heh ?)

BTW: take a look at that new .p format topic...

- Alhexx
 
Raw data means that, yes: just the RGB values for each pixel, one after the other, in one big data block. I suppose in VB you *could* do it with an uber-byte-array, but it wouldn't be very nice  :wink:I'll see if I can cram some of my functions into a DLL for you.

Other topic: Took a quick look. Progress Is Good! If you dig anything else up post it; eventually I'll get around to updating the docs on my website...
 
code:

Code:
glColor3b ColorR(PolyP1(n%) + value3 * 2), ColorG(PolyP1(n%) + value3 * 2), ColorB(PolyP1(n%) + value3 * 2)  glVertex3f VertX(PolyP1(n%)), VertY(PolyP1(n%)), VertZ(PolyP1(n%))   glColor3b ColorR(PolyP2(n%) + value3 * 2), ColorG(PolyP2(n%) + value3 * 2), ColorB(PolyP2(n%) + value3 * 2)  glVertex3f VertX(PolyP2(n%)), VertY(PolyP2(n%)), VertZ(PolyP2(n%))    glColor3b ColorR(PolyP3(n%) + value3 * 2), ColorG(PolyP3(n%) + value3 * 2), ColorB(PolyP3(n%) + value3 * 2)  glVertex3f VertX(PolyP3(n%)), VertY(PolyP3(n%)), VertZ(PolyP3(n%))
this seems to work for most of it. except parts of yuffies face are blue and green. the hair is alright though.


[/quote]
 
Fice: Thanx.Darkness: That's quite good. I'll look if I can finish this way of vierwing models in ultima...

- Alhexx
 
darkness: Try this one:glColor3f ColorR(PolyP1(n%)) / 255, ColorG(PolyP1(n%)) / 255, ColorB(PolyP1(n%)) / 255

If this worx, download Ultima 0.27 BETA 12 and that should make u happy  :)

- Alhexx
 
nope.  :(i did learn more though.
GlColor3b only works w/o the /255 because that makes the expression too complex.
GlColor3f doesnt work with or without the /255.

the code i posted earlier only seemed to screw up on skin color.
 
darkness: Damnit, I'm stupid! I've copied the wrong code!!! This one:glColor3s ColorR(PolyP1(n%) + value3 * 2) * 128, ColorG(PolyP1(n%) + value3 * 2) * 128, ColorB(PolyP1(n%) + value3 * 2) * 128

This one *should* work, b'cause it uses shorts, no floats...

BTW: Try downloading Ultima and run this one...

- Alhexx

- edit -
And if this doesn't work, try making an CLng() function on every color...understand me?

example:
glColor3s CLng(ColorR(PolyP1(n%) + value3 * 2) * 128)

I guess that could make the expression too complex, too, but try it...

[This message has been edited by Alhexx (edited July 31, 2001).]

[This message has been edited by Alhexx (edited July 31, 2001).]
 
the expression isnt too complex anymore, the colors are just a little messed
 
Have u downloaded Ultima beta 12 and tried? Colors messed up, too?The 'F**k Error 16 Mode' of Ultima worx quite fine on my comp; no mixed up colors...

- Alhexx
 
Loads file at boot? Heh?   :-?
I haven't implemented a 'load file at boot' function or sth like that..I'll have a look at my source and I'll compile a special version 4 you.

What's your mail, so I can send it to u?

- Alhexx

- edit -

Fice: How 'bout this DLL?

Fice: What format has that 'raw data' got to be? A Sting? An OpenGL Type?

[This message has been edited by Alhexx (edited August 01, 2001).]
 
Status
Not open for further replies.
Back
Top