Submit
In response to Converting bmp files
Fdbdc4176840d77fe6a8deca457595ab
0
dk 158 Mar 21, 2003 at 17:31

oh ok, now I understand your question.

Ok, first of all you need to load the pixel data of the file into memory. Having an array like this is good enough.

unsigned char *data = new unsigned char[width*height*bpp];      // where bpp is bytes per pixel

then load the pixel data from the file into that array. Parsing files depends from format to format. But since your loading BMP files, then its easy (if no compression is applied). Its just a matter of copying. All you need is to point the file pointer to the pixel data and do a fread() or similar in a for loop. To make the pixel data consistent with the RGB sequence instead of the BGR sequence just do this:

     for (int i=0;i<height;i++)
     {
          int index = i*width*3;
          int j,k;
          for (j=0;j<width;j++)
     {
              data[index+j*3+2] = read8BitValue(filePtr, bytesRead);
              data[index+j*3+1] = read8BitValue(filePtr, bytesRead);
              data[index+j*3] = read8BitValue(filePtr, bytesRead);
          }
     }

Lets say for the sake of clarity that you are loading a 24-bit image, then each 4 indicies of the array would represent a pixel. e.g. data[0] represents the blue, data[1] green, data[2] blue, etc…

To write all that to a file, all you need to is to fwrite() the data array to the file. You will also need to store other information, like width, height, depth, etc… in the file.

I hope I answered your question. I can post a whole demo on loading BMP files if you want, but then it would be worth to make it a tutorial for the general public.

In response to Converting bmp files
49921baa7439fb1e91e02caf0a925cfe
0
DarkLight 101 Mar 21, 2003 at 16:13

I know how to include bitmaps and waves with VC++. But that is not what I need. I meant is that I want to get the RGB values for all pixels in the bitmap (bitmap is stored is this way: header and BGR values, BGR means that it is stored Blue Green Red instead of Red Green Blue) and put all RGB values for all pixels of all bitmaps into one file, called textures.dat
In this way the game will be easy to port on Linux and graphics can be updated
Also I don’t know how to build bitmaps into resource of Delphi :( I know how only if VCL is used but my game don’t use VCL

In response to Converting bmp files
Fdbdc4176840d77fe6a8deca457595ab
0
dk 158 Mar 21, 2003 at 08:28

Do you mean you want to include the picture data inside the executable? If you using delphi, I’m not sure how. But for Visual C++, all you have to do is use resources. If you want more details on how do it, then let me know :D

590e8bdac8129bd87b188df15e62d0e5
0
CyraX 101 Mar 20, 2003 at 15:39

CG would be used in Gamez and presentations, media - LOTR stuff.
In CAD/CAM you dont need stunning graphix, what you need is realism interms of physics and physical quantitites.

0684f9d33f52fa189aad7ac9e8c87510
0
baldurk 101 Mar 17, 2003 at 18:23

hmm, I’m not sure that cg would be used in CAD/CAM. There are more appropriate solutions for the CAD/CAM industry, which aren’t appropriate for games.

In response to Actual Game Developing
C24eb7e6aaefba78b94c831ddc7b4d0b
0
donBerto 101 Mar 17, 2003 at 06:01

apex: you’re absolutely right and is the heart of all partnerships - to reduce dev time.

working with a team, though, you lose control. be it design or approach. there will be things that are generally wise to do and that everybody should do and that’s fine. it’s things like wanting a certain feature done a certain way and a fellow team member may have their own way of designing or implementing that feature which may not go well.

but that’s why working with people you know* is key. if you know the person, you can kind of tell how they’re going to develop it. better yet, you can let that person know how you want it done. all leading to what baldurk and davepermen are saying. communication and sharing of resources. divide and conquer BUT act as one entity.

:yes:

1c7757ea91b5bbf7a4d2cf0563b9e872
0
sumedhs 101 Mar 17, 2003 at 05:08

Well the debate of OGL Vs DirectX continues…

One of the major advantages of an OGL code is that its portablility & genericity to any language. I can have one function defined in VC for panning in 3D & the same will work good in Python! We just need to handle the data types but the OGL calls more or less remain same.
Python has an implemented PyOpenGL library that implenets all the openGl calls. Its much easy to handle things there.
Nextly Gaming is not the only industry where CG is Used. Are we overlooking the Huge CAD/CAM industry?
I used a DX in some earler projects in my CAD firm but there was one where we needed to implent Model Deformation through Graphics. The challange was that the code needed to be workable on IRIX. PyOpenGL was the solution.

I think we all need to get out of the hole that Microsoft is digging by forcing us to follow their standards. Just because lot of people use MS standards does not make it better.

Besides that I personally find OGL is very easy to implement. One thing where OpenGL *USED* to fall back was device interface; But OpenGL was intended to be a purely a graphics API.

Anyways now with the advent of OpenML & OpenAL it has almost overcome its limitations wrt DX as well!
OGL LIVES!

In response to Actual Game Developing
Fdbdc4176840d77fe6a8deca457595ab
0
dk 158 Mar 16, 2003 at 21:04

Thanks donBerto : yes certainly working with a team is a good idea. Has some advantages and disdvantages though.
One major advantage is that each team member can focus on a specific aspect of the game which definitely reduces down development time.

In response to Actual Game Developing
0684f9d33f52fa189aad7ac9e8c87510
0
baldurk 101 Mar 16, 2003 at 19:17

from what I can see, normally you need someone to co-ordinate it. The components have to be easily fitted together, and it’s that co-ordination that I see failing and that’s what brings down community projects. That and lack of time.

Sorry to be pessimistic, and I’m quite happy to join a group effort, but perhaps we should learn from others mistakes?

In response to Alpha values
E05263ec846eb85da803f56e2917962d
0
Noor 101 Mar 16, 2003 at 01:52

Hmm :rolleyes: . When I read the help menu concerning the problem you had, the help menu did not say anything about GLUT. But anyway congratulations :) .

