Firstly I do not understand the error fully and secondly I have no direct references to these forms in the code.

Can anyone shed some light on this for me. Sorry if this is a dumb question. I have been looking at open gl for about 4 hours now (including getting C++ up and running) and most of that time has been on help and web to try to resolve this.

Gwynnnn

12-05-2006, 06:10 AM

If it helps I have copied the full code used to www.good-image.co.uk (http://www.good-image.co.uk) (no formatting)

Gwynnnn

12-05-2006, 06:15 AM

I may have been a little premature!

I have started again as I made a guess that the code was conflicting with something else that may have been left behind from another test.

I get it to compile, link, build and run now.

BUT

All I get is a blank window, no pretty triangle. I will keep looking at it. If anyone can help in this new aspect please see the code at good-image.co.uk and offer any advice.

Thanks

songho

12-05-2006, 06:45 AM

Gwynnnn,
I don't see projection settings in your code. The eye (viewpoint) is at (0,0,0) and looking along -Z axis by default. The view point may be on the same plane where the pretty triagle is placed.

Thanks for looking. I think my problems are way more basic than that. But I will appreciate your help never the less.

When I do a run I get a blank form (Form1) no colours, no trinagles, nothing. So my guess is that I am really doing something basic wrongly.

I notice that I have a bit more code that I should have put on to good-image that I had thought was irrelevant. Wrong probalby, so I will put up the complete code.

Please have a look and tell me why it draws up Form1 and does not attempt (apprantly) to draw any coloured triangle.

I think it explains why Form1 appears, but I am stumped as to where the triangle or window with a triangle is.

Gwynnnn

12-05-2006, 07:25 AM

Sorry I am having a bit of a panic attack. Copied the wrong file up. I have now copied the right file.

Gwynnnn

12-05-2006, 07:29 AM

I suspect that i need to put something onto Form1, presently I have put nothing at all. Any suggestions?

Gwynnnn

12-05-2006, 07:51 AM

I believe that the code shown does not touch the windowing or display parts when running. This is my own error thoughg a lack of understanding.

Can anyone suggest what I should be writing in order to get things up on the desired window?

Gwynnnn

12-05-2006, 08:32 AM

I think I have completely lost it.

Is there anyone I can ask to lead me through these initial stages.

I can't even get it to 'like' references to glut.

I despair right now.

Komat

12-05-2006, 09:23 AM

With default projection matrix (identity matrix) you need to have Z coordinate of the vertices inside the <-1,1> range. After that change (and removal of Borland specific stuff from file beginning) the triangle was shown when I compiled your source in Microsoft Visual C++.

While not directly related, the ReleaseDC expects hwnd as first parameter.

Gwynnnn

12-05-2006, 09:32 AM

Thank you for at least replying. I will be fine once i get at least one working situation.

I have now removed the borland specific stuff

(I presume you mean this part shown at the end of this text

however, I am totally new to open gl, how do I make the z coordinate range acceptable? Can you give me the example?

Thank you for taking the trouble to post up the example code. I had taken the simplest code I could find previously.

I have now entered your code into a header file and a code fle. It compliles, makes and builds fine.

Unfortunately I still only get a Form1 which is very nice shade of buff brown, but absolutely nothing drawn inside it.

This is beggining to sound a lot more fundamental but i have absolutely no idea what is wrong at this stage.

Any ideas?

Komat

12-05-2006, 11:37 AM

Originally posted by Gwynnnn:
Can you tell me exactly what I should be seeing when the program runs? as it would help.

Should I be seeing a form only? Should there be another box or window inside that? (I think not). Should there be a coloured triangle only inside the form? (I think so). I am seeing this image (http://www2.webpark.cz/jiridvorak/ruzne/triangle.html) . I uploaded modified source code and compiled program to that page so you can try it if it works for you.

What graphic card do you have?

Gwynnnn

12-05-2006, 11:50 AM

Oh now that is the sort of thing I was expecting and wanting to see.

I have only recently built the new PC. It has an NVIDIA GeForce 7900 GT card. It is GL enabled as I have run a pre compiled item I found on the net yesterday.

My problems seem to be stemming from my lack of understanding of Borland C++ version 6. There must be something that i have not set or done.

What i see is like a normal empty form. I could be creating an dbuilding all wrong. The small window in your example image is what I expected to see but it is absent (or not visible).

Anyone want to take it step by step from opening the C++ IDe to the run itself?

Gwynnnn

12-05-2006, 11:54 AM

Ah ha. A step further. I deleted all forms that were present on start up of the C++ IDE. I then loaded up the example. Built it. and then ran it.

What did I get -

Absolutely nothing at all! A blink of the object viewer window 9as expected) and then all back to the code window.

My conclusion from this is that if the porogram is running then it is going straight through it and ending before i can see anything at all.

Any help?

Komat

12-05-2006, 12:08 PM

To run the source code from me you probably need to select some sort of "Windows application without forms" build/linking option otherwise the builder will create its own initialization code that tries to run the forms and will ignore the WinMain function.

I never used the Borland compiler so I do not know how to select that.

EDID: I read some tutorial on net and it appears that you need to create new application project using the "Console Wizard" type.

Gwynnnn

12-05-2006, 12:18 PM

Mmm that seems logical. So I have now created a console unit in borland C++.

The code compiles, makes, builds, runs and we now get a console window (as expected)

BUT

No graphics.

I really think that this is a very basic fundamental cock up on my part.

I am very grateful for your help and please keep it coming. At some point it must crack.

Gwynnnn

12-05-2006, 12:21 PM

Other points: the black console window appears to be very large. GFar larger than I woudl have expected.

It certainly is not 0,0,256,256

It seems wider and I have to scroll down a long way to get to the bottom.

So it may jus tbe a normal sized console window. ie not drawn up by the graphics application code.

Incidentally I am still using the code kindly posted here by an earlier contributor if you are interested.

Gwynnnn

12-05-2006, 12:22 PM

Yes, I think I am right as the console window shown when running has no title (Minimal) at all. Its just a console window. So this may or may not be the right direction.

Komat

12-05-2006, 12:30 PM

There are two application types you can create. With console (this is the one you created) and without console, both should be creatable using the "Console Wizard" (at least according to the tutorials (http://www.functionx.com/bcb/topics/wndfunds.htm) I read). In MSVC they each expect different main function and only the one without console expect the WinMain.

Code from marc2718 on the other hand requires the Borland forms however I do not have that compiler so I can not try that by myself.

Gwynnnn

12-05-2006, 12:38 PM

Is there anyone out there who has Borland C++ Builder version 6 and can lead me through setting up a siomple gl app (ie a window and a cbe of colour), step by step?

marc2718

12-05-2006, 01:02 PM

Gwynnn, sorry my code was inconsistent (the variable names), actually it should not have compiled for you.
Anyhow, the following is correct.
( I think this is as simple as it can get)

The best thing for this code just create a new regular c++ builder application.
NOT a console application, that is not the way you will be using C++ Builder.

Cut and paste this code into your app.
You need to create the OnCreate event and the OnPaint event then just add the code in there.
The only function you need to create manually is
the SetPixelFormatDescriptor function.