@# Quotes DB     useful, funny, interesting





Google
 
Web www.quotesdb.info
Undernet  |  EFnet  |  Quakenet  |  Freenode  |  Dalnet  |  Ircnet  |  Galaxynet
Page: 1 2



Comments:

<0> i've got a problem with loading two objects at once. i made a cl*** for my object, and one of it's properties is it's coordinates. i can render and manipulate that one, but when i make a new object and i render everything in the same way except for the coordinates, nothing shows up on the screen at all
<0> any suggestions, or do you want me to paste the code on a website?
<0> like, is the some function that needs to be called to load multiple things? gah, i'm even confusing myself
<0> http://rafb.net/paste/results/CaoUEP30.html
<0> that's the relavant code
<0> it's only about 20 lines
<1> if you remove the cpu.gldisplay call it works?
<0> yeah
<1> so whats in that function?
<0> let me compile it again to check
<0> well, all the relevant code in the gldisplay code is right there
<0> in ship::gldisplay()
<0> cpu is declared as a ship type
<1> i see
<0> and it has a set of coordinates in an array called coords[9]
<0> hm..



<0> well this is odd
<0> it worked yesterday, and now it doesn't
<0> even if i remove cpu.gldisplay
<1> try removing the glLoadIdentity line?
<0> nope, nothing. are my push and popmatrix() functions in the right place?
<1> there is no pop in the paste
<0> i'm really stumped, cause this worked last time i compiled it
<0> woops, well the pop comes right after the two player and cpu.gldisplay() functions
<1> player works but cpu does not?
<0> not anymore, for some reason
<0> hold on, let me fiddle with this, it could be a variety of errors. yay for no error checking code
<0> well, it looks like the problem is that it's only showing up for one frame
<0> then going black
<0> which could be caused by a lot of things
<0> well, here's my question, when you're rendering two things using glbegin and glend, do you put the pushmatrix before everything, then pop After everything?
<0> or do you push and pop in between?
<2> That's not allowed.
<0> what
<0> pushing and popping more than once between frames?
<2> No, altering the matrix or the matrix stack between a glBegin call and a glEnd call.
<0> no i mean
<0> do you do it like this:
<0> pushmatrix();
<0> glbegin()
<0> blah
<0> glend()
<0> glbegin
<0> glend
<0> popmatrix()?
<2> Beats me. I don't know what transformations you are implementing.
<0> well, chances are i should probably re-RTFM
<2> Why push and pop if you don't do any transformations at all?
<0> well i Am doing transformations
<0> did you look at my paste?
<0> http://rafb.net/paste/results/CaoUEP30.html
<0> where should my pushes and pops be in that code?
<2> What do you actually try to do?
<0> ok
<2> Do you want to rotate the ship around its own axis?
<0> it rotates depending on which key is pressed
<0> that's in a different part of the program
<0> it changes the value of ship::angle
<0> well, actually
<0> it changes the value of player.angle
<0> and i just want the cpu one to render and sit there right now
<0> while my player one moves around
<2> Your code snippet is very short. It's impossible for us to know what state the model view matrix is in.
<0> and here's the deal, when it was working before, i could move and rotate the triangle no problem, the actual transformations aren't causing the problem
<0> ok, you want the whole program? it's about 200 lines
<2> Or what coordination system your ship are relative to.
<2> No, I'm off for work in 10 minutes. Sorry :-)
<0> gaaah
<0> well here it is for anybody else
<0> http://rafb.net/paste/results/DV9RUI86.html
<2> Awfyl NeHe code.
<2> Anyway, you forgot to reset your matrix to identity.
<0> oh?
<0> well i'm just starting, i'm really trying, despite my noobish tendencies
<0> what do you mean by that?
<2> And you have probably multiplied the modelview matrix with an orthographical projection matrix.
<2> The identity matrix is the matrix definition for 1.



<0> oh. so what function did i screw that up with?
<2> You can't simply remove code to fix this problem.
<0> i figured as much.
<0> well, could you perhaps briefly explain why i seem like such a ****up right now before you head off?
<2> You have to make sure you set up your ortho projection with the projection matrix.
<0> ok, stupid question
<2> glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrtho(..)
<0> how will i know what the projection matrix is?
<0> oh
<0> so i do it in that order?
<2> And before you draw anything, after or before clearing the buffers, do:
<2> glMatrixMode(GL_MODELVIEW); glLoadIdentity();
<0> oook
<0> i'll fiddle with that
<0> thanks a lot
<2> http://web.archive.org/web/20041029003853/http://www.j3d.org/matrix_faq/matrfaq_latest.html#Q6
<2> Read that :-)
<0> guess what?
<2> No problem.
<0> it wasn't my projection matrix, i just added in loadidentity after ortho and it works
<0> although the second triangle doesn't show up yet, it's progress
<0> thanks
<2> "It works" isn't neccesarily the same as "It's correct"
<0> oh
<0> well working is always better than not working
<0> i'll add the other things in, of course, but i'm just glad it was a simple omission somewhere
<2> The driver can play tricks on you. Follow the opengl specifications to avoid any nasty supprises later.
<2> Eh?
<2> You reset the matrix after multiplying it with the orthographic projection matrix?
<2> Do you even know what you are doign?
<2> doing*
<0> of course i do
<2> My advice: Stop guessing, start learning and knowing.
<2> Then why didn't you omit the orthographic projection in the first place+
<0> i'm not poking in around in a dark room with the stick of ignorance
<0> i'm really trying
<0> omit the orthographic projection? i kinda need that
<0> or at least i thought i did
<2> glOrtho() .. glLoadIdentity(); isn't of much use. Then you simply reset the matrix, destroying your projection.
<0> well if i omit ortho, even before loadidentity, it won't work
<2> Then your vertices are wrong, or your ortho parameters are wrong.
<0> it's doing the opposite of what you're saying, that loadidentity is making it work, not the other way around
<3> How goes it?
<0> no, my ortho paramaters are right, ortho has a tendancy to not work at all if your paramaters are wrong
<2> Removing code until it works, must be the one most lame thing to do in this universe.
<0> not nessecarily, it at least shows you what's causing or not causing the problem, in some cases
<2> Anyways, I'm off.
<0> yeah, thanks for your help
<0> i'm really trying to not be a n00b, but i'll rtfm a little more
<0> but thanks
<2> It has never been a good substitute for rtfming
<0> yeah, i know
<2> I didn't help, because you didn't do what I said ;)
<0> dammit, i've really been trying to RTFM, but i just can't get my head around something
<0> i've got this code here: http://rafb.net/paste/results/fthPgk34.html
<0> and i can render and manipulate one object, but as soon as i tell it to render two, it'll only render the first one i tell it to render
<0> in lines 125 and 126, that code displays those objects, but it'll only display the first one in the list, if i rearrange them, it's always the topmost one that renders
<4> your use of the gl-matrices seems incorrect.
<4> it looks like you're setting up an ortho matrix on the modelview stack
<0> so what should i change? i'm sorry to sound like such a n00b, i'm really trying not to, i've been avidly reading the red book
<4> you want to be in projection mode (glMatrixMode(GL_PROJECTION)) when you set up your projection (the glLoadIdentity/glOrtho)
<4> then you want to switch back into modelview mode
<4> and render objects
<0> aha, i see
<0> i'm sorry, it appears i've been wasting your time, madsy told me almost the same thing earlier, but i was too busy fixing another problem to notice that he was telling me how to fix *this* problem
<4> :)
<0> but thanks though =)
<5> I cant believe im still having problems with bsp tree's
<3> Hrmm, I'm curious, I've got a bit of a hierarchy of structures with a lot of stl containers in there, and some of which the elements I dynamically allocated. So when the deconstructor is called, I'm freeing the allocated memory, but I'm curious about the containers themselves.
<3> Do you think it would be cleanest to resize the structures to 0 in the deconstructors or does it matter?
<5> whoa
<3> what?
<6> as long as you call delete, it will properly free the memory


Name:

Comments:

Please enter the result of the sum 63 + 46 (to avoid spam):






Return to #opengl
or
Go to some related logs:

#politics
freebasing xanax
cid magnum efnet
#beginner
#dsl
#flash
#politics
#computers
#politics
#politics



Home  |  disclaimer  |  contact  |  submit quotes