OK
I have to draw a living room and its easy an all with C since you basically just do
glBegin(GL_QUADS)
glVertex3i(put in all your coordinates for all 6 sides)
glEnd()
and it draws your cube for you rite?
but how do You do it using classes?
OK
I have to draw a living room and its easy an all with C since you basically just do
glBegin(GL_QUADS)
glVertex3i(put in all your coordinates for all 6 sides)
glEnd()
and it draws your cube for you rite?
but how do You do it using classes?
-Ti22-
Depends how you want to do it. Two common ways are to have the room object draw itself or to have another viewer object draw the room model(similar to model-view-controller or MFC's document-view). So, for example, you could have an interface like this:
The style used here would be for the room object to draw itself. On the other hand, having the room model notify a viewer object when it has changed could look like thisCode:class Room { public: // ... // void draw( // ... // ) private: // vertex data } ;
In the techneque above, when the RomeModel changes, the RoomViewer is notified, by stateChanged. The RoomViewer will then attempt to draw itself on the screen or update some type of display infomation.Code:class RoomModel { void addChangeListener(ChangeListener l); void removeChangeListener(ChangeListener l); public: // vertex data }; class RomeViewer : public ChangeListener { public: virtual void stateChanged(ChangeEvent e); };
What technique you use depends on the circumstance. I don't know too much about OpenGL, but the first technque, I think, is usually the best if all the rendering is done all at once. The second technique might be good for a GUI application, whereby the screen is rendered only when a display object has changed.
I am abit of a noob I can't understand your code
-Ti22-
You understand the first example, right?
For the second example, the methods to add and remove the model listeners should be public, and the data should private. When the model changes, the code, if completed, should tell its listeners, the viewers, that its data has been modified. The listeners are then able to react to this change in data by drawing themselves. But this technique isn't too useful for opengl; you're drawing the objects that are visible, rather than the objects that have changed.
I am sure your explanation is awesome
but I am just stupid, dull
what does //...// mean?
I just got into C++ for like 1 or 2 days maybe I need to read some more tutorials.
my lecturer was kinda mean he basically threw the coursework rite in our face and we've never i repeate NEVER done C++ before
sure we can do C not a problem but the CW Spec says C++ so I assume we have to use classes n stuff which we have no idea. anyways I am gonna get back to doing some more detail research. and come back to this thread in a few days.
-Ti22-
// is a C++ style comment
it comments out the rest of the line
The code I gave you was never meant to be compilable, but you could replace with /* */. I used that notation just to mean that you'd probably have to send in a graphic device context of some sort, I think OpenGL hides this within the library.
Well, you have to give yourself some time to learn C++.but I am just stupid, dull
Go to NeHe Downloads and download the resources - nehe_sdk.zip. Within this zip file lays the best OpenGL scene creator. All you have to do to create your scene is to put your code in between this one function in this one class, start with the first example, rip out the stuff you don't need, compile, edit, compile, edit, repeat 200 times, and you're an OpenGL wizard ;)
Repeat 20000 more times, and you'll be working for a really good game designing company! lol
K i will give it a go.
thx guys.
-Ti22-
I'm not sure they'll allow you to use a third API in a course.
I just finished the Window GL framework but its all in Structured code
so now I am gonna convert it to OO Code.
-Ti22-
Originally Posted by sean_mackrory
I am not using it I am just taking a look at the code and seeing how it is applied.
-Ti22-
Since the API is written by people who have a great deal of experience in C++, looking at them will probably only serve to confuse you more.
well
I am now writing the OpenGL for Windows framework in C++ and I am slowly getting the hang of it. but I do get confused too like you say. I'll try it if it fails then. I don't know what to do
dunno why our lectuere forced this on us.
I think its wrong to just let us do OO program with OpenGL when we've never done it before.
Last edited by Ti22; 01-10-2005 at 09:30 AM.
-Ti22-
ok I am completely lost now lol...
pls tell me what I am doing wrong.
http://ti-x.net/files/WGLOOSkeleton.rar
Last edited by Ti22; 01-10-2005 at 12:31 PM.
-Ti22-