In response to Alpha values
03460e685202f2d6efc0df9e9727975e
0
martin 101 Mar 16, 2003 at 01:01

Hmm, I see where the problem is…
I tried a demo program using GLUT. When I initialize GLUT with GLUT_RGBA and especially with GLUT_ALPHA,
it works. Unfortunately, I am not using GLUT, but Trolltechs Qt OpenGL component. I have to look for an
equivalent option there.

In response to Alpha values
03460e685202f2d6efc0df9e9727975e
0
martin 101 Mar 15, 2003 at 23:59

Yes, I’m sure that I am rendering transparent objects, the color values are all fine blended together.
I am using glReadBuffer(GL_BACK) to read from the back buffer (I’m using double buffering).
There is no alpha buffer from where I can read the intermediate alpha values.

In response to Alpha values
Fdbdc4176840d77fe6a8deca457595ab
0
dk 158 Mar 15, 2003 at 20:08

How are you rendering the screen? Are you sure you are rendering transperant objects?
Btw, read up on ‘glReadBuffer()’ to specify the buffer you want to read from.

In response to Actual Game Developing
6ad5f8c742f1e8ec61000e2b0900fc76
0
davepermen 101 Mar 15, 2003 at 17:28

what would be useful is to share components, means what ever gets developed gets combined together. so everyone could do its own game, but with combined resources.

and that way we could stay full platform independent, too. no mather wich api.

In response to Actual Game Developing
C24eb7e6aaefba78b94c831ddc7b4d0b
0
donBerto 101 Mar 15, 2003 at 16:15

in response to baldurk’s post:
for the most part, I’m a very optimisitic kind of person - I’ll give whatever it is I’m doing my best even when the majority has given up. however, because of this I can come off as a bit naive. take OpenCombat.org, a promising community that failed miserably. myself and this person from canada by the handle of zyklon were to only active developers out of 50+. our leader guy [the person who organized] wasn’t very good at communication - and for good reason. He came to a point in his life where he couldn’t afford to spend much time on ‘hobbies’. the leader slowly dropped out of the picture and the project unofficially became mine and zyklons. however, he, too, fell out of the picture and then it was just me - the only one doing any real work. I then ‘withdrew’, and have been working by myself. I’m sort of discouraged working with people over distances now. in short, you’re right and it’s sad.

in response to cyrax’s post:
that would be a great. I humored the idea of working with apex too. 2 heads are better than one. however, I think distance plays a big part. there might be ideas or what have you that is easier shared in person. I know teleconferencing can handle that now. which leads me to ask this: how many of us in this community have worked or is working with distant partners?

thanks.

In response to Alpha values
03460e685202f2d6efc0df9e9727975e
0
martin 101 Mar 15, 2003 at 15:20

I read the values from the framebuffer with
glReadPixels(0,0,512,512,GL_ALPHA,GL_UNSIGNED_BYTE,map);
All alpha values turn out to be 1.

In response to Alpha values
0684f9d33f52fa189aad7ac9e8c87510
0
baldurk 101 Mar 15, 2003 at 15:08

well, that’s not the problem.. Do the colour values get read right?

In response to Alpha values
03460e685202f2d6efc0df9e9727975e
0
martin 101 Mar 15, 2003 at 14:04

Sorry, that’s not my problem. I know how to texture transparent objects, but I want this alpha value in the framebuffer and I
have no idea how to do this. The alpha values in the framebuffer are contstantly one after the rendering process.

In response to Alpha values
0684f9d33f52fa189aad7ac9e8c87510
0
baldurk 101 Mar 15, 2003 at 08:34

if you look at the scene, make sure that the quads do have an alpha of 0.6. ie. see if you can see through them. If that’s OK, then it’s a problem in the reading process.

In response to Actual Game Developing
0684f9d33f52fa189aad7ac9e8c87510
0
baldurk 101 Mar 15, 2003 at 08:22

well, whenever I see communities trying to create games, most of the time it doesn’t work. It would be worth a try, but I think a lot of people here are used to working on their own.

I’d be interested though, if it was possible.

In response to what do you recommend?
0684f9d33f52fa189aad7ac9e8c87510
0
baldurk 101 Mar 15, 2003 at 08:18

I guess it all depends on how well you create your format, and just how much you can gain by creating your own format. If your format is going to end up almost exactly like MD3, there’s no point.

In response to what do you recommend?
590e8bdac8129bd87b188df15e62d0e5
0
CyraX 101 Mar 15, 2003 at 08:01

I would not really suggest making YOUR own format without taking a look @ what other formats support.
For example you could strip down those parts of the MD3 model that support the Shaders (I did because Riva TNT does not support it).
Creating ur own file format might just be a long process and often would end up making the format itself very cumbersome.

In response to Model Editing
590e8bdac8129bd87b188df15e62d0e5
0
CyraX 101 Mar 15, 2003 at 07:58

If you intend to use and create the models FOR gamez I suggest you take a look @ the following models and ignore the rest:
1) MD3 by far one of the easiest.
2) Half Life nice shapes
3) Unreal
4) Serious Sam (REAL FAST ONES)

if you plan to use the models for presentations and non real time apps:

1) 3DS (general standard)
2) ASCII (lotsa documentation)
3) Maya

590e8bdac8129bd87b188df15e62d0e5
0
CyraX 101 Mar 15, 2003 at 07:50

If you read the .plan of Carmac you will realise the number of features (he talks mostly of the performance as a function of color depth) what we all fail to realise is that OGL and DirectX have been REALLY made for different purposes.
OpenGL is a “tru” graphix library allowing the complete Rendering pipeline to be exposed. DirectX would not expose the rendering pipeline as such but the hardware apis enable it.
Now that is exactly the reason most of hte colleges/courses teach OpenGL - it teaches Graphix and not hardware specific routines.
Perhaps the ONE way OGL can beat the DirectX API is by having a different pipeline mechanism for games and for apps.
That way OGL might just be able to reach DirectX level.
Oh btw DirectX 9 might stay for a long time (gdconf) because M$ is not going to release a new DirectX library anytime soon.
Might be that this the ample time and the right time for OGL ARB to just revamp the whole pipeline and redo the processes.

590e8bdac8129bd87b188df15e62d0e5
0
CyraX 101 Mar 15, 2003 at 07:37

Or blender.
Even that is fine. Otherwise you will have a nightmare trying to assort those UV mapping and XY corodinates. Besides that other things like the color of the pixels also give you a bad time.
You could try using
GMAX if u are comfortable with 3DS Max only.
Besides that you might also try Cg if you go a little further for pixel/vertex shading.

Welcome to DevMaster, a community-driven game development website of posts and resources!

Recent Tags

indie × 4
game-development × 3
android × 2
gaming × 2
design-patterns × 2
windows-phone × 1
music × 1
sound × 1
ios × 1
multiplayer × 1
networking × 1
testing × 1
game-programming × 1
3d-engine × 1
shaders × 1
cross-platform × 1
royalty × 1
game-design × 1
game-industry × 1
graphics × 1
mmo × 1
open-source × 1
mmorpg × 1
gameplay × 1
glsl × 